Alain Mouette wrote:
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?
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.

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


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

Reply via email to