Blame SOURCES/0419-network-differ-between-ipv6-local-and-global-tentati.patch

712866
From 42dd8928a81ba5ec244a5634813285ab6f342480 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Thu, 30 Jun 2016 11:10:35 +0200
712866
Subject: [PATCH] network: differ between ipv6 local and global tentative
712866
712866
For dhcpv6, only a non-tentative scope local address is needed.
712866
---
712866
 modules.d/40network/dhclient-script.sh |  2 +-
712866
 modules.d/40network/net-lib.sh         | 24 +++++++++++++++++++++---
712866
 2 files changed, 22 insertions(+), 4 deletions(-)
712866
712866
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
712866
index 9553858..f6c77f2 100755
712866
--- a/modules.d/40network/dhclient-script.sh
712866
+++ b/modules.d/40network/dhclient-script.sh
712866
@@ -149,7 +149,7 @@ case $reason in
712866
     PREINIT6)
712866
         echo "dhcp: PREINIT6 $netif up"
712866
         linkup $netif
712866
-        wait_for_ipv6_dad $netif
712866
+        wait_for_ipv6_dad_link $netif
712866
         ;;
712866
 
712866
     BOUND)
712866
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
712866
index b248133..986c673 100755
712866
--- a/modules.d/40network/net-lib.sh
712866
+++ b/modules.d/40network/net-lib.sh
712866
@@ -636,16 +636,34 @@ wait_for_route_ok() {
712866
     return 1
712866
 }
712866
 
712866
+wait_for_ipv6_dad_link() {
712866
+    local cnt=0
712866
+    local timeout="$(getargs rd.net.timeout.ipv6dad=)"
712866
+    timeout=${timeout:-50}
712866
+    timeout=$(($timeout*10))
712866
+
712866
+    while [ $cnt -lt $timeout ]; do
712866
+        [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
712866
+            && return 0
712866
+        [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
712866
+            && return 1
712866
+        sleep 0.1
712866
+        cnt=$(($cnt+1))
712866
+    done
712866
+    return 1
712866
+}
712866
+
712866
 wait_for_ipv6_dad() {
712866
     local cnt=0
712866
-    local li
712866
     local timeout="$(getargs rd.net.timeout.ipv6dad=)"
712866
     timeout=${timeout:-50}
712866
     timeout=$(($timeout*10))
712866
 
712866
     while [ $cnt -lt $timeout ]; do
712866
-        li=$(ip -6 addr show dev $1 scope link)
712866
-        strstr "$li" "tentative" || return 0
712866
+        [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
712866
+            && return 0
712866
+        [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
712866
+            && return 1
712866
         sleep 0.1
712866
         cnt=$(($cnt+1))
712866
     done