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