Commit a09fd8e9 authored by Robert Lubos's avatar Robert Lubos Committed by Benjamin Cabé
Browse files

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: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent 3089a5d1
Loading
Loading
Loading
Loading
+7 −2
Changes for subsys/net/ip/net_if.c: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -5127,8 +5127,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