[dhcp: 10/11] dhclient-script: another improvement of add_ipv6_addr_with_DAD()

Jiří Popelka jpopelka at fedoraproject.org
Tue Aug 26 10:57:38 UTC 2014


commit 4992026c16d12766bfba556836e3b061a1f5d70e
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Tue Aug 26 12:08:50 2014 +0200

    dhclient-script: another improvement of add_ipv6_addr_with_DAD()

 dhclient-script |   15 ++++++++-------
 dhcp.spec       |    5 ++++-
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index e5a6830..fbf1032 100644
--- a/dhclient-script
+++ b/dhclient-script
@@ -563,20 +563,20 @@ add_ipv6_addr_with_DAD() {
             for i in $(seq 5); do
                 sleep 1 # give the DAD some time
 
+                addr=$(ip -6 addr show dev ${interface} \
+                       | grep ${new_ip6_address}/${new_ip6_prefixlen})
+
                 # tentative flag == DAD is still not complete
-                tentative=$(ip -6 addr show dev ${interface} tentative \
-                           | grep ${new_ip6_address}/${new_ip6_prefixlen})
+                tentative=$(echo "${addr}" | grep tentative)
                 # dadfailed flag == address is already in use somewhere else
-                dadfailed=$(ip -6 addr show dev ${interface} dadfailed \
-                           | grep ${new_ip6_address}/${new_ip6_prefixlen})
+                dadfailed=$(echo "${addr}" | grep dadfailed)
 
                 if [ -n "${dadfailed}" ] ; then
-                    #ip -6 addr del ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface}
+                    # address was added with valid_lft/preferred_lft 'forever', remove it
+                    ip -6 addr del ${new_ip6_address}/${new_ip6_prefixlen} dev ${interface}
                     exit_with_hooks 3
                 fi
                 if [ -z "${tentative}" ] ; then
-                    addr=$(ip -6 addr show dev ${interface} \
-                          | grep ${new_ip6_address}/${new_ip6_prefixlen})
                     if [ -n "${addr}" ]; then
                         # DAD is over
                         return 0
@@ -586,6 +586,7 @@ add_ipv6_addr_with_DAD() {
                     fi
                 fi
             done
+            return 0
 }
 
 dh6config() {
diff --git a/dhcp.spec b/dhcp.spec
index f6be761..9b42fcb 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -18,7 +18,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.3.1
-Release:  5%{?dist}
+Release:  6%{?dist}
 # NEVER CHANGE THE EPOCH on this package.  The previous maintainer (prior to
 # dcantrell maintaining the package) made incorrect use of the epoch and
 # that's why it is at 12 now.  It should have never been used, but it was.
@@ -588,6 +588,9 @@ done
 %doc doc/html/
 
 %changelog
+* Tue Aug 26 2014 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.1-6
+- dhclient-script: another improvement of add_ipv6_addr_with_DAD()
+
 * Mon Aug 25 2014 Jiri Popelka <jpopelka at redhat.com> - 12:4.3.1-5
 - spec: use -D with 'install'
 - dhclient-script: IPv6 address which fails DAD is auto-removed when it was


More information about the scm-commits mailing list