[pkg-dhcp-devel] Bug#553211: /sbin/dhclient: Patch.

Michal Suchanek michal.suchanek at ruk.cuni.cz
Wed May 18 14:18:11 UTC 2011


Package: isc-dhcp-client
Version: 4.1.1-P1-15+squeeze2
Severity: normal
File: /sbin/dhclient
Tags: patch


Sending patch which works around this issue.

There si no way to update routing tables atomically together with the ip
address so there is always a possibility that the network goes down
while routing is updated.

However, the time when network is down should be minimized.
Specifically the preinit should *not* reset networking, dhclient uses
raw socket to obtain IP address so it should work regardless of current
networking setup so long as the interface is up.

This patch relies on kernel cache to hold the "ifconfig" and "route"
binaries while the network is down and on the network filesystem driver
to retry any transactions that might get lost while networking is
reenacted by dhclient.

Thanks

Michal



-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (900, 'stable'), (510, 'unstable'), (500, 'testing'), (200, 'experimental'), (111, 'oldstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.38-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages isc-dhcp-client depends on:
ii  debianutils         3.4                  Miscellaneous utilities specific t
ii  iproute             20100519-3           networking and traffic control too
ii  isc-dhcp-common     4.1.1-P1-15+squeeze2 common files used by all the isc-d
ii  libc6               2.11.2-10            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
-------------- next part --------------
--- a/sbin/dhclient-script~	2010-03-07 04:07:33.000000000 +0100
+++ a/sbin/dhclient-script	2010-05-31 17:13:21.000000000 +0200
@@ -133,6 +133,10 @@
 run_hook /etc/dhcp/dhclient-enter-hooks
 run_hookdir /etc/dhcp/dhclient-enter-hooks.d
 
+is_up() {
+    ifconfig $1 | grep -q UP
+}
+
 # Execute the operation
 case "$reason" in
     MEDIUM|ARPCHECK|ARPSEND)
@@ -147,7 +151,9 @@
             # Bring down alias interface. Its routes will disappear too.
             ifconfig $interface:0- inet 0
         fi
-        ifconfig $interface inet 0 up
+        if ! is_up $interface ; then
+            ifconfig $interface inet 0 up
+        fi
 
         ;;
     BOUND|RENEW|REBIND|REBOOT)
--- a/sbin/dhclient-script	2011-04-10 18:59:16.000000000 +0200
+++ a/sbin/dhclient-script	2011-05-18 09:20:35.000000000 +0200
@@ -167,6 +167,7 @@
              "$old_ip_address" != "$new_ip_address" ]; then
             # IP address changed. Bringing down the interface will delete all routes,
             # and clear the ARP cache.
+            route -n > /dev/null # cache the route binary in case / is on network
             ifconfig $interface inet 0
 
         fi


More information about the pkg-dhcp-devel mailing list