fab351
From 8061a432844d1f780d9b18144def0faef0145c0c Mon Sep 17 00:00:00 2001
fab351
From: Lukas Nykryn <lnykryn@redhat.com>
fab351
Date: Mon, 7 Oct 2019 16:48:09 +0200
fab351
Subject: [PATCH] net-lib: check if addr exists before checking for dad state
fab351
fab351
Before we check if dad is done we should first make sure,
fab351
that there is a link local address where we do the check.
fab351
fab351
Due to this issue, on ipv6 only setups sometimes dhclient started
fab351
asking for ip address, before the link local address was present
fab351
and failed immediately.
fab351
fab351
(cherry picked from commit daa49cc2216d6387541ef36e8427081f6b02f224)
fab351
fab351
Resolves: #1765014
fab351
---
fab351
 modules.d/40network/net-lib.sh | 6 ++++--
fab351
 1 file changed, 4 insertions(+), 2 deletions(-)
fab351
fab351
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
fab351
index ad78d225..dcb53804 100755
fab351
--- a/modules.d/40network/net-lib.sh
fab351
+++ b/modules.d/40network/net-lib.sh
fab351
@@ -653,7 +653,8 @@ wait_for_ipv6_dad_link() {
fab351
     timeout=$(($timeout*10))
fab351
 
fab351
     while [ $cnt -lt $timeout ]; do
fab351
-        [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
fab351
+        [ -n "$(ip -6 addr show dev "$1" scope link)" ] \
fab351
+            && [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
fab351
             && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
fab351
             && return 0
fab351
         [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
fab351
@@ -671,7 +672,8 @@ wait_for_ipv6_dad() {
fab351
     timeout=$(($timeout*10))
fab351
 
fab351
     while [ $cnt -lt $timeout ]; do
fab351
-        [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
fab351
+        [ -n "$(ip -6 addr show dev "$1")" ] \
fab351
+            && [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
fab351
             && [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
fab351
             && return 0
fab351
         [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
fab351