28 Commits

Author SHA1 Message Date
Timmy Welch
15e2ab97d6 Merge remote-tracking branch 'github/master' 2025-12-27 16:45:54 -08:00
Michael Stapelberg
2189376204 dhcp: clone hardware addresses throughout
I still noticed DHCP requests with incorrect MAC source addresses.
Turns out there were still a number of incorrect HardwareAddr usages.
2025-10-16 11:23:58 +02:00
Michael Stapelberg
0b9afc9273 dhcp4: clone HardwareAddr bytes defensively
I suspect that Go’s net package reuses its buffers and these bytes don’t remain
valid forever (perhaps only if the network interfaces of the machine change?).

At least that would explain why my DHCP client sent requests with a wrong address.
2025-08-15 08:29:33 +02:00
lordwelch
67711ee2c7 Merge branch 'master' of https://github.com/rtr7/router7 2022-03-04 13:30:38 -08:00
Matt Layher
6d41b077a9 internal/dhcp*: switch to github.com/mdlayher/packet (#70)
* internal/dhcp*: switch to github.com/mdlayher/packet
* internal/dhcp4d: update test constructor name to avoid packet conflict

Signed-off-by: Matt Layher <mdlayher@gmail.com>
2022-02-21 23:39:06 +01:00
lordwelch
b801bf699f Re-Add DHCP discover fallback for ISPs that don't advertise DHCP 2021-05-23 19:38:38 -07:00
Robert Obryk
f8d1b4c8f2 internal/dhcp4: make persistent errors actally persistent (#62)
Previously, a permanent error would not be persisted for future
invocations of ObtainOrRenew. In practice, the daemon immediately
exited, so this made no difference.
2020-11-23 09:35:00 +01:00
Matt Layher
411780cd8e internal/dhcp4: fix error case
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-05-09 17:00:07 -04:00
Michael Stapelberg
c0067c5aa5 change diff order to -want +got
This is easier to read and consistent with how we do things at work.
2019-07-11 08:42:21 +02:00
Michael Stapelberg
3765287e97 dhcp4: use SetReadDeadline, not SetDeadline
fixes https://github.com/rtr7/router7/issues/25

related to https://github.com/mdlayher/raw/issues/42
2019-03-21 09:18:32 +01:00
Michael Stapelberg
3dad1e9a23 dhcp4: use the configured (not the current) MAC address
This fixes a race where dhcp4 started before netconfigd had a chance to change
the hardware address on the uplink0 interface.

fiber7’s port security feature may result in an about hour-long internet outage
without this commit.
2019-02-19 09:39:16 +01:00
Michael Stapelberg
ddcdd39737 dhcp4: drop last ack to restart with DISCOVER upon receiving NAK
fixes #13
2018-12-25 14:10:21 +01:00
Michael Stapelberg
df9a40557c dhcp4: correctly check errors from c.once 2018-11-21 08:41:24 +01:00
Michael Stapelberg
bef7168112 dhcp4: resolve TODOs in comments 2018-11-21 08:41:07 +01:00
Michael Stapelberg
5b34daeb4e no-op cleanup: switch to dhcp4.LeaseFromACK 2018-11-21 08:23:57 +01:00
Michael Stapelberg
8c55c5ba44 dhcp4: switch to github.com/rtr7/dhcp4
All existing DHCPv4 packages I looked at were unappealing for one reason or
another, so we’re now using a little helper to glue github.com/google/gopacket
and github.com/mdlayher/raw together, which suffices for our use-case and gives
us more control.
2018-11-21 08:18:58 +01:00
Michael Stapelberg
0bbc1d923d refactor replayer code into pcapreplayer package 2018-10-22 21:04:35 +02:00
Philipp Hug
aa404c3c54 Request nameserver, router and netmask as it might not be automatically returned by dhcp server. (#7) 2018-09-05 10:06:31 -06:00
Michael Stapelberg
b05fd74006 dhcp4: increase timeout to 10s 2018-07-03 17:37:17 +02:00
Michael Stapelberg
ff7aa8f2cb add copyright notices 2018-06-28 20:08:23 +02:00
Michael Stapelberg
8b85084429 dhcp4: persist DHCPACK to renew existing lease after reboot 2018-06-15 17:30:57 +02:00
Michael Stapelberg
d2ecb190ac dhcp4: skip DHCPDISCOVER when renewing 2018-06-15 09:58:51 +02:00
Michael Stapelberg
19aa03bf58 dhcp4: specify previous IP address when renewing 2018-06-13 19:32:20 +02:00
Michael Stapelberg
c28d816805 update for dhcp4client changes 2018-06-02 10:15:50 +02:00
Michael Stapelberg
2079aea3a1 return better error message for -EAGAIN 2018-06-01 22:18:30 +02:00
Michael Stapelberg
c05bd22afe make temporary errors temporary, not permanent 2018-06-01 22:18:15 +02:00
Michael Stapelberg
7f93ea6661 hook up SIGUSR2 to DHCPRELEASE 2018-06-01 22:18:04 +02:00
Michael Stapelberg
6b9ce5728a Initial commit 2018-05-27 17:30:42 +02:00