[pkg-dhcp-devel] Bug#629632: isc-dhcp-client: patch fixing the issue

Peter Marschall peter at adpm.de
Fri Aug 26 15:54:26 UTC 2011


Package: isc-dhcp-client
Version: 4.1.1-P1-17
Followup-For: Bug #629632

The attached patch should fix the issue.

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages isc-dhcp-client depends on:
ii  debianutils                  4.0.2       Miscellaneous utilities specific t
ii  iproute                      20110629-1  networking and traffic control too
ii  isc-dhcp-common              4.1.1-P1-17 common files used by all the isc-d
ii  libc6                        2.13-16     Embedded GNU C Library: Shared lib

isc-dhcp-client recommends no packages.

Versions of packages isc-dhcp-client suggests:
pn  avahi-autoipd                 <none>     (no description available)
pn  resolvconf                    <none>     (no description available)

-- Configuration Files:
/etc/dhcp/dhclient.conf changed [not included]

-- no debconf information

-- debsums errors found:
debsums: changed file /sbin/dhclient-script (from isc-dhcp-client package)
-------------- next part --------------
>From faa0dfc7da2e784dd4ea021a123ae5c929bec3c4 Mon Sep 17 00:00:00 2001
From: Peter Marschall <peter at adpm.de>
Date: Fri, 24 Jun 2011 19:42:05 +0200
Subject: [PATCH] dhclient-script.linux: fix metric calculation

In the case of multiple routers for the default route, assign increasing metric
values to them.
Depending whether IF_METRIC is set, the initial value is either $IF_METRIC or 1.

---
 debian/dhclient-script.linux |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/debian/dhclient-script.linux b/debian/dhclient-script.linux
index 851d3fd..06dcb4f 100644
--- a/debian/dhclient-script.linux
+++ b/debian/dhclient-script.linux
@@ -173,9 +173,6 @@ fi
 if [ -z "$new_interface_mtu" ] || [ "$new_interface_mtu" -le 576 ]; then
     new_interface_mtu=''
 fi
-if [ -n "$IF_METRIC" ]; then
-    metric_arg="metric $IF_METRIC"	# interfaces(5), "metric" option
-fi
 
 
 # The action starts here
@@ -234,6 +231,12 @@ case "$reason" in
                 ip link set dev ${interface} mtu ${new_interface_mtu}
             fi
 
+            # set if_metric if IF_METRIC is set or there's more than one router
+            if_metric="$IF_METRIC"
+            if [ "${new_routers%% *}" != "${new_routers}" ]; then
+                if_metric=${if_metric:-1}
+            fi
+
             for router in $new_routers; do
                 if [ "$new_subnet_mask" = "255.255.255.255" ]; then
                     # point-to-point connection => set explicit route
@@ -242,7 +245,11 @@ case "$reason" in
 
                 # set default route
                 ip -4 route add default via ${router} dev ${interface} \
-                    ${metric_arg} >/dev/null 2>&1
+                    ${if_metric:+metric $if_metric} >/dev/null 2>&1
+
+                if [ -n "$if_metric" ]; then
+                    if_metric=$((if_metric+1))
+                fi
             done
         fi
 
@@ -306,10 +313,20 @@ case "$reason" in
                 ip -4 route add ${alias_ip_address} dev ${interface} >/dev/null 2>&1
             fi
 
+            # set if_metric if IF_METRIC is set or there's more than one router
+            if_metric="$IF_METRIC"
+            if [ "${new_routers%% *}" != "${new_routers}" ]; then
+                if_metric=${if_metric:-1}
+            fi
+
             # set default route
             for router in $new_routers; do
                 ip -4 route add default via ${router} dev ${interface} \
-                    ${metric_arg} >/dev/null 2>&1
+                    ${if_metric:+metric $if_metric} >/dev/null 2>&1
+
+                if [ -n "$if_metric" ]; then
+                    if_metric=$((if_metric+1))
+                fi
             done
 
             # update /etc/resolv.conf
-- 
1.7.5.4



More information about the pkg-dhcp-devel mailing list