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