mirror of
https://github.com/espressif/esp-lwip.git
synced 2025-08-06 18:23:42 +08:00
dhcp restore last ip
This commit is contained in:
@ -844,6 +844,15 @@ dhcp_start(struct netif *netif)
|
|||||||
}
|
}
|
||||||
#endif /* LWIP_DHCP_CHECK_LINK_UP */
|
#endif /* LWIP_DHCP_CHECK_LINK_UP */
|
||||||
|
|
||||||
|
#ifdef ESP_DHCP
|
||||||
|
// Try to restore last valid ip address obtained from DHCP server.
|
||||||
|
// If no valid ip is available, run dhcp_discover instead.
|
||||||
|
if(LWIP_DHCP_IP_ADDR_RESTORE()) {
|
||||||
|
dhcp_set_state(dhcp, DHCP_STATE_BOUND);
|
||||||
|
dhcp_network_changed(netif);
|
||||||
|
return ERR_OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* (re)start the DHCP negotiation */
|
/* (re)start the DHCP negotiation */
|
||||||
result = dhcp_discover(netif);
|
result = dhcp_discover(netif);
|
||||||
@ -1234,6 +1243,10 @@ dhcp_bind(struct netif *netif)
|
|||||||
/* interface is used by routing now that an address is set */
|
/* interface is used by routing now that an address is set */
|
||||||
|
|
||||||
/* Espressif add start. */
|
/* Espressif add start. */
|
||||||
|
#ifdef ESP_DHCP
|
||||||
|
LWIP_DHCP_IP_ADDR_STORE();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (dhcp->cb != NULL) {
|
if (dhcp->cb != NULL) {
|
||||||
#ifdef ESP_DHCP
|
#ifdef ESP_DHCP
|
||||||
dhcp->cb(netif);
|
dhcp->cb(netif);
|
||||||
|
@ -895,6 +895,18 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef LWIP_DHCP_IP_ADDR_RESTORE
|
||||||
|
#define LWIP_DHCP_IP_ADDR_RESTORE() 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LWIP_DHCP_IP_ADDR_STORE
|
||||||
|
#define LWIP_DHCP_IP_ADDR_STORE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LWIP_DHCP_IP_ADDR_ERASE
|
||||||
|
#define LWIP_DHCP_IP_ADDR_ERASE()
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
------------------------------------
|
------------------------------------
|
||||||
---------- AUTOIP options ----------
|
---------- AUTOIP options ----------
|
||||||
|
Reference in New Issue
Block a user