Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DHCPv4 NAK causes type "host" addresses to be deleted #462

Open
ColinMcInnes opened this issue Feb 13, 2025 · 1 comment · May be fixed by #464
Open

DHCPv4 NAK causes type "host" addresses to be deleted #462

ColinMcInnes opened this issue Feb 13, 2025 · 1 comment · May be fixed by #464

Comments

@ColinMcInnes
Copy link
Contributor

dhcpcd 10.2.0

tl;dr on NAK, with noipv4ll and persistent configured, dynamic address is deleted as expected, but so are non-dynamic addresses on same interface.

  • set noipv4ll and persistent in conf
  • Start dhcpcd in managed mode on eth0
  • Trigger dhcpcd to start requesting addresses from DHCP server
  • Configure eth0 with 2 IPv4 "host" type addresses (different from LL), these route to local host only.
  • Change IP in lease on DHCP server
  • Wait for renewal timer
  • Expect NAK (yep!)
  • dhcpcd deletes host type addresses (no!)
    -- verified via ip -4 address show dev eth0

Ideally if noipv4ll we would skip IPV4LL logic altogether, and if persistent, we would avoid touching "host" and "local" scope addresses (in linux).

~$ ip -4 address show dev eth0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 169.254.0.2/24 scope host eth0:label0
       valid_lft forever preferred_lft forever
    inet 169.254.1.2/24 scope host eth0:label1
       valid_lft forever preferred_lft forever
    inet 192.168.229.119/24 brd 192.168.229.255 scope global dynamic noprefixroute eth0
       valid_lft 574sec preferred_lft 499sec

eth0: leased 192.168.229.119 for 600 seconds
eth0: renew in 300 seconds, rebind in 525 seconds
eth0: writing lease: /var/lib/dhcpcd/eth0.lease
eth0: adding IP address 192.168.229.119/24 broadcast 192.168.229.255
eth0: executing: /usr/libexec/dhcpcd-run-hooks RENEW
eth0: renewing lease of 192.168.229.119
eth0: sending REQUEST (xid 0xe25e7a94), next in 4.7 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 8.4 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 16.0 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 31.0 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 64.8 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 64.5 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 63.1 seconds
eth0: failed to renew DHCP, rebinding
eth0: spawned BPF BOOTP on PID 23837
eth0: expire in 75 seconds
eth0: sending REQUEST (xid 0xe25e7a94), next in 3.3 seconds
eth0: NAK: requested address is incorrect from 192.168.228.21
eth0: message: requested address is incorrect
eth0: deleting IP address 192.168.229.119/24
eth0: deleting route to 192.168.229.0/24
eth0: deleting default route via 192.168.229.2
eth0: executing: /usr/libexec/dhcpcd-run-hooks NAK
eth0: BPF ARP 192.168.229.119 exited from PID 4344
eth0: soliciting a DHCP lease
eth0: spawned BPF BOOTP on PID 23889
eth0: sending DISCOVER (xid 0x42b56209), next in 4.8 seconds
eth0: BPF BOOTP exited from PID 23837
eth0: offered 192.168.229.120 from 192.168.228.21
eth0: sending REQUEST (xid 0x42b56209), next in 4.3 seconds
eth0: process BPF BOOTP already started on pid 23889
eth0: acknowledged 192.168.229.120 from 192.168.228.21
eth0: spawned BPF ARP 192.168.229.120 on PID 23956
eth0: probing address 192.168.229.120/24
eth0: probing for 192.168.229.120
eth0: ARP probing 192.168.229.120 (1 of 3), next in 1.3 seconds
eth0: ARP probing 192.168.229.120 (2 of 3), next in 1.5 seconds
eth0: ARP probing 192.168.229.120 (3 of 3), next in 2.0 seconds
eth0: DAD completed for 192.168.229.120
eth0: leased 192.168.229.120 for 600 seconds
eth0: renew in 300 seconds, rebind in 525 seconds
eth0: writing lease: /var/lib/dhcpcd/eth0.lease
eth0: adding IP address 192.168.229.120/24 broadcast 192.168.229.255
eth0: ARP announcing 192.168.229.120 (1 of 2), next in 2.0 seconds
eth0: adding route to 192.168.229.0/24
eth0: adding default route via 192.168.229.2
eth0: executing: /usr/libexec/dhcpcd-run-hooks BOUND
eth0: deleting IP address 169.254.0.2/24
eth0: deleting IP address 169.254.1.2/24
eth0: executing: /usr/libexec/dhcpcd-run-hooks IPV4LL
eth0: BPF BOOTP exited from PID 23889
eth0: ARP announcing 192.168.229.120 (2 of 2)
eth0: renewing lease of 192.168.229.120
eth0: sending REQUEST (xid 0xc2801c9), next in 3.1 seconds
eth0: acknowledged 192.168.229.120 from 192.168.228.21
eth0: leased 192.168.229.120 for 600 seconds
eth0: renew in 300 seconds, rebind in 525 seconds
eth0: writing lease: /var/lib/dhcpcd/eth0.lease
eth0: adding IP address 192.168.229.120/24 broadcast 192.168.229.255
eth0: executing: /usr/libexec/dhcpcd-run-hooks RENEW

~$ ip -4 address show dev eth0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    inet 192.168.229.120/24 brd 192.168.229.255 scope global dynamic noprefixroute eth0
       valid_lft 333sec preferred_lft 258sec
@ColinMcInnes
Copy link
Contributor Author

ColinMcInnes commented Feb 13, 2025

Reviewing the code, I think the underlying issue could be resolved if I used an actual "localhost" address instead.

dhcpcd is comparing the address to the "link local" range to determine that it's a link local address.

That would be the quick solution. Ideally IN_LINKLOCAL could also verify in linux if the address is "scope local".

I'm still looking into why it's triggering IPv4LL functions when noipv4ll was set. ipv4ll_drop also checks for persistent...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant