net: if: Remove local address from IPv6 neighbor cache

When we do DAD (Duplicate Address Detection), the local IPv6
address gets added to the neighbor cache. This is useless so
remove it after DAD has finished.

Change-Id: I9625d367e96d8108a7d3d1d8b2e95f3c4ea11c45
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-02-21 17:16:19 +02:00
commit c27aced5bf

View file

@ -249,14 +249,26 @@ struct net_if *net_if_get_default(void)
static void dad_timeout(struct k_work *work)
{
/* This means that the DAD succeed. */
struct net_if_addr *ifaddr = CONTAINER_OF(work,
struct net_if_addr,
dad_timer);
struct net_if_addr *tmp, *ifaddr = CONTAINER_OF(work,
struct net_if_addr,
dad_timer);
struct net_if *iface = NULL;
NET_DBG("DAD succeeded for %s",
net_sprint_ipv6_addr(&ifaddr->address.in6_addr));
ifaddr->addr_state = NET_ADDR_PREFERRED;
/* Because we do not know the interface at this point, we need to
* lookup for it.
*/
tmp = net_if_ipv6_addr_lookup(&ifaddr->address.in6_addr, &iface);
if (tmp == ifaddr) {
/* The address gets added to neighbor cache which is not needed
* in this case as the address is our own one.
*/
net_ipv6_nbr_rm(iface, &ifaddr->address.in6_addr);
}
}
static void net_if_ipv6_start_dad(struct net_if *iface,