From: Marcin Krol Date: Tue, 21 May 2024 16:49:48 +0000 (+0200) Subject: - PLD merge: wait for duplicated IPv6 address detection while interface configuration X-Git-Tag: 0.5.4~14 X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=0603354acf21cc77a19b97ae3218ae65cef3d138;p=rc-scripts.git - PLD merge: wait for duplicated IPv6 address detection while interface configuration --- 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