dhcpcd-discuss

Re: Addresses not deleted when cable pulled

Roy Marples

Sat Mar 03 09:40:05 2018

On 03/03/18 09:30, Roy Marples wrote:
On 03/03/2018 02:26, jobhunts02@xxxxxxx wrote:
When I pull the cable to the interface on which I got an IPv4 address via DHCP, I would like the address to be deleted.  The reason it is not deleted is that state is NULL in ipv4ll_freedrop, which prevents ipv4_deladdr from being called.  If an interface has obtained an IPv4 & IPv6 address via DHCP, neither address is deleted when the cable is pulled.  If the interface only has an IPv6 address via DHCP, the address does get deleted when the cable is pulled.

Is there a way to ensure that addresses obtained via DHCP will be deleted when the cable is pulled?

Which OS are you using (please specify kernel version)?
Which dhcpcd version are you using?

I ask, because on NetBSD-8 and newer, the behaviour is to keep the addresses alive on carrier down as the kernel will deny their usage until they are revalidated by the kernel DaD's mechanism.

Now, this could also be a bug in dhcpcd where this is not respected for other kernels and the behaviour should be as you describe - all addresses dhcpcd is responsible for should be removed at carrier down.

$ uname -a
Linux uberpc.marples.name 4.14.0-3-amd64 #1 SMP Debian 4.14.17-1 (2018-02-14) x86_64 GNU/Linux

Although it's reported as Debian, the OS is SparkyLinux

$ sudo ./dhcpcd -dB --nodhcp
dhcpcd-7.0.1 starting
eth0: executing `/libexec/dhcpcd-run-hooks' PREINIT
eth0: executing `/libexec/dhcpcd-run-hooks' NOCARRIER
wlan0: executing `/libexec/dhcpcd-run-hooks' PREINIT
wlan0: executing `/libexec/dhcpcd-run-hooks' CARRIER
DUID 00:01:00:01:21:66:22:a8:7c:5c:f8:59:7b:b2
wlan0: IAID f8:59:7b:b2
wlan0: adding address fe80::9497:7b15:fa4b:c108
wlan0: pltime infinity, vltime infinity
wlan0: delaying IPv6 router solicitation for 0.8 seconds
wlan0: delaying IPv4 for 0.5 seconds
eth0: waiting for carrier
wlan0: using IPv4LL address 169.254.189.240
wlan0: adding route to 169.254.0.0/16
wlan0: adding default route
wlan0: ARP announcing 169.254.189.240 (1 of 2), next in 2.0 seconds
wlan0: executing `/libexec/dhcpcd-run-hooks' IPV4LL
wlan0: soliciting an IPv6 router
wlan0: delaying Router Solicitation for LL address
wlan0: sending Router Solicitation
wlan0: Router Advertisement from fe80::1
wlan0: adding address fd73:7808:1015:0:a371:3c19:c535:9c8b/64
wlan0: pltime 120 seconds, vltime 180 seconds
wlan0: adding route to fd73:7808:1015::/64
wlan0: adding default route via fe80::1
wlan0: waiting for Router Advertisement DAD to complete
wlan0: reading lease `/var/db/dhcpcd/wlan0-UberNET.lease6'
wlan0: soliciting a DHCPv6 lease
wlan0: delaying SOLICIT6 (xid 0xce3e6f), next in 0.6 seconds
wlan0: ARP announcing 169.254.189.240 (2 of 2)
wlan0: broadcasting SOLICIT6 (xid 0xce3e6f), next in 0.9 seconds
wlan0: ADV fd73:7808:1015::1a3/128 from fe80::1
wlan0: broadcasting REQUEST6 (xid 0x4636d1), next in 1.1 seconds
wlan0: REPLY6 received from fe80::1
wlan0: adding address fd73:7808:1015::1a3/128
wlan0: pltime 75 seconds, vltime 120 seconds
wlan0: renew in 37, rebind in 60, expire in 120 seconds
wlan0: writing lease `/var/db/dhcpcd/wlan0-UberNET.lease6'
wlan0: waiting for DHCPv6 DAD to complete
wlan0: Router Advertisement DAD completed
wlan0: executing `/libexec/dhcpcd-run-hooks' ROUTERADVERT
wlan0: DHCPv6 DAD completed
wlan0: executing `/libexec/dhcpcd-run-hooks' BOUND6
wlan0: fe80::1 is unreachable, expiring it
wlan0: executing `/libexec/dhcpcd-run-hooks' ROUTERADVERT
wlan0: Router Advertisement from fe80::1
wlan0: adding address fd73:7808:1015:0:a371:3c19:c535:9c8b/64
wlan0: pltime 120 seconds, vltime 180 seconds
wlan0: executing `/libexec/dhcpcd-run-hooks' ROUTERADVERT
wlan0: carrier lost
wlan0: executing `/libexec/dhcpcd-run-hooks' NOCARRIER
wlan0: deleting address fd73:7808:1015::1a3/128
wlan0: executing `/libexec/dhcpcd-run-hooks' EXPIRE6
wlan0: deleting address fd73:7808:1015:0:a371:3c19:c535:9c8b/64
wlan0: deleting route to fd73:7808:1015::/64
wlan0: deleting default route via fe80::1
wlan0: executing `/libexec/dhcpcd-run-hooks' ROUTERADVERT
wlan0: deleting address fe80::9497:7b15:fa4b:c108
wlan0: deleting IP address 169.254.189.240/16
wlan0: deleting route to 169.254.0.0/16
wlan0: deleting default route
wlan0: executing `/libexec/dhcpcd-run-hooks' IPV4LL
wlan0: executing `/libexec/dhcpcd-run-hooks' EXPIRE

So I issued pkill wpa_supplicant to trigger the carrier down and as you can see, every address dhcpcd was responsible for has been removed at carrier down.

I need you to supply the same sort of log - add debug to dhcpcd.conf, to show that dhcpcd assigned an address but did not remove it at carrier down.

Thanks

Roy

Follow-Ups:
Re: Addresses not deleted when cable pulledjobhunts02
References:
Addresses not deleted when cable pulledjobhunts02
Re: Addresses not deleted when cable pulledRoy Marples
Archive administrator: postmaster@marples.name