I created a patch that applies against isc-dhcp-4.3.5 that contains the two
patches mentioned in this bug.

Is there anything from preventing this from being included now?

diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 9b0d3f8..0d0979a 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -12,6 +12,9 @@
 
 # The alias handling in here probably still sucks. -mdz
 
+# log an error.
+error() { logger -p daemon.err "$@"; }
+
 # wait for given file to be writable
 wait_for_rw() {
     local file=$1
@@ -136,6 +139,41 @@ set_hostname() {
     fi
 }
 
+# set the link up and wait for ipv6 link local dad to finish
+ipv6_link_up_and_dad() {
+    local dev=$1 delay=${2:-0.1} attempts=${3:-60}
+    ip link set up dev "$dev" ||
+        { error "$dev: failed to set link up"; return 1; }
+    local n=0
+    while :; do
+        n=$((n+1))
+        # note: busybox ip does not understand 'tentative' as input
+        # so we cannot just use the tentative flag and check for empty
+        out=$(ip -6 -o address show dev "$dev" scope link) || {
+            error "$dev: checking for link-local addresses failed";
+            return 1
+        }
+       # another note: the output may be empty if the link local tentative addr
+       # isn't up just yet, so we need to make sure there is at least one 'inet6'
+       # match before returning success.  We need to keep checking for both
+       # 'tentative' case and default (no inet6 address) case.
+       # Don't reorder tentative/inet6 - we need to check for tentative first.
+        case " $out " in
+            *\ dadfailed\ *)
+                error "$dev: ipv6 dad failed."
+                return 1;;
+            *\ tentative\ *) :;;
+           *\ inet6\ *) return 0;;
+           *) :;;
+        esac
+        [ $n -lt $attempts ] || {
+            error "$dev: time out waiting for permanent link-local address"
+            return 1;
+        }
+        sleep $delay
+    done
+}
+
 # run given script
 run_hook() {
     local script="$1"
@@ -375,7 +407,7 @@ case "$reason" in
 
     PREINIT6)
         # ensure interface is up
-        ip link set ${interface} up
+        ipv6_link_up_and_dad "$interface"
 
         # flush any stale global permanent IPs from interface
         ip -6 addr flush dev ${interface} scope global permanent

Reply via email to