Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet6 Retire nd6_newaddrmsg and use rt_newaddrmsg dir...



details:   https://anonhg.NetBSD.org/src/rev/0650c32eb074
branches:  trunk
changeset: 336298:0650c32eb074
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Feb 25 00:26:58 2015 +0000

description:
Retire nd6_newaddrmsg and use rt_newaddrmsg directly instead so that
we don't spam route changes when the route hasn't changed.

diffstat:

 sys/netinet6/in6.c     |  26 ++++++--------------------
 sys/netinet6/nd6.c     |  10 ++++++----
 sys/netinet6/nd6.h     |   3 +--
 sys/netinet6/nd6_nbr.c |  30 +++++-------------------------
 sys/netinet6/nd6_rtr.c |   7 ++++---
 5 files changed, 22 insertions(+), 54 deletions(-)

diffs (223 lines):

diff -r 8f1b74c9aead -r 0650c32eb074 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Tue Feb 24 22:02:40 2015 +0000
+++ b/sys/netinet6/in6.c        Wed Feb 25 00:26:58 2015 +0000
@@ -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 @@
         *      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_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 @@
                                    "%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 @@
                        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);
                }
        }
 }
diff -r 8f1b74c9aead -r 0650c32eb074 sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Tue Feb 24 22:02:40 2015 +0000
+++ b/sys/netinet6/nd6.c        Wed Feb 25 00:26:58 2015 +0000
@@ -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 @@
 
                        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 @@
                         */
                        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);
                        }
                }
        }
diff -r 8f1b74c9aead -r 0650c32eb074 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Tue Feb 24 22:02:40 2015 +0000
+++ b/sys/netinet6/nd6.h        Wed Feb 25 00:26:58 2015 +0000
@@ -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_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 *);
diff -r 8f1b74c9aead -r 0650c32eb074 sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Tue Feb 24 22:02:40 2015 +0000
+++ b/sys/netinet6/nd6_nbr.c    Wed Feb 25 00:26:58 2015 +0000
@@ -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 @@
 }
 
 /*
- * 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 @@
        }
        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 @@
                         * 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 @@
            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
diff -r 8f1b74c9aead -r 0650c32eb074 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Tue Feb 24 22:02:40 2015 +0000
+++ b/sys/netinet6/nd6_rtr.c    Wed Feb 25 00:26:58 2015 +0000
@@ -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 @@
                        } 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);
                                }
                        }
                }



Home | Main Index | Thread Index | Old Index