diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-23 21:19:33 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-23 21:21:13 +0200 |
commit | 3610ec6099e1995cccde67ff87df146ae204a8e6 (patch) | |
tree | 75be2987475c083d84075bf2144ad550bbb18be2 | |
parent | eed2ba5379067ba3ef3a7b9eef72b8252958e766 (diff) | |
download | vyos-1x-3610ec6099e1995cccde67ff87df146ae204a8e6.tar.gz vyos-1x-3610ec6099e1995cccde67ff87df146ae204a8e6.zip |
Python/ifconfig: T1680: fix dhclient shutdown
Tell DHCP server we release the IP address and also remove it from the interface
by properly calling dhclient shutdown.
Syslog:
Sep 23 21:20:34 vyos dhclient: Killed old client process
Sep 23 21:20:35 vyos dhclient: DHCPRELEASE on eth2 to 172.16.35.254 port 67
-rw-r--r-- | python/vyos/ifconfig.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index e8ff59891..8d4923957 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -610,9 +610,19 @@ class Interface: self._debug_msg('No DHCP client PID found') return None - # stop dhclient - cmd = 'start-stop-daemon --stop --quiet --pidfile {}'.format( - self._dhcp_pid_file) + # stop dhclient, we need to call dhclient and tell it should release the + # aquired IP address. tcpdump tells me: + # 172.16.35.103.68 > 172.16.35.254.67: [bad udp cksum 0xa0cb -> 0xb943!] BOOTP/DHCP, Request from 00:50:56:9d:11:df, length 300, xid 0x620e6946, Flags [none] (0x0000) + # Client-IP 172.16.35.103 + # Client-Ethernet-Address 00:50:56:9d:11:df + # Vendor-rfc1048 Extensions + # Magic Cookie 0x63825363 + # DHCP-Message Option 53, length 1: Release + # Server-ID Option 54, length 4: 172.16.35.254 + # Hostname Option 12, length 10: "vyos" + # + cmd = '/sbin/dhclient -cf {} -pf {} -lf {} -r {}'.format( + self._dhcp_cfg_file, self._dhcp_pid_file, self._dhcp_lease_file, self._ifname) self._cmd(cmd) # cleanup old config file |