From: florian Date: Thu, 12 Jul 2018 16:07:35 +0000 (+0000) Subject: Introduce RTM_CHGADDRATTR to inform userland on the route socket when X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9de9537b3a033015457e1f073477c4dde54974b7;p=openbsd Introduce RTM_CHGADDRATTR to inform userland on the route socket when an attribute of an address is changed. For now it's used when IPv6 duplicate address detection finishes. With this slaacd(8) can find out if a configured address is not duplicated without the need to poll. OK phessler, benno, claudio --- diff --git a/sys/net/route.h b/sys/net/route.h index 43386fa41a6..6643dd71dfb 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.171 2018/07/01 08:53:03 mpi Exp $ */ +/* $OpenBSD: route.h,v 1.172 2018/07/12 16:07:35 florian Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -240,6 +240,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 a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index d63279a0b8b..a90f852b25e 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.123 2018/06/11 08:48:54 mpi Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.124 2018/07/12 16:07:35 florian Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -1100,6 +1100,9 @@ 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; + + rtm_addr(RTM_CHGADDRATTR, ifa); + return; } @@ -1248,6 +1251,8 @@ nd6_dad_timer(void *xifa) */ ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; + rtm_addr(RTM_CHGADDRATTR, ifa); + nd6log((LOG_DEBUG, "%s: DAD complete for %s - no duplicates found\n", ifa->ifa_ifp->if_xname, @@ -1291,6 +1296,9 @@ nd6_dad_duplicated(struct dadq *dp) ia6->ia_ifp->if_xname); TAILQ_REMOVE(&dadq, dp, dad_list); + + rtm_addr(RTM_CHGADDRATTR, dp->dad_ifa); + ifafree(dp->dad_ifa); free(dp, M_IP6NDP, sizeof(*dp)); ip6_dad_pending--;