From 0603354acf21cc77a19b97ae3218ae65cef3d138 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Tue, 21 May 2024 18:49:48 +0200 Subject: [PATCH] - PLD merge: wait for duplicated IPv6 address detection while interface configuration --- lib/ifup | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/ifup b/lib/ifup index b8536af..be231ce 100755 --- a/lib/ifup +++ b/lib/ifup @@ -219,6 +219,19 @@ else # IPv6 in use ? if is_yes "$IPV6_NETWORKING" && [ -n "${IP6ADDR}" ]; then ip addr add ${IP6ADDR} dev ${DEVICE} ${IP6ADDROPT} + timeout=0 + while [ $timeout -le 20 ] && \ + if_state="`ip -o addr list dev ${DEVICE} to ${IP6ADDR}`" && \ + echo "$if_state" | grep -q tentative && \ + ! echo "$if_state" | grep -q dadfailed ; do + usleep 500000 + timeout=$((timeout+1)) + done + if ip -o addr list dev ${DEVICE} to ${IP6ADDR} | grep -q dadfailed ; then + ip addr del ${IP6ADDR} dev ${DEVICE} + nls '%s: Duplicated address detected: %s' "$DEVICE" "$IP6ADDR" + exit 1 + fi if [ -n "${IP6ADDRLABEL}" ]; then ip addrlabel add prefix ${IP6ADDR} dev ${DEVICE} label ${IP6ADDRLABEL} fi -- 2.46.0