Blob Blame History Raw
From 6b827761075266ebaf1ef10cc0a640445f02dbe1 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 7 Oct 2019 16:48:09 +0200
Subject: [PATCH] net-lib: check if addr exists before checking for dad state

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 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 35e6e833..3f2fc712 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -645,6 +645,7 @@ wait_for_ipv6_dad_link() {
     timeout=$(($timeout*10))
 
     while [ $cnt -lt $timeout ]; do
+        [ -n "$(ip -6 addr show dev "$1" scope link)" ] \
         [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
             && return 0
         [ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
@@ -662,6 +663,7 @@ wait_for_ipv6_dad() {
     timeout=$(($timeout*10))
 
     while [ $cnt -lt $timeout ]; do
+        [ -n "$(ip -6 addr show dev "$1")" ] \
         [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
             && return 0
         [ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \