712866
From 30e20744477c18a70c4f487275f2a8e957fca555 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Thu, 27 Feb 2014 12:11:20 +0100
712866
Subject: [PATCH] network: IPv6 status, wait for tentative flag to be cleared
712866
712866
also do not arping the IPv6 address.
712866
---
712866
 modules.d/40network/ifup.sh    |  1 +
712866
 modules.d/40network/net-lib.sh | 16 ++++++++++++++--
712866
 2 files changed, 15 insertions(+), 2 deletions(-)
712866
712866
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
5c6c2a
index 33ec81d1..e4391068 100755
712866
--- a/modules.d/40network/ifup.sh
712866
+++ b/modules.d/40network/ifup.sh
712866
@@ -136,6 +136,7 @@ do_static() {
712866
     if strstr $ip '*:*:*'; then
712866
         # note no ip addr flush for ipv6
712866
         ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
712866
+        wait_for_ipv6_dad $netif
712866
     else
712866
         ip addr flush dev $netif
712866
         ip addr add $ip/$mask ${srv:+peer $srv} brd + dev $netif
712866
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
5c6c2a
index 4e1b0192..a5867118 100755
712866
--- a/modules.d/40network/net-lib.sh
712866
+++ b/modules.d/40network/net-lib.sh
712866
@@ -123,8 +123,8 @@ setup_net() {
712866
         read layer2 < /sys/class/net/$netif/device/layer2
712866
     fi
712866
 
712866
-    if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
712866
-        info "Resolving $dest via ARP on $netif failed"
712866
+    if [ "$layer2" != "0" ] && [ -n "$dest" ] && ! strstr "$dest" ":"; then
712866
+        arping -q -f -w 60 -I $netif $dest || info "Resolving $dest via ARP on $netif failed"
712866
     fi
712866
     unset layer2
712866
 
712866
@@ -451,6 +451,18 @@ wait_for_route_ok() {
712866
     return 1
712866
 }
712866
 
712866
+wait_for_ipv6_dad() {
712866
+    local cnt=0
712866
+    local li
712866
+    while [ $cnt -lt 500 ]; do
712866
+        li=$(ip -6 addr show dev $1)
712866
+        strstr "$li" "tentative" || return 0
712866
+        sleep 0.1
712866
+        cnt=$(($cnt+1))
712866
+    done
712866
+    return 1
712866
+}
712866
+
712866
 wait_for_ipv6_auto() {
712866
     local cnt=0
712866
     local li