[projects/rc-scripts] - wait for duplicated IPv6 address detection while interface configuration

adwol adwol at pld-linux.org
Fri Jan 28 01:23:28 CET 2022


commit 31b68aac1cc37a4135056a16967535519bc7eff0
Author: Adam Osuchowski <adwol at pld-linux.org>
Date:   Fri Jan 28 01:20:30 2022 +0100

    - 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 38780bf4..71652f7a 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
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/31b68aac1cc37a4135056a16967535519bc7eff0



More information about the pld-cvs-commit mailing list