lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Cable unplug events


From: Jonathan Larmour
Subject: Re: [lwip-users] Cable unplug events
Date: Thu, 14 Feb 2008 13:46:35 +0000
User-agent: Thunderbird 1.5.0.12 (X11/20070530)

Kieran Mansley wrote:
> On Thu, 2008-02-14 at 11:31 +0200, address@hidden wrote:
>> Is a cable removal event catastrophic, forcing all open connections to be
>> reset and dhcp to restart from scratch, or is it something that should be
>> ignored if it is shorter than a specific duration?
> 
> Cable events should be entirely ignored by the stack.  The stack has its
> own ways to determine if the physical link between it and the other end
> is present (using probing) which can take account of all the links on
> that path rather than just the local one.

That isn't entirely true. In 1.3.0-rc1 there is an LWIP_NETIF_LINK_CALLBACK
option, which if enabled allows the driver to call these functions to
indicate the link status to the stack.
void netif_set_link_up(struct netif *netif);
void netif_set_link_down(struct netif *netif);

Higher layers can use these functions if they wish to, to act on them:
u8_t netif_is_link_up(struct netif *netif);
void netif_set_link_callback(struct netif *netif, void (*
link_callback)(struct netif *netif));

The only place in the stack that uses these functions is the implementation
of the ifAdminStatus MIB object in SNMP (in fact, the netif_is_link_up
function only).

But in general Kieran is of course right, the physical state of the
interface is unrelated to the logical state of the interface. The interface
is meant to stay "up", even if someone pulls the cable out. Obviously the
packets won't go anywhere :).

If your application, however, wants to act on changes to the link, then it
can use the above functions to do so.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
Visit us @ Embedded World 2008, Nürnberg, Germany, 26-28 Feb:Stand 11-336
------["Si fractum non sit, noli id reficere"]------       Opinions==mine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]