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