Improving dhclient startup time
    Lorenzo Colitti 
    lorenzo at colitti.com
       
    Thu Jun 15 13:52:15 UTC 2006
    
    
  
Hi,
recently I've been investigating why it takes my laptop such a long time 
to get an Internet connection using NetworkManager (~15 seconds). After 
hacking on NetworkManager to speed this up, I discovered that dhclient 
has a random 0-4 second wait before sending the first DHCPDISCOVER out:
> /* Set up a timeout to start the initialization process. */
> add_timeout (cur_time + random () % 5, state_reboot, client, 0, 0);
This can be drag on performance, especially on laptops, which roam 
between different wireless networks, suspend/resume, etc.
Could the wait be taken out in the case of only one interface? i.e. 
something like the following (see attached patch for code):
> if(only one interface)
>     add_timeout (cur_time, state_reboot, client, 0, 0);
> else
>     add_timeout (cur_time + random () % 5, state_reboot, client, 0, 0);
I've tried this and it seems to work fine (and it's much faster of 
course). Does this make sense?
Cheers,
Lorenzo
-- 
Lorenzo Colitti                          http://www.colitti.com/lorenzo/
    
    
More information about the dhcp-users
mailing list