Package: dhcp-client
Tags: patch

After receiving a DHCPOFFER message, dhclient sits and waits for two
seconds to allow an arp check to be run (to find out if the given
address has been used for something else recently). Except that this
isn't implemented in the default configuration (and shouldn't be); the
test logic is wrong.

This turns out to be two equally dumb issues. Firstly, dhclient-script
returns success when invoked for ARPSEND, which indicates that it
wants to do an ARP check; it should have failed.

--- dhcp-2.0pl5.orig/client/scripts/linux
+++ dhcp-2.0pl5/client/scripts/linux
@@ -90,7 +90,11 @@
   exit_with_hooks 0
 fi
 
-if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
+if [ x$reason = xARPSEND ]; then
+  exit_with_hooks 1
+fi
+  
+if [ x$reason = xARPCHECK ]; then
   exit_with_hooks 0
 fi
   

Secondly, dhclient does not understand the meaning of the value
returned by wait(). It thinks that the bottom eight bits contain the
status code, which is simply not true (it varies per platform; changed
to use the POSIX macros).

--- dhcp-2.0pl5.orig/client/dhclient.c
+++ dhcp-2.0pl5/client/dhclient.c
@@ -2125,7 +2125,12 @@
                ip -> client -> envc = 0;
                dfree (envp, "script_go");
        }
-       return wstatus & 0xff;
+
+        if (WIFEXITED(wstatus))
+          return WEXITSTATUS(wstatus);
+
+        /* Anything else is considered failure */
+        return 1;
 }
 
 void client_envadd (struct client_state *client,

With these patches applied, dhcp requests on boot run in nothing flat,
rather than holding up the boot process for two seconds per interface.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature

Reply via email to