Skip to content

Commit

Permalink
net: if: Clear neighbor cache when removing IPv6 addr with active DAD
Browse files Browse the repository at this point in the history
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 <robert.lubos@nordicsemi.no>
(cherry picked from commit a09fd8e)
  • Loading branch information
rlubos authored and github-actions[bot] committed Feb 19, 2025
1 parent 9f7898b commit 4230d58
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -4932,8 +4932,13 @@ static void remove_ipv6_ifaddr(struct net_if *iface,
#if defined(CONFIG_NET_IPV6_DAD)
if (!net_if_flag_is_set(iface, NET_IF_IPV6_NO_ND)) {
k_mutex_lock(&lock, K_FOREVER);
sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node);
if (sys_slist_find_and_remove(&active_dad_timers,
&ifaddr->dad_node)) {
/* Addreess with active DAD timer would still have
* stale entry in the neighbor cache.
*/
net_ipv6_nbr_rm(iface, &ifaddr->address.in6_addr);
}
k_mutex_unlock(&lock);
}
#endif
Expand Down

0 comments on commit 4230d58

Please sign in to comment.