[dhcp] dhclient-script: use dadfailed flag in add_ipv6_addr_with_DAD()

Jiří Popelka jpopelka at fedoraproject.org
Wed Jan 4 17:14:28 UTC 2012


commit 367b4439338bb453f2f6fcab03dde5883f825025
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Wed Jan 4 18:10:42 2012 +0100

    dhclient-script: use dadfailed flag in add_ipv6_addr_with_DAD()

 dhclient-script |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index 99196a9..bba808e 100644
--- a/dhclient-script
+++ b/dhclient-script
@@ -530,22 +530,22 @@ add_ipv6_addr_with_DAD() {
             for i in $(seq 5); do
                 sleep 1 # give the DAD some time
 
-                # tentative flag = DAD is still not complete or failed
-                duplicate=$(ip -6 addr show dev ${interface} tentative \
-                              | grep ${new_ip6_address}/${new_ip6_prefixlen})
-
-                # if there's no tentative flag, address passed DAD
-                if [ -z "${duplicate}" ]; then
-                    break
+                # tentative flag == DAD is still not complete
+                tentative=$(ip -6 addr show dev ${interface} tentative \
+                           | grep ${new_ip6_address}/${new_ip6_prefixlen})
+                # dadfailed flag == address is already in use somewhere else
+                dadfailed=$(ip -6 addr show dev ${interface} dadfailed \
+                           | grep ${new_ip6_address}/${new_ip6_prefixlen})
+
+                if [ -n "${dadfailed}" ] ; then
+                    #ip -6 addr del ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface}
+                    exit_with_hooks 3
+                fi
+                if [ -z "${tentative}" ] ; then
+                    # DAD is over
+                    return 0
                 fi
             done
-
-            # if there's still tentative flag = address didn't pass DAD = 
-            # = it's duplicate = remove it
-            if [ -n "${duplicate}" ]; then
-                ip -6 addr del ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface}
-                exit_with_hooks 3
-            fi
 }
 
 dh6config() {


More information about the scm-commits mailing list