mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-06-16 18:03:44 +08:00
nd6: add cleanup function
This commit is contained in:
@@ -1843,4 +1843,29 @@ nd6_reachability_hint(const ip6_addr_t * ip6addr)
|
||||
}
|
||||
#endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */
|
||||
|
||||
void
|
||||
nd6_cleanup_netif(struct netif * netif)
|
||||
{
|
||||
u8_t i;
|
||||
s8_t router_index;
|
||||
for (i = 0; i < LWIP_ND6_NUM_PREFIXES; i++) {
|
||||
if(prefix_list[i].netif == netif) {
|
||||
prefix_list[i].netif = NULL;
|
||||
prefix_list[i].flags = 0;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < LWIP_ND6_NUM_NEIGHBORS; i++) {
|
||||
if(neighbor_cache[i].netif == netif) {
|
||||
for (router_index = 0; router_index < LWIP_ND6_NUM_ROUTERS; router_index++) {
|
||||
if (default_router_list[router_index].neighbor_entry == &neighbor_cache[i]) {
|
||||
default_router_list[router_index].neighbor_entry = NULL;
|
||||
default_router_list[router_index].flags = 0;
|
||||
}
|
||||
}
|
||||
neighbor_cache[i].isrouter = 0;
|
||||
nd6_free_neighbor_cache_entry(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
Reference in New Issue
Block a user