Bug 235909

Summary: [PATCH] net/dual-dhclient: does not survive a netif restart
Product: Ports & Packages Reporter: Christopher Hall <hsw>
Component: Individual Port(s)Assignee: Colin Percival <cperciva>
Status: New ---    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (cperciva)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Description Flags
replacement dual-dhclient
patch to fix restart and host.conf corruption none

Description Christopher Hall 2019-02-21 07:29:19 UTC
Created attachment 202219 [details]
replacement dual-dhclient

when using net/dual-dhclient and doing a service netif restart the DHPv6 address is lost.  This is because the dhclient6 is not killed during the stop process since the base dhclient is unaware of the /var/run/dhclient6.pid file to terminate the second dhclient.

As a quick workaround replace the installed /usr/local/sbin/dual-dhclient with the attached script.  The script just adds these two lines just befor starting the dhclients

    [ -n "${pid6}" ] && kill $(cat "${pid6}")
Comment 1 Christopher Hall 2019-02-22 07:03:44 UTC
also the /etc/resolv.conf is replaced by single nameserver line with only IPv6 address.  (which breaks DNS if local_unbound is selected and has special local config)
Comment 2 Christopher Hall 2019-04-15 07:04:20 UTC
Created attachment 203684 [details]
patch to fix restart and host.conf corruption

This adds fixes for:
  1. service netif restart i.e. it ensures that the dhclient6 is killed and restarted properly
  2. that /etc/host.conf is updated by both IPv4 and IPv6 client
  3. updates to host.conf occur with a lock to prevent corruption
  4. updates to IPv4 does not remove IPv6 config and vice versa
Comment 3 Christopher Hall 2019-04-15 07:07:57 UTC
The latest patch does not fix the "service netif stop" bug, which is the fact that the rc.d system will only stop the v4 dhclient because the dual-dhclient script is only called on a start.  The rc.d system only appears to stop the v4 dhclient and even adding the pid of the v6 client to the v4 pidfiel is not sufficient.
Comment 4 Christopher Hall 2019-04-15 08:56:10 UTC
for reference updates to net/dhcpcd which would likely make the above patch redundant is blocked by:

bug #194485  see also: review D15404 and review D15405