[dhcp/f16] dhclient-script: address alias fixes (#741786)

Jiří Popelka jpopelka at fedoraproject.org
Thu Sep 29 12:31:26 UTC 2011


commit cd178b9068fc0cc045b53b6c6d5ef62eceeaddbb
Author: Jiri Popelka <jpopelka at redhat.com>
Date:   Thu Sep 29 14:18:16 2011 +0200

    dhclient-script: address alias fixes (#741786)

 dhclient-script |   23 ++++++++++++-----------
 dhcp.spec       |    5 ++++-
 2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/dhclient-script b/dhclient-script
index 6a093e9..86fc22f 100644
--- a/dhclient-script
+++ b/dhclient-script
@@ -355,7 +355,7 @@ dhconfig() {
     if [ -n "${old_ip_address}" ] && [ -n "${alias_ip_address}" ] &&
        [ ! "${alias_ip_address}" = "${old_ip_address}" ]; then
         # possible new alias, remove old alias first
-        ip -4 addr del ${old_ip_address} dev ${interface}:0
+        ip -4 addr del ${old_ip_address} dev ${interface} label ${interface}:0
     fi
 
     if [ -n "${old_ip_address}" ] &&
@@ -501,9 +501,10 @@ dhconfig() {
 
     if [ ! "${new_ip_address}" = "${alias_ip_address}" ] &&
        [ -n "${alias_ip_address}" ]; then
-        ip -4 addr flush dev ${interface}:0 >/dev/null 2>&1
-        ip -4 addr add ${alias_ip_address}/${alias_prefix} dev ${interface}:0
-        ip -4 route replace ${alias_ip_address}/32 dev ${interface}:0
+        # Reset the alias address (fix: this should really only do this on changes)
+        ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
+        ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0
+        ip -4 route replace ${alias_ip_address}/32 dev ${interface}
     fi
 
     make_resolv_conf
@@ -671,8 +672,8 @@ case "${reason}" in
 
     PREINIT)
         if [ -n "${alias_ip_address}" ]; then
-            # Bring down alias interface, its routes will disappear too.
-            ip link set ${interface}:0 down
+            # Flush alias, its routes will disappear too.
+            ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
         fi
 
         if [ "${keep_old_ip}" = "yes" ]; then
@@ -769,8 +770,8 @@ case "${reason}" in
         fi
 
         if [ -n "${alias_ip_address}" ]; then
-            # Turn off alias interface
-            ip link set ${interface}:0 down
+            # Flush alias
+            ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
         fi
 
         if [ -n "${old_ip_address}" ]; then
@@ -779,8 +780,8 @@ case "${reason}" in
         fi
 
         if [ -n "${alias_ip_address}" ]; then
-            ip -4 addr add ${alias_ip_address}/${alias_prefix} dev ${interface}:0
-            ip -4 route replace ${alias_ip_address}/32 ${interface}:0
+            ip -4 addr add ${alias_ip_address}/${alias_prefix} broadcast ${alias_broadcast_address} dev ${interface} label ${interface}:0
+            ip -4 route replace ${alias_ip_address}/32 dev ${interface}
         fi
 
         exit_with_hooks 0
@@ -789,7 +790,7 @@ case "${reason}" in
     TIMEOUT)
         if [ -n "${new_routers}" ]; then
             if [ -n "${alias_ip_address}" ]; then
-                ip -4 addr flush dev ${interface}:0 >/dev/null 2>&1
+                ip -4 addr flush dev ${interface} label ${interface}:0 >/dev/null 2>&1
             fi
 
             ip -4 addr add ${new_ip_address}/${new_prefix} broadcast ${new_broadcast_address} dev ${interface}
diff --git a/dhcp.spec b/dhcp.spec
index f2c86c8..6e32ab8 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -19,7 +19,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.2
-Release:  7%{?dist}
+Release:  8%{?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.
@@ -633,6 +633,9 @@ fi
 %{_initddir}/dhcrelay
 
 %changelog
+* Thu Sep 29 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.2-8
+- dhclient-script: address alias handling fixes from Scott Shambarger (#741786)
+
 * Fri Sep 09 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.2-7
 - Move changing of the effective user/group ID after writing new PID file.
 


More information about the scm-commits mailing list