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