]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
net-lib: check if addr exists before checking for dad state
authorLukas Nykryn <lnykryn@redhat.com>
Mon, 7 Oct 2019 14:48:09 +0000 (16:48 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Wed, 23 Oct 2019 08:44:26 +0000 (10:44 +0200)
Before we check if dad is done we should first make sure,
that there is a link local address where we do the check.

Due to this issue, on ipv6 only setups sometimes dhclient started
asking for ip address, before the link local address was present
and failed immediately.

modules.d/40network/net-lib.sh

index cf1e72974b744b33179b7ef7ee1a88fde2db1b9b..59457bbcbb3f83190432cda6bebcf7641675723f 100755 (executable)
@@ -653,7 +653,8 @@ wait_for_ipv6_dad_link() {
     timeout=$(($timeout*10))
 
     while [ $cnt -lt $timeout ]; do
-        [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
+        [ -n "$(ip -6 addr show dev "$1" scope link)" ] \
+            && [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
             && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
             && return 0
         [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
@@ -671,7 +672,8 @@ wait_for_ipv6_dad() {
     timeout=$(($timeout*10))
 
     while [ $cnt -lt $timeout ]; do
-        [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
+        [ -n "$(ip -6 addr show dev "$1")" ] \
+            && [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
             && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
             && return 0
         [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \