mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
fixed bug #34684: Clear the arp table cache when netif is brought down
This commit is contained in:
parent
96d332e234
commit
08b497faea
@ -69,6 +69,10 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2011-11-22: Simon Goldschmidt
|
||||
* netif.c, etharp.h/.c: fixed bug #34684: Clear the arp table cache when
|
||||
netif is brought down
|
||||
|
||||
2011-10-28: Simon Goldschmidt
|
||||
* tcp_in.c: fixed bug #34638: Dead code in tcp_receive - pcb->dupacks
|
||||
|
||||
|
@ -539,6 +539,11 @@ void netif_set_down(struct netif *netif)
|
||||
snmp_get_sysuptime(&netif->ts);
|
||||
#endif
|
||||
|
||||
#if LWIP_ARP
|
||||
if (netif->flags & NETIF_FLAG_ETHARP) {
|
||||
etharp_cleanup_netif(netif);
|
||||
}
|
||||
#endif /* LWIP_ARP */
|
||||
NETIF_STATUS_CALLBACK(netif);
|
||||
}
|
||||
}
|
||||
|
@ -191,6 +191,7 @@ err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
|
||||
* nodes to update an entry in their ARP cache.
|
||||
* From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
|
||||
#define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr)
|
||||
void etharp_cleanup_netif(struct netif *netif);
|
||||
|
||||
#if ETHARP_SUPPORT_STATIC_ENTRIES
|
||||
err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr);
|
||||
|
@ -112,9 +112,7 @@ struct etharp_entry {
|
||||
struct pbuf *q;
|
||||
#endif /* ARP_QUEUEING */
|
||||
ip_addr_t ipaddr;
|
||||
#if LWIP_SNMP
|
||||
struct netif *netif;
|
||||
#endif /* LWIP_SNMP */
|
||||
struct eth_addr ethaddr;
|
||||
u8_t state;
|
||||
u8_t ctime;
|
||||
@ -578,6 +576,23 @@ etharp_remove_static_entry(ip_addr_t *ipaddr)
|
||||
}
|
||||
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
|
||||
|
||||
/**
|
||||
* Remove all ARP table entries of the specified netif.
|
||||
*
|
||||
* @param netif points to a network interface
|
||||
*/
|
||||
void etharp_cleanup_netif(struct netif *netif)
|
||||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < ARP_TABLE_SIZE; ++i) {
|
||||
u8_t state = arp_table[i].state;
|
||||
if ((state != ETHARP_STATE_EMPTY) && (arp_table[i].netif == netif)) {
|
||||
etharp_free_entry(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds (stable) ethernet/IP address pair from ARP table
|
||||
* using interface and IP address index.
|
||||
|
Loading…
Reference in New Issue
Block a user