Bug 235909 - [PATCH] net/dual-dhclient: does not survive a netif restart
Summary: [PATCH] net/dual-dhclient: does not survive a netif restart
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Colin Percival
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-21 07:29 UTC by Christopher Hall
Modified: 2019-04-15 08:56 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (cperciva)


Attachments
replacement dual-dhclient (265 bytes, application/x-shellscript)
2019-02-21 07:29 UTC, Christopher Hall
no flags Details
patch to fix restart and host.conf corruption (19.30 KB, patch)
2019-04-15 07:04 UTC, Christopher Hall
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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

    pid6=/var/run/dhclient6.pid
    [ -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