|
From: | address@hidden |
Subject: | Re: [lwip-users] How to renew DHCP |
Date: | Tue, 02 Feb 2010 15:59:46 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1 |
Alain Mouette wrote:
That depends on the reason for "no connection can be made": if the cable is disconnected, you should notify the stack of it using netif_set_link_down(). If you have registered a link callback (netif_set_link_callback()) before, you can just call dhcp_renew() from that callback.when using DHCP I call netifapi_dhcp_start() ant poll netif_is_up() until the interface is up. after some long time, if no connection can be made, I want to start DHCP again (maybe the cable was diconnected and connected to another network), what should be the correct procedure? Should I jusr call netif_set_down() and start dhcp again? Will DHCP renew itself after some timeout?
Of course you can always call dhcp_renew() yourself, but the above is the recommended (and correctly integrated) way to do it. This might be integrated into the stack so that calling netif_set_link_down()/up() would be enough.
Calling netif_set_down() and dhcp_start() would work, too, but might lead to getting a different address (dhcp_renew() can re-request the old address if the server still allows it).
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |