[pkg-dhcp-commits] [SCM] ISC DHCP packaging for Debian branch, master, updated. debian/4.1.1-P1-16.1-42-gf9819e4

Andrew Pollock apollock at debian.org
Sun Aug 28 20:21:40 UTC 2011


The following commit has been merged in the master branch:
commit f9819e4f161364dacdf8d1f983eec162ad22498c
Author: Andrew Pollock <apollock at debian.org>
Date:   Sun Aug 28 13:21:09 2011 -0700

    dhclient-script.*: use alternate value expansion
    
    Patch from Peter Marschall
    
    Use parameter "alternate value" expansion (i.e. ${value:+alternate})
    to calculate command line parameters when they are used, instead of
    pre-defining variables.

diff --git a/debian/changelog b/debian/changelog
index 35ac4b9..1fec76e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,8 +43,10 @@ isc-dhcp (4.2.2-1) unstable; urgency=low
     hooks
   * debian/rfc3442-classless-routes.{linux,kfreebsd}: applied patch from Peter
     Marschall to take care of link-local routes (closes: #521024)
+  * debian/dhclient-script.*: apply patch from Peter Marschall to use alternate
+    value expansion
 
- -- Andrew Pollock <apollock at debian.org>  Sun, 28 Aug 2011 13:07:27 -0700
+ -- Andrew Pollock <apollock at debian.org>  Sun, 28 Aug 2011 13:20:22 -0700
 
 isc-dhcp (4.1.1-P1-18) unstable; urgency=low
 
diff --git a/debian/dhclient-script.kfreebsd b/debian/dhclient-script.kfreebsd
index b58d2bd..49d18af 100644
--- a/debian/dhclient-script.kfreebsd
+++ b/debian/dhclient-script.kfreebsd
@@ -109,24 +109,9 @@ exit_with_hooks() {
 
 
 # set up some variables for DHCPv4 handlers below
-if [ -n "$new_broadcast_address" ]; then
-    new_broadcast_arg="broadcast $new_broadcast_address"
-fi
-if [ -n "$old_broadcast_address" ]; then
-    old_broadcast_arg="broadcast $old_broadcast_address"
-fi
-if [ -n "$new_subnet_mask" ]; then
-    new_subnet_arg="netmask $new_subnet_mask"
-fi
-if [ -n "$alias_subnet_mask" ]; then
-    alias_subnet_arg="netmask $alias_subnet_mask"
-fi
 if [ -n "$new_interface_mtu" ] && [ $new_interface_mtu -ge 575 ]; then
     mtu_arg="mtu $new_interface_mtu"
 fi
-if [ -n "$IF_METRIC" ]; then
-    metric_arg="metric $IF_METRIC"	# interfaces(5), "metric" option
-fi
 
 
 # The action starts here
@@ -183,9 +168,9 @@ case "$reason" in
         if [ -z "$old_ip_address" ] ||
            [ "$old_ip_address" != "$new_ip_address" ] ||
            [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
-            ifconfig $interface inet $new_ip_address $new_subnet_arg \
-                $new_broadcast_arg $medium $mtu_arg
-            route add $new_ip_address 127.1 $metric_arg >/dev/null 2>&1
+            ifconfig $interface inet $new_ip_address ${new_subnet_mask:+netmask $new_subnet_mask} \
+                ${new_broadcast_address:+broadcast $new_broadcast_address} $medium $mtu_arg
+            route add $new_ip_address 127.1 ${IF_METRIC:+metric $IF_METRIC} >/dev/null 2>&1
 
             for router in $new_routers; do
                 route add default $router >/dev/null 2>&1
@@ -202,7 +187,8 @@ case "$reason" in
 
         if [ -n "$alias_ip_address" ] &&
            [ "$new_ip_address" != "$alias_ip_address" ]; then
-            ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+            ifconfig $interface inet alias $alias_ip_address \
+                ${alias_subnet_mask:+netmask $alias_subnet_mask}
             route add $alias_ip_address 127.0.0.1
         fi
 
@@ -225,7 +211,8 @@ case "$reason" in
         fi
 
         if [ -n "$alias_ip_address" ]; then
-            ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+            ifconfig $interface inet alias $alias_ip_address \
+                ${alias_subnet_mask:+netmask $alias_subnet_mask}
             route add $alias_ip_address 127.0.0.1
         fi
 
@@ -237,8 +224,8 @@ case "$reason" in
             route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
         fi
 
-        ifconfig $interface inet $new_ip_address $new_subnet_arg \
-            $new_broadcast_arg $medium $mtu_arg
+        ifconfig $interface inet $new_ip_address ${new_subnet_mask:+netmask $new_subnet_mask} \
+            ${new_broadcast_address:+broadcast $new_broadcast_address} $medium $mtu_arg
 
         set -- $new_routers
         first_router="$1"
@@ -246,13 +233,14 @@ case "$reason" in
         if [ -z "$first_router" ] || ping -q -c 1 $first_router; then
             if [ -n "$alias_ip_address" ] &&
                [ "$new_ip_address" != "$alias_ip_address" ]; then
-                ifconfig $interface inet alias $alias_ip_address $alias_subnet_arg
+                ifconfig $interface inet alias $alias_ip_address \
+                    ${alias_subnet_mask:+netmask $alias_subnet_mask}
                 route add $alias_ip_address 127.0.0.1
             fi
             route add $new_ip_address 127.1 >/dev/null 2>&1
 
             for router in $new_routers; do
-                route add default $router $metric_arg
+                route add default $router ${IF_METRIC:+metric $IF_METRIC}
             done
             set -- $new_static_routes
             while [ $# -gt 1 ]; do
diff --git a/debian/dhclient-script.kfreebsd.udeb b/debian/dhclient-script.kfreebsd.udeb
index 8918da0..0638cd8 100644
--- a/debian/dhclient-script.kfreebsd.udeb
+++ b/debian/dhclient-script.kfreebsd.udeb
@@ -47,16 +47,6 @@ set_hostname() {
 if [ -n "$new_subnet_mask" ]; then
     new_mask="/$(ptom $new_subnet_mask)"
 fi
-if [ -n "$old_subnet_mask" ]; then
-    old_mask="/$(ptom $old_subnet_mask)"
-fi
-
-if [ -n "$new_broadcast_address" ]; then
-    new_broadcast_arg="broadcast $new_broadcast_address"
-fi
-if [ -n "$old_broadcast_address" ]; then
-    old_broadcast_arg="broadcast $old_broadcast_address"
-fi
 
 # Execute the operation
 case "$reason" in
@@ -93,7 +83,7 @@ case "$reason" in
            [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
 
             ifconfig $interface inet $new_ip_address $new_subnet_arg \
-                $new_broadcast_arg $medium $mtu_arg
+                ${new_broadcast_address:+broadcast $new_broadcast_address} $medium $mtu_arg
             route add $new_ip_address 127.1 $metric_arg >/dev/null 2>&1 || true
             for router in $new_routers; do
                 route add default $router >/dev/null 2>&1
diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index efc5f7d..4e6ec9d 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -153,19 +153,6 @@ exit_with_hooks() {
 }
 
 
-# set up some variables for DHCPv4 handlers below
-if [ -n "$new_broadcast_address" ]; then
-    new_broadcast_arg="broadcast $new_broadcast_address"
-fi
-if [ -n "$old_broadcast_address" ]; then
-    old_broadcast_arg="broadcast $old_broadcast_address"
-fi
-if [ -n "$new_subnet_mask" ]; then
-    new_mask="/$new_subnet_mask"
-fi
-if [ -n "$alias_subnet_mask" ]; then
-    alias_mask="/$alias_subnet_mask"
-fi
 # The 576 MTU is only used for X.25 and dialup connections
 # where the admin wants low latency.  Such a low MTU can cause
 # problems with UDP traffic, among other things.  As such,
@@ -224,7 +211,8 @@ case "$reason" in
            [ "$old_ip_address" != "$new_ip_address" ] ||
            [ "$reason" = "BOUND" ] || [ "$reason" = "REBOOT" ]; then
             # new IP has been leased or leased IP changed => set it
-            ip -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
+            ip -4 addr add ${new_ip_address}${new_subnet_mask:+/$new_subnet_mask} \
+                ${new_broadcast_address:+broadcast $new_broadcast_address} \
                 dev ${interface} label ${interface}
 
             if [ -n "$new_interface_mtu" ]; then
@@ -259,7 +247,7 @@ case "$reason" in
             # separate alias IP given, which may have changed
             # => flush it, set it & add host route to it
             ip -4 addr flush dev ${interface} label ${interface}:0
-            ip -4 addr add ${alias_ip_address}${alias_mask} \
+            ip -4 addr add ${alias_ip_address}${alias_subnet_mask:+/$alias_subnet_mask} \
                 dev ${interface} label ${interface}:0
             ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
         fi
@@ -296,7 +284,8 @@ case "$reason" in
         fi
 
         # set IP from recorded lease
-        ip -4 addr add ${new_ip_address}${new_mask} ${new_broadcast_arg} \
+        ip -4 addr add ${new_ip_address}${new_subnet_mask:+/$new_subnet_mask} \
+            ${new_broadcast_address:+broadcast $new_broadcast_address} \
             dev ${interface} label ${interface}
 
         if [ -n "$new_interface_mtu" ]; then
@@ -309,7 +298,7 @@ case "$reason" in
             if [ -n "$alias_ip_address" ] &&
                [ "$new_ip_address" != "$alias_ip_address" ]; then
                 # separate alias IP given => set up the alias IP & add host route to it
-                ip -4 addr add ${alias_ip_address}${alias_mask} \
+                ip -4 addr add ${alias_ip_address}${alias_subnet_mask:+/$alias_subnet_mask} \
                     dev ${interface} label ${interface}:0
                 ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
             fi
diff --git a/debian/dhclient-script.linux.udeb b/debian/dhclient-script.linux.udeb
index a50c70c..58d011d 100644
--- a/debian/dhclient-script.linux.udeb
+++ b/debian/dhclient-script.linux.udeb
@@ -51,13 +51,6 @@ if [ -n "$old_subnet_mask" ]; then
     old_mask="/$(ptom $old_subnet_mask)"
 fi
 
-if [ -n "$new_broadcast_address" ]; then
-    new_broadcast_arg="broadcast $new_broadcast_address"
-fi
-if [ -n "$old_broadcast_address" ]; then
-    old_broadcast_arg="broadcast $old_broadcast_address"
-fi
-
 # Execute the operation
 case "$reason" in
     MEDIUM|ARPCHECK|ARPSEND)
@@ -78,7 +71,8 @@ case "$reason" in
            [ "$old_ip_address" != "$new_ip_address" ]; then
             # IP address changed. Bringing down the interface will delete all routes,
             # and clear the ARP cache.
-            ip addr del $old_ip_address$old_mask $old_broadcast_arg dev $interface
+            ip addr del $old_ip_address$old_mask ${old_broadcast_address:+broadcast $old_broadcast_address} \
+                dev $interface
             ip link set $interface down
         fi
 
@@ -92,7 +86,8 @@ case "$reason" in
 
             ip link set $interface up
             ip addr flush dev $interface
-            ip addr add $new_ip_address$new_mask $new_broadcast_arg dev $interface
+            ip addr add $new_ip_address$new_mask ${new_broadcast_address:+broadcast $new_broadcast_address} \
+                 dev $interface
 
             for router in $new_routers; do
                 ip route add default via $router

-- 
ISC DHCP packaging for Debian



More information about the pkg-dhcp-commits mailing list