[PATCH] DHCP Timeout issues

Nico Erfurth masta at perlgolf.de
Fri May 16 06:06:10 PDT 2008


Hi,

the current dhcpc is broken a bit. It uses the last timeout-value over 
and over again  When invalid packets arrive, this sometimes results in 
it never switching from RENEW to REBIND state.

We've the issue here with a weird cable modem. Resulting in a lot of 
"Ignoring XID" and "Unrelated/bogus packet" warnings.

The attached patch (against current svn-trunk) changes the timeout 
handling to be based on monotonic_sec, it also rearanges some code and 
adds the G-trick.

Another thing i'm currently not sure about (comments welcome), how long 
should the timeout on a renew be? Currently its just lease_timeout - 
time_when_renew_was_sent. So, it will always only send one renew, is 
this how it should be?

I would suggest -> timeout = (lease_timeout - NOW)/3
Maybe with a minimum of 10 secs or so. This would allow a better/faster 
recovery when network problems occur.

Nico

bloatcheck with allnoconfig + dhcpc
function                                             old     new   delta
change_listen_mode                                    37      82     +45
update_timeout                                         -      20     +20
state                                                  1       -      -1
listen_mode                                            1       -      -1
timeout                                                4       -      -4
sockfd                                                 4       -      -4
server_addr                                            4       -      -4
requested_ip                                           4       -      -4
perform_release                                      134     125      -9
udhcpc_main                                         2327    2219    -108
------------------------------------------------------------------------------
(add/remove: 1/6 grow/shrink: 1/2 up/down: 65/-135)           Total: -70 
bytes
    text	   data	    bss	    dec	    hex	filename
   17917	    505	   8296	  26718	   685e	busybox_old
   17865	    501	   8280	  26646	   6816	busybox_unstripped

-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox_dhcp.patch
Type: text/x-patch
Size: 6669 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20080516/292d324c/attachment.bin 


More information about the busybox mailing list