[ECOS] Re: connect ethernet cable at run-time

Jonathan Larmour jifl@jifvik.org
Fri Sep 25 13:16:00 GMT 2009


Laurie Gellatly wrote:
> On 25/09/2009, at 10:11 AM, Jonathan Larmour <jifl@jifvik.org> wrote:
>> Grant Edwards wrote:
>>>
>>> If one calls init_all_network_interfaces() before the Ethernet
>>> link is up does the DHCP code give up and terminate?  IOW,
>>> doesn't the DHCP client code retry if it doesn't get a
>>> response?  That seems a bit odd.
>> I don't believe it does retry at present.
>>
>> See for example in dhcp_prot.c that do_dhcp() calls no_lease(),  
>> whicih disables and deletes the alarm. Without that the  
>> needs_attention semaphore is not posted and the dhcp management  
>> thread gets stuck waiting on it. That's my belief anyway.
>>
> With my project I found some interesting things with DHCP and network  
> cables. If the network cable was unplugged at startup then there is no  
> IP address. I found that I could run out of file handles and that  
> DHCPinit call would never return even if the cable was later inserted.  
> I had to work around that and then regularly call  
> init_all_network_interfaces in the main TCP listening task just after  
> it also fed the watchdog if the IP address was 0.0.0.0.
> Switching in and out of DHCP or static addressing was also coded.

I think it would be hard to shield the DHCP code from insufficient file 
handles. But yes that does confirm that an unplugged cable at startup 
means no IP address unless the user calls init_all_network_interfaces again.

In this respect, the DHCP code wants improvement.

Jifl
-- 
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list