On Wed, Apr 18, 2018 at 05:05:59PM +0200, Florian Obser wrote: > This is to inform userland (i.e. slaacd(8)) when duplicate address > detection finishes. > > Not a big fan of the lock/unlock dance but I guess it can't be helped > for now. > > Comments, OKs?
Theo points out that I suck at naming things. I guess we already knew that. How about RTM_CHGADDRATTR, we are changing the attribute of an address. Also fixes a tab vs. space in previous. diff --git net/route.h net/route.h index 3c89348cb43..5fa12578e45 100644 --- net/route.h +++ net/route.h @@ -241,6 +241,7 @@ struct rt_msghdr { #define RTM_INVALIDATE 0x11 /* Invalidate cache of L2 route */ #define RTM_BFD 0x12 /* bidirectional forwarding detection */ #define RTM_PROPOSAL 0x13 /* proposal for netconfigd */ +#define RTM_CHGADDRATTR 0x14 /* address attribute change */ #define RTV_MTU 0x1 /* init or lock _mtu */ #define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ diff --git netinet6/nd6_nbr.c netinet6/nd6_nbr.c index cb5c04c24ed..ef1644aa6f6 100644 --- netinet6/nd6_nbr.c +++ netinet6/nd6_nbr.c @@ -1102,6 +1102,11 @@ nd6_dad_start(struct ifaddr *ifa) KASSERT(ia6->ia6_flags & IN6_IFF_TENTATIVE); if ((ia6->ia6_flags & IN6_IFF_ANYCAST) || (!ip6_dad_count)) { ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; + + KERNEL_LOCK(); + rtm_addr(RTM_CHGADDRATTR, ifa); + KERNEL_UNLOCK(); + return; } @@ -1250,6 +1255,10 @@ nd6_dad_timer(void *xifa) */ ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; + KERNEL_LOCK(); + rtm_addr(RTM_CHGADDRATTR, ifa); + KERNEL_UNLOCK(); + nd6log((LOG_DEBUG, "%s: DAD complete for %s - no duplicates found\n", ifa->ifa_ifp->if_xname, @@ -1293,6 +1302,11 @@ nd6_dad_duplicated(struct dadq *dp) ia6->ia_ifp->if_xname); TAILQ_REMOVE(&dadq, dp, dad_list); + + KERNEL_LOCK(); + rtm_addr(RTM_CHGADDRATTR, dp->dad_ifa); + KERNEL_UNLOCK(); + ifafree(dp->dad_ifa); free(dp, M_IP6NDP, sizeof(*dp)); ip6_dad_pending--; -- I'm not entirely sure you are real.