Skip to content

Commit 64fa3d8

Browse files
rlubosnashif
authored andcommitted
net: if: Clear neighbor cache when removing IPv6 addr with active DAD
DAD creates an entry in the neighbor cache for the queried (own) address. In case the address is removed from the interface while DAD is still incomplete, we need to remove the corresponding cache entry (just like in case of DAD timeout) to avoid stale entries in the cache. Signed-off-by: Robert Lubos <[email protected]> (cherry picked from commit a09fd8e)
1 parent 7e8af7c commit 64fa3d8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

subsys/net/ip/net_if.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4885,8 +4885,13 @@ static void remove_ipv6_ifaddr(struct net_if *iface,
48854885
#if defined(CONFIG_NET_IPV6_DAD)
48864886
if (!net_if_flag_is_set(iface, NET_IF_IPV6_NO_ND)) {
48874887
k_mutex_lock(&lock, K_FOREVER);
4888-
sys_slist_find_and_remove(&active_dad_timers,
4889-
&ifaddr->dad_node);
4888+
if (sys_slist_find_and_remove(&active_dad_timers,
4889+
&ifaddr->dad_node)) {
4890+
/* Addreess with active DAD timer would still have
4891+
* stale entry in the neighbor cache.
4892+
*/
4893+
net_ipv6_nbr_rm(iface, &ifaddr->address.in6_addr);
4894+
}
48904895
k_mutex_unlock(&lock);
48914896
}
48924897
#endif

0 commit comments

Comments
 (0)