Detecting link state in dhcpc...

David Daney ddaney at avtrex.com
Mon Feb 12 07:23:45 UTC 2007


Rogelio Serrano wrote:
> On 2/11/07, Denis Vlasenko <vda.linux at googlemail.com> wrote:
>   
>> On Saturday 10 February 2007 19:35, Jason Schoon wrote:
>>     
>>>>> I recall reading on the list recently that someone was thinking about
>>>>> modifying dhcpc to do nice things when the link state changes.
>>>>>
>>>>> Has this been done?
>>>>>
>>>>> If not, I think I will be doing it very soon.
>>>>>           
>>>> Why do you need this?
>>>>
>>>> Windows have such a behavior (of severing all TCP connections
>>>> whenever I need to unplug my network cable for 5 seconds)
>>>> and it is _awful_.
>>>>
>>>> I hope you plan to implement something less annoying then this.
>>>>         

I am testing my patch now.  The behavior is optional in two ways:  The 
link state support is be enabled/disabled at configure time, and then if 
it is present, it is only used if a command line flag is specified.

Linux seems to be nicer than Windows in at least this respect.  A TCP 
connection is only lost if you are assigned a *different* address when 
you re-connect.  Really it is not lost per se, it just never receives 
any more incoming packets, and thus will die if you try to send data 
over it.

>>> Perhaps he is talking more along the lines of doing an automatic renewal
>>> when a link is upped.  For example, plugging into a new network.  You want
>>> to get a new address on that net, not keep using an old one.  I have
>>> implemented that several times in different DHCP clients.
>>>       
>> Why? If I unplug my machine from network, it does NOT
>> automatically mean I should renew DHCP address.
>>
>> It is needed sometimes, but other times (e.g. "I need to unplug
>> my machine for 10 seconds...") it will be utterly inconvenient.
>>
>> If you really want it, perhaps kernel sends a hotplug event
>> or something like it on link down/link up,
>> so you can hook onto it and kill/restart udhcpc?
>> --
>> vda
>> _______________________________________________
>> busybox mailing list
>> busybox at busybox.net
>> http://busybox.net/cgi-bin/mailman/listinfo/busybox
>>
>>     
>
> How does the machine find out by itself that you are "just "unplugging
> for 10 seconds and dont want to renew your address?
>
> I would rather have the adapter renew the address anytime the
> interface goes up. And notify the system that the interface is down
> when the link goes down.
>
>   
For desktop systems it may be debatable if you would want to enable link 
state tracking.  However for some types of embedded systems it can be 
useful.  Since there will be zero runtime overhead when the support for 
link state tracking is disabled, I hope the patch will be acceptable 
(when and if I finish testing it and send it in)

David Daney



More information about the busybox mailing list