mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
dhcp: restart dhcp after releasing.
There were uses of dhcp_release() followed immediately by dhcp_discover() but dhcp_release() now stops dhcp so discovery would fail, so call dhcp_start() after release which restarts discovery. Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
This commit is contained in:
parent
925f3944d3
commit
ff03ae6f55
@ -431,8 +431,8 @@ dhcp_coarse_tmr(void)
|
|||||||
if (dhcp->t0_timeout && (++dhcp->lease_used == dhcp->t0_timeout)) {
|
if (dhcp->t0_timeout && (++dhcp->lease_used == dhcp->t0_timeout)) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t0 timeout\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t0 timeout\n"));
|
||||||
/* this clients' lease time has expired */
|
/* this clients' lease time has expired */
|
||||||
dhcp_release(netif);
|
dhcp_release_and_stop(netif);
|
||||||
dhcp_discover(netif);
|
dhcp_start(netif);
|
||||||
/* timer is active (non zero), and triggers (zeroes) now? */
|
/* timer is active (non zero), and triggers (zeroes) now? */
|
||||||
} else if (dhcp->t2_rebind_time && (dhcp->t2_rebind_time-- == 1)) {
|
} else if (dhcp->t2_rebind_time && (dhcp->t2_rebind_time-- == 1)) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t2 timeout\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t2 timeout\n"));
|
||||||
@ -504,8 +504,8 @@ dhcp_timeout(struct netif *netif)
|
|||||||
dhcp_select(netif);
|
dhcp_select(netif);
|
||||||
} else {
|
} else {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REQUESTING, releasing, restarting\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REQUESTING, releasing, restarting\n"));
|
||||||
dhcp_release(netif);
|
dhcp_release_and_stop(netif);
|
||||||
dhcp_discover(netif);
|
dhcp_start(netif);
|
||||||
}
|
}
|
||||||
#if DHCP_DOES_ARP_CHECK
|
#if DHCP_DOES_ARP_CHECK
|
||||||
/* received no ARP reply for the offered address (which is good) */
|
/* received no ARP reply for the offered address (which is good) */
|
||||||
@ -790,7 +790,7 @@ dhcp_start(struct netif *netif)
|
|||||||
result = dhcp_discover(netif);
|
result = dhcp_discover(netif);
|
||||||
if (result != ERR_OK) {
|
if (result != ERR_OK) {
|
||||||
/* free resources allocated above */
|
/* free resources allocated above */
|
||||||
dhcp_stop(netif);
|
dhcp_release_and_stop(netif);
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user