I wrote something like this in contrib/win32 port (see this port for the full 
code):

#if LWIP_NETIF_LINK_CALLBACK
void link_callback(struct netif *netif)
{ if (netif_is_link_up(netif)) {
    printf("link_callback==UP\n");
#if LWIP_DHCP
    if (netif->dhcp != NULL) {
        dhcp_renew(netif);
    }
#endif /* LWIP_DHCP */
  } else {
     printf("link_callback==DOWN\n");
  }
}
#endif /* LWIP_NETIF_LINK_CALLBACK */

But, with experience, it's faster and more efficient to replace 
"dhcp_renew(netif);" by a "dhcp_stop(netif);dhcp_start(netif);"

----- Original Message ----- 
From: "Jonathan Larmour" <[EMAIL PROTECTED]>
To: "Mailing list for lwIP users" <[email protected]>
Sent: Wednesday, February 20, 2008 5:13 PM
Subject: Re: [lwip-users] DHCP recovery after network change


Art R. wrote:
> If lwIP has acquired an IP addr by DHCP, and then the connection is switched
> from one network to another (think unplug from one subnet, walk across the
> hall, plug into different subnet), will it be able to release its current IP
> and acquire a new one? I.e., does it have that capability? Some preliminary
> tests we have done have not gone well...

It is meant to, although would not notice until the original DHCP lease
comes up for renewal. Higher level code could detect, for example, link
up/down events and check whether the network has changed.

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


_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to