Module Name: src Committed By: roy Date: Wed Feb 25 00:26:59 UTC 2015
Modified Files: src/sys/netinet6: in6.c nd6.c nd6.h nd6_nbr.c nd6_rtr.c Log Message: Retire nd6_newaddrmsg and use rt_newaddrmsg directly instead so that we don't spam route changes when the route hasn't changed. To generate a diff of this commit: cvs rdiff -u -r1.182 -r1.183 src/sys/netinet6/in6.c cvs rdiff -u -r1.158 -r1.159 src/sys/netinet6/nd6.c cvs rdiff -u -r1.62 -r1.63 src/sys/netinet6/nd6.h cvs rdiff -u -r1.104 -r1.105 src/sys/netinet6/nd6_nbr.c cvs rdiff -u -r1.96 -r1.97 src/sys/netinet6/nd6_rtr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet6/in6.c diff -u src/sys/netinet6/in6.c:1.182 src/sys/netinet6/in6.c:1.183 --- src/sys/netinet6/in6.c:1.182 Mon Feb 23 19:15:59 2015 +++ src/sys/netinet6/in6.c Wed Feb 25 00:26:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.182 2015/02/23 19:15:59 martin Exp $ */ +/* $NetBSD: in6.c,v 1.183 2015/02/25 00:26:58 roy Exp $ */ /* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.182 2015/02/23 19:15:59 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.183 2015/02/25 00:26:58 roy Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -194,21 +194,7 @@ in6_ifloop_request(int cmd, struct ifadd * omit the second report? */ if (nrt) { - if (cmd != RTM_ADD || - !(((struct in6_ifaddr *)ifa)->ia6_flags &IN6_IFF_TENTATIVE)) - { -#if 0 - struct in6_ifaddr *ia; - - ia = (struct in6_ifaddr *)ifa; - log(LOG_DEBUG, - "in6_ifloop_request: announced %s (%s %d)\n", - ip6_sprintf(&ia->ia_addr.sin6_addr), - cmd == RTM_ADD ? "RTM_ADD" : "RTM_DELETE", - ia->ia6_flags); -#endif - rt_newaddrmsg(cmd, ifa, e, nrt); - } + rt_newaddrmsg(cmd, ifa, e, nrt); if (cmd == RTM_DELETE) { if (nrt->rt_refcnt <= 0) { /* XXX: we should free the entry ourselves. */ @@ -1799,7 +1785,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 in6_ifaddloop(&ia->ia_ifa); } else { /* Inform the routing socket of new flags/timings */ - nd6_newaddrmsg(&ia->ia_ifa); + rt_newaddrmsg(RTM_NEWADDR, &ia->ia_ifa, 0, NULL); } if (ifp->if_flags & IFF_MULTICAST) @@ -2110,7 +2096,7 @@ in6_if_link_up(struct ifnet *ifp) "%s marked tentative\n", ip6_sprintf(&ia->ia_addr.sin6_addr))); } else if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) - nd6_newaddrmsg(ifa); + rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL); } if (ia->ia6_flags & IN6_IFF_TENTATIVE) { @@ -2184,7 +2170,7 @@ in6_if_link_down(struct ifnet *ifp) ia->ia6_flags |= IN6_IFF_DETACHED; ia->ia6_flags &= ~(IN6_IFF_TENTATIVE | IN6_IFF_DUPLICATED); - nd6_newaddrmsg(ifa); + rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL); } } } Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.158 src/sys/netinet6/nd6.c:1.159 --- src/sys/netinet6/nd6.c:1.158 Mon Feb 23 19:15:59 2015 +++ src/sys/netinet6/nd6.c Wed Feb 25 00:26:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.158 2015/02/23 19:15:59 martin Exp $ */ +/* $NetBSD: nd6.c,v 1.159 2015/02/25 00:26:58 roy Exp $ */ /* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.158 2015/02/23 19:15:59 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.159 2015/02/25 00:26:58 roy Exp $"); #include "bridge.h" #include "carp.h" @@ -599,7 +599,8 @@ nd6_timer(void *ignored_arg) if ((oldflags & IN6_IFF_DEPRECATED) == 0) { ia6->ia6_flags |= IN6_IFF_DEPRECATED; - nd6_newaddrmsg((struct ifaddr *)ia6); + rt_newaddrmsg(RTM_NEWADDR, + (struct ifaddr *)ia6, 0, NULL); } /* @@ -633,7 +634,8 @@ nd6_timer(void *ignored_arg) */ if (ia6->ia6_flags & IN6_IFF_DEPRECATED) { ia6->ia6_flags &= ~IN6_IFF_DEPRECATED; - nd6_newaddrmsg((struct ifaddr *)ia6); + rt_newaddrmsg(RTM_NEWADDR, + (struct ifaddr *)ia6, 0, NULL); } } } Index: src/sys/netinet6/nd6.h diff -u src/sys/netinet6/nd6.h:1.62 src/sys/netinet6/nd6.h:1.63 --- src/sys/netinet6/nd6.h:1.62 Mon Feb 23 19:15:59 2015 +++ src/sys/netinet6/nd6.h Wed Feb 25 00:26:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.h,v 1.62 2015/02/23 19:15:59 martin Exp $ */ +/* $NetBSD: nd6.h,v 1.63 2015/02/25 00:26:58 roy Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -442,7 +442,6 @@ void nd6_ns_input(struct mbuf *, int, in void nd6_ns_output(struct ifnet *, const struct in6_addr *, const struct in6_addr *, struct llinfo_nd6 *, int); const void *nd6_ifptomac(const struct ifnet *); -void nd6_newaddrmsg(struct ifaddr *); void nd6_dad_start(struct ifaddr *, int); void nd6_dad_stop(struct ifaddr *); void nd6_dad_duplicated(struct ifaddr *); Index: src/sys/netinet6/nd6_nbr.c diff -u src/sys/netinet6/nd6_nbr.c:1.104 src/sys/netinet6/nd6_nbr.c:1.105 --- src/sys/netinet6/nd6_nbr.c:1.104 Mon Feb 23 19:15:59 2015 +++ src/sys/netinet6/nd6_nbr.c Wed Feb 25 00:26:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.104 2015/02/23 19:15:59 martin Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.105 2015/02/25 00:26:58 roy Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.104 2015/02/23 19:15:59 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.105 2015/02/25 00:26:58 roy Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -1067,26 +1067,6 @@ nd6_dad_stoptimer(struct dadq *dp) } /* - * Routine to report address flag changes to the routing socket - */ -void -nd6_newaddrmsg(struct ifaddr *ifa) -{ - struct sockaddr_in6 all1_sa; - struct rtentry *nrt = NULL; - int e; - - sockaddr_in6_init(&all1_sa, &in6mask128, 0, 0, 0); - e = rtrequest(RTM_GET, ifa->ifa_addr, ifa->ifa_addr, - (struct sockaddr *)&all1_sa, RTF_UP | RTF_HOST | RTF_LLINFO, &nrt); - if (nrt) { - rt_newaddrmsg(RTM_ADD, ifa, e, nrt); - nrt->rt_refcnt--; - } -} - - -/* * Start Duplicate Address Detection (DAD) for specified interface address. * * Note that callout is used when xtick > 0 and not when xtick == 0. @@ -1120,7 +1100,7 @@ nd6_dad_start(struct ifaddr *ifa, int xt } if (ia->ia6_flags & IN6_IFF_ANYCAST || !ip6_dad_count) { ia->ia6_flags &= ~IN6_IFF_TENTATIVE; - nd6_newaddrmsg(ifa); + rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL); return; } if (ifa->ifa_ifp == NULL) @@ -1276,7 +1256,7 @@ nd6_dad_timer(struct ifaddr *ifa) * No duplicate address found. */ ia->ia6_flags &= ~IN6_IFF_TENTATIVE; - nd6_newaddrmsg(ifa); + rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL); nd6log((LOG_DEBUG, "%s: DAD complete for %s - no duplicates found\n", @@ -1326,7 +1306,7 @@ nd6_dad_duplicated(struct ifaddr *ifa) if_name(ifp)); /* Inform the routing socket that DAD has completed */ - nd6_newaddrmsg(ifa); + rt_newaddrmsg(RTM_NEWADDR, ifa, 0, NULL); /* * If the address is a link-local address formed from an interface Index: src/sys/netinet6/nd6_rtr.c diff -u src/sys/netinet6/nd6_rtr.c:1.96 src/sys/netinet6/nd6_rtr.c:1.97 --- src/sys/netinet6/nd6_rtr.c:1.96 Mon Feb 23 19:15:59 2015 +++ src/sys/netinet6/nd6_rtr.c Wed Feb 25 00:26:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.96 2015/02/23 19:15:59 martin Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.97 2015/02/25 00:26:58 roy Exp $ */ /* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.96 2015/02/23 19:15:59 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.97 2015/02/25 00:26:58 roy Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1593,7 +1593,8 @@ pfxlist_onlink_check(void) } else { if ((ifa->ia6_flags & IN6_IFF_DETACHED) == 0) { ifa->ia6_flags |= IN6_IFF_DETACHED; - nd6_newaddrmsg((struct ifaddr *)ifa); + rt_newaddrmsg(RTM_NEWADDR, + (struct ifaddr *)ifa, 0, NULL); } } }