From c1880449e4a518ca649120e5589e409d26a82550 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Mon, 13 Jun 2016 16:35:23 +0200 Subject: ipv6: wait for all global IPv6 addresses to leave the "tentative" state --- sysconfig/network-scripts/ifup-ipv6 | 2 ++ sysconfig/network-scripts/network-functions-ipv6 | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6 index b31ad11b..8f740344 100755 --- a/sysconfig/network-scripts/ifup-ipv6 +++ b/sysconfig/network-scripts/ifup-ipv6 @@ -305,3 +305,5 @@ if [ "$IPV6TO4INIT" = "yes" ]; then fi fi +#wait for all global IPv6 addresses to leave the "tentative" state +ipv6_wait_tentative $DEVICE diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6 index 394367bb..079a055f 100644 --- a/sysconfig/network-scripts/network-functions-ipv6 +++ b/sysconfig/network-scripts/network-functions-ipv6 @@ -1042,3 +1042,24 @@ ipv6_trigger_radvd() { return 0 } + +#https://www.vaspects.com/2013/12/11/services-dont-bind-to-ipv6-address/ +ipv6_wait_tentative() { + local fn="ipv6_wait_tentative" + local device=$1 + local countdown=30 + + if [ -z "$device" ]; then + net_log $"Missing parameter 'device' (arg 1)" err $fn + return 1 + fi + + [ "$device" = lo ] && return 0 + + while [ ${countdown} -gt 0 -a -n "$(ip -6 addr show dev ${device} scope global tentative)" ]; do + net_log $"Waiting for interface ${device} IPv6 address(es) to leave the \"tentative\" state" info $fn + countdown=$(($countdown - 1)) + sleep 1 + done + return 0 +} -- cgit v1.2.1