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

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


commit 3817eb25c1353f87e9bf5479bc7db45136147ac1
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 4f9dff9..faf2a70 100644
--- a/dhclient-script
+++ b/dhclient-script
@@ -345,7 +345,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}" ] &&
@@ -491,9 +491,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
@@ -661,8 +662,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
@@ -759,8 +760,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
@@ -769,8 +770,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
@@ -779,7 +780,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 21b9d55..e4c4e19 100644
--- a/dhcp.spec
+++ b/dhcp.spec
@@ -16,7 +16,7 @@
 Summary:  Dynamic host configuration protocol software
 Name:     dhcp
 Version:  4.2.1
-Release:  11.%{patchver}%{?dist}
+Release:  12.%{patchver}%{?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.
@@ -655,6 +655,9 @@ fi
 %{_initddir}/dhcrelay
 
 %changelog
+* Thu Sep 29 2011 Jiri Popelka <jpopelka at redhat.com> - 12:4.2.1-12.P1
+- dhclient-script: address alias handling fixes from Scott Shambarger (#741786)
+
 * Fri Sep 09 2011 Adam Tkac <atkac redhat com> - 12:4.2.1-11.P1
 - rebuild against new bind
 


More information about the scm-commits mailing list