]> TLD Linux GIT Repositories - rc-scripts.git/commitdiff
- PLD merge: wait for duplicated IPv6 address detection while interface configuration
authorMarcin Krol <hawk@tld-linux.org>
Tue, 21 May 2024 16:49:48 +0000 (18:49 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Tue, 21 May 2024 16:52:19 +0000 (18:52 +0200)
lib/ifup

index b8536af55959af9953e55f6662a8e0e9fff06881..be231ceb5fe4ac7d778775b956506b4bd4b3a3ef 100755 (executable)
--- 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