mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-16 23:15:37 +00:00
fix: when a DHCP lease is obtained, stop autoip to avoid that it overwrites the IP address after conflict resolution
This commit is contained in:
parent
73fcf72792
commit
d77cc49b71
@ -343,6 +343,11 @@ autoip_stop(struct netif *netif)
|
||||
|
||||
LWIP_ASSERT_CORE_LOCKED();
|
||||
if (autoip != NULL) {
|
||||
/* Stop and remove acd */
|
||||
if (autoip->state != AUTOIP_STATE_OFF) {
|
||||
acd_stop(&autoip->acd);
|
||||
acd_remove(netif, &autoip->acd);
|
||||
}
|
||||
autoip->state = AUTOIP_STATE_OFF;
|
||||
if (ip4_addr_islinklocal(netif_ip4_addr(netif))) {
|
||||
netif_set_addr(netif, IP4_ADDR_ANY4, IP4_ADDR_ANY4, IP4_ADDR_ANY4);
|
||||
|
@ -1143,6 +1143,11 @@ dhcp_bind(struct netif *netif)
|
||||
to ensure the callback can use dhcp_supplied_address() */
|
||||
dhcp_set_state(dhcp, DHCP_STATE_BOUND);
|
||||
|
||||
#if LWIP_DHCP_AUTOIP_COOP
|
||||
/* If autoip was started, stop it to avoid that it sets an ip address after conflict resolution */
|
||||
autoip_stop(netif);
|
||||
#endif /* LWIP_DHCP_AUTOIP_COOP */
|
||||
|
||||
netif_set_addr(netif, &dhcp->offered_ip_addr, &sn_mask, &gw_addr);
|
||||
/* interface is used by routing now that an address is set */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user