network: wait 40 seconds for IPv6 auto configuration

https://bugzilla.redhat.com/show_bug.cgi?id=973719
master
Harald Hoyer 2013-06-12 17:42:35 +02:00
parent 036712546b
commit f8b958dc62
2 changed files with 13 additions and 0 deletions

View File

@ -108,6 +108,7 @@ do_ipv6auto() {
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
linkup $netif
wait_for_ipv6_auto $netif

[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname


View File

@ -360,6 +360,18 @@ wait_for_route_ok() {
return 1
}

wait_for_ipv6_auto() {
local cnt=0
local li
while [ $cnt -lt 400 ]; do
li=$(ip -6 addr show dev $1)
strstr "$li" "dynamic" && return 0
sleep 0.1
cnt=$(($cnt+1))
done
return 1
}

linkup() {
wait_for_if_link $1 2>/dev/null\
&& ip link set $1 up 2>/dev/null\