mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
netif_set_addr(): when removing an address (setting address to ANY), we have to remove it *before* changing netmask/gw to ensure that tcp RST segment can be sent correctly
This commit is contained in:
parent
24a339a609
commit
97b8e88e69
@ -305,10 +305,18 @@ void
|
|||||||
netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
|
netif_set_addr(struct netif *netif, const ip4_addr_t *ipaddr, const ip4_addr_t *netmask,
|
||||||
const ip4_addr_t *gw)
|
const ip4_addr_t *gw)
|
||||||
{
|
{
|
||||||
netif_set_netmask(netif, netmask);
|
if (ip4_addr_isany(ipaddr)) {
|
||||||
netif_set_gw(netif, gw);
|
/* when removing an address, we have to remove it *before* changing netmask/gw
|
||||||
/* set ipaddr last to ensure netmask/gw have been set when status callback is called */
|
to ensure that tcp RST segment can be sent correctly */
|
||||||
netif_set_ipaddr(netif, ipaddr);
|
netif_set_ipaddr(netif, ipaddr);
|
||||||
|
netif_set_netmask(netif, netmask);
|
||||||
|
netif_set_gw(netif, gw);
|
||||||
|
} else {
|
||||||
|
netif_set_netmask(netif, netmask);
|
||||||
|
netif_set_gw(netif, gw);
|
||||||
|
/* set ipaddr last to ensure netmask/gw have been set when status callback is called */
|
||||||
|
netif_set_ipaddr(netif, ipaddr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* LWIP_IPV4*/
|
#endif /* LWIP_IPV4*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user