diff options
author | David Kaspar [Dee'Kej] <dkaspar@redhat.com> | 2016-11-01 10:38:43 +0100 |
---|---|---|
committer | Lukáš Nykrýn <lnykryn@redhat.com> | 2016-11-01 16:15:18 +0100 |
commit | eb1a9ae171f8be0137c146b9dfb3906f90d5a8be (patch) | |
tree | 7b19060ceef8615f5987a06477f7fbd002d12397 | |
parent | 15eaf7ece1a72fd634550f7278575051f2a25079 (diff) | |
download | initscripts-eb1a9ae171f8be0137c146b9dfb3906f90d5a8be.tar initscripts-eb1a9ae171f8be0137c146b9dfb3906f90d5a8be.tar.gz initscripts-eb1a9ae171f8be0137c146b9dfb3906f90d5a8be.tar.bz2 initscripts-eb1a9ae171f8be0137c146b9dfb3906f90d5a8be.tar.xz initscripts-eb1a9ae171f8be0137c146b9dfb3906f90d5a8be.zip |
ipv6_wait_tentative(): exit immediately when dadfailed occurs
-rw-r--r-- | sysconfig/network-scripts/network-functions-ipv6 | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/network-functions-ipv6 b/sysconfig/network-scripts/network-functions-ipv6 index 2017e273..4fe75e7a 100644 --- a/sysconfig/network-scripts/network-functions-ipv6 +++ b/sysconfig/network-scripts/network-functions-ipv6 @@ -1048,6 +1048,7 @@ ipv6_wait_tentative() { local fn="ipv6_wait_tentative" local device=$1 local countdown=30 + local ip_output="" if [ -z "$device" ]; then net_log $"Missing parameter 'device' (arg 1)" err $fn @@ -1056,10 +1057,28 @@ ipv6_wait_tentative() { [ "$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)) + while [ ${countdown} -gt 0 ]; do + ip_output="$(ip -6 addr show dev ${device} scope global tentative)" + + if [ -z "$ip_output" ]; then + return 0; + elif echo "$ip_output" | grep "dadfailed" > /dev/null; then + net_log $"Duplicate Address Detection: Duplicate addresses detected" err $fn + net_log $"Duplicate Address Detection: Please, fix your network configuration" err $fn + return 1 + fi + + net_log $"Waiting for interface ${device} IPv6 address(es) to leave the 'tentative' state" info $fn sleep 1 + countdown=$(($countdown - 1)) done + + ip_output="$(ip -6 addr show dev ${device} scope global tentative)" + + if [ -n "$ip_output" ]; then + net_log $"Some IPv6 address(es) of ${device} remain still in 'tentative' state" warning $fn + net_log $"Run 'ip -6 addr show dev ${device} scope global tentative' to see more" warning $fn + fi + return 0 } |