From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17725 invoked by alias); 25 Sep 2009 13:16:25 -0000 Received: (qmail 17713 invoked by uid 22791); 25 Sep 2009 13:16:23 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from virtual.bogons.net (HELO virtual.bogons.net) (193.178.223.136) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Sep 2009 13:15:12 +0000 Received: from jifvik.dyndns.org (jifvik.dyndns.org [85.158.45.40]) by virtual.bogons.net (8.10.2+Sun/8.11.2) with ESMTP id n8PDF9415162; Fri, 25 Sep 2009 14:15:09 +0100 (BST) Received: from [172.31.1.126] (neelix.jifvik.org [172.31.1.126]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by jifvik.dyndns.org (Postfix) with ESMTP id BAA5B3FEB; Fri, 25 Sep 2009 14:15:08 +0100 (BST) Message-ID: <4ABCC25B.8000009@jifvik.org> Date: Fri, 25 Sep 2009 13:16:00 -0000 From: Jonathan Larmour User-Agent: Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501) MIME-Version: 1.0 To: Laurie Gellatly Cc: Grant Edwards , eCos discussion References: <6afa98b0909240334i7536f39drfce21817f2fe686c@mail.gmail.com> <4ABB9D9D.3080309@jifvik.org> <4ABC0AA4.4040208@jifvik.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: connect ethernet cable at run-time X-SW-Source: 2009-09/txt/msg00242.txt.bz2 Laurie Gellatly wrote: > On 25/09/2009, at 10:11 AM, Jonathan Larmour 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