Source-Changes-HG archive

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

[src/trunk]: src/sys Rename nd6_rtmsg() to rt_newmsg() and move into the gene...



details:   https://anonhg.NetBSD.org/src/rev/39f09253603b
branches:  trunk
changeset: 806444:39f09253603b
user:      roy <roy%NetBSD.org@localhost>
date:      Wed Feb 25 12:45:34 2015 +0000

description:
Rename nd6_rtmsg() to rt_newmsg() and move into the generic routing code
as it's not IPv6 specific and will be used elsewhere.

diffstat:

 sys/net/route.c        |  24 ++++++++++++++++++++++--
 sys/net/route.h        |   3 ++-
 sys/netinet6/nd6.c     |   8 ++++----
 sys/netinet6/nd6.h     |   3 +--
 sys/netinet6/nd6_nbr.c |   6 +++---
 sys/netinet6/nd6_rtr.c |  31 ++++++-------------------------
 6 files changed, 38 insertions(+), 37 deletions(-)

diffs (222 lines):

diff -r 47472f5474ac -r 39f09253603b sys/net/route.c
--- a/sys/net/route.c   Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/net/route.c   Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.c,v 1.134 2014/12/02 19:57:11 christos Exp $     */
+/*     $NetBSD: route.c,v 1.135 2015/02/25 12:45:34 roy Exp $  */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -93,7 +93,7 @@
 #include "opt_route.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.134 2014/12/02 19:57:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.135 2015/02/25 12:45:34 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -891,6 +891,26 @@
 }
 
 /*
+ * Inform the routing socket of a route change.
+ */
+void
+rt_newmsg(int cmd, struct rtentry *rt)
+{
+       struct rt_addrinfo info;
+
+       memset((void *)&info, 0, sizeof(info));
+       info.rti_info[RTAX_DST] = rt_getkey(rt);
+       info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
+       info.rti_info[RTAX_NETMASK] = rt_mask(rt);
+       if (rt->rt_ifp) {
+               info.rti_info[RTAX_IFP] = rt->rt_ifp->if_dl->ifa_addr;
+               info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
+       }
+
+       rt_missmsg(cmd, &info, rt->rt_flags, 0);
+}
+
+/*
  * Set up or tear down a routing table entry, normally
  * for an interface.
  */
diff -r 47472f5474ac -r 39f09253603b sys/net/route.h
--- a/sys/net/route.h   Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/net/route.h   Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: route.h,v 1.85 2015/02/24 20:06:09 roy Exp $   */
+/*     $NetBSD: route.h,v 1.86 2015/02/25 12:45:34 roy Exp $   */
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -386,6 +386,7 @@
         rtalloc1(const struct sockaddr *, int);
 void    rtfree(struct rtentry *);
 int     rt_getifa(struct rt_addrinfo *);
+void    rt_newmsg(int, struct rtentry *);
 int     rtinit(struct ifaddr *, int, int);
 void    rtredirect(const struct sockaddr *, const struct sockaddr *,
            const struct sockaddr *, int, const struct sockaddr *,
diff -r 47472f5474ac -r 39f09253603b sys/netinet6/nd6.c
--- a/sys/netinet6/nd6.c        Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/netinet6/nd6.c        Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.c,v 1.159 2015/02/25 00:26:58 roy Exp $    */
+/*     $NetBSD: nd6.c,v 1.160 2015/02/25 12:45:34 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.159 2015/02/25 00:26:58 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.160 2015/02/25 12:45:34 roy Exp $");
 
 #include "bridge.h"
 #include "carp.h"
@@ -1150,7 +1150,7 @@
        oldrt = NULL;
        rtrequest(RTM_DELETE, rt_getkey(rt), NULL, rt_mask(rt), 0, &oldrt);
        if (oldrt) {
-               nd6_rtmsg(RTM_DELETE, oldrt); /* tell user process */
+               rt_newmsg(RTM_DELETE, oldrt); /* tell user process */
                if (oldrt->rt_refcnt <= 0) {
                        oldrt->rt_refcnt++;
                        rtfree(oldrt);
@@ -2086,7 +2086,7 @@
        }
 
        if (do_update)
-               nd6_rtmsg(RTM_CHANGE, rt);  /* tell user process */
+               rt_newmsg(RTM_CHANGE, rt);  /* tell user process */
 
        /*
         * When the link-layer address of a router changes, select the
diff -r 47472f5474ac -r 39f09253603b sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/netinet6/nd6.h        Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6.h,v 1.63 2015/02/25 00:26:58 roy Exp $     */
+/*     $NetBSD: nd6.h,v 1.64 2015/02/25 12:45:34 roy Exp $     */
 /*     $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $    */
 
 /*
@@ -413,7 +413,6 @@
 struct nd_opt_hdr *nd6_option(union nd_opts *);
 int nd6_options(union nd_opts *);
 struct rtentry *nd6_lookup(const struct in6_addr *, int, struct ifnet *);
-void nd6_rtmsg(int, struct rtentry *);
 void nd6_setmtu(struct ifnet *);
 void nd6_llinfo_settimer(struct llinfo_nd6 *, long);
 void nd6_timer(void *);
diff -r 47472f5474ac -r 39f09253603b sys/netinet6/nd6_nbr.c
--- a/sys/netinet6/nd6_nbr.c    Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/netinet6/nd6_nbr.c    Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_nbr.c,v 1.105 2015/02/25 00:26:58 roy Exp $        */
+/*     $NetBSD: nd6_nbr.c,v 1.106 2015/02/25 12:45:34 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.105 2015/02/25 00:26:58 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.106 2015/02/25 12:45:34 roy Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -823,7 +823,7 @@
        ln->ln_asked = 0;
        nd6_llinfo_release_pkts(ln, ifp, rt);
        if (rt_announce) /* tell user process about any new lladdr */
-               nd6_rtmsg(RTM_CHANGE, rt);
+               rt_newmsg(RTM_CHANGE, rt);
 
  freeit:
        m_freem(m);
diff -r 47472f5474ac -r 39f09253603b sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Wed Feb 25 12:41:15 2015 +0000
+++ b/sys/netinet6/nd6_rtr.c    Wed Feb 25 12:45:34 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_rtr.c,v 1.97 2015/02/25 00:26:58 roy Exp $ */
+/*     $NetBSD: nd6_rtr.c,v 1.98 2015/02/25 12:45:34 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.97 2015/02/25 00:26:58 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.98 2015/02/25 12:45:34 roy Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -413,25 +413,6 @@
 /*
  * default router list processing sub routines
  */
-
-/* tell the change to user processes watching the routing socket. */
-void
-nd6_rtmsg(int cmd, struct rtentry *rt)
-{
-       struct rt_addrinfo info;
-
-       memset((void *)&info, 0, sizeof(info));
-       info.rti_info[RTAX_DST] = rt_getkey(rt);
-       info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
-       info.rti_info[RTAX_NETMASK] = rt_mask(rt);
-       if (rt->rt_ifp) {
-               info.rti_info[RTAX_IFP] = rt->rt_ifp->if_dl->ifa_addr;
-               info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
-       }
-
-       rt_missmsg(cmd, &info, rt->rt_flags, 0);
-}
-
 void
 defrouter_addreq(struct nd_defrouter *newdr)
 {
@@ -459,7 +440,7 @@
        error = rtrequest(RTM_ADD, &def.sa, &gate.sa, &mask.sa,
            RTF_GATEWAY, &newrt);
        if (newrt) {
-               nd6_rtmsg(RTM_ADD, newrt); /* tell user process */
+               rt_newmsg(RTM_ADD, newrt); /* tell user process */
                newrt->rt_refcnt--;
                nd6_numroutes++;
        }
@@ -572,7 +553,7 @@
 
        rtrequest(RTM_DELETE, &def.sa, &gw.sa, &mask.sa, RTF_GATEWAY, &oldrt);
        if (oldrt) {
-               nd6_rtmsg(RTM_DELETE, oldrt);
+               rt_newmsg(RTM_DELETE, oldrt);
                if (oldrt->rt_refcnt <= 0) {
                        /*
                         * XXX: borrowed from the RTM_DELETE case of
@@ -1705,7 +1686,7 @@
            ifa->ifa_addr, (struct sockaddr *)&mask6, rtflags, &rt);
        if (error == 0) {
                if (rt != NULL) { /* this should be non NULL, though */
-                       nd6_rtmsg(RTM_ADD, rt);
+                       rt_newmsg(RTM_ADD, rt);
                        nd6_numroutes++;
                }
                pr->ndpr_stateflags |= NDPRF_ONLINK;
@@ -1751,7 +1732,7 @@
 
                /* report the route deletion to the routing socket. */
                if (rt != NULL) {
-                       nd6_rtmsg(RTM_DELETE, rt);
+                       rt_newmsg(RTM_DELETE, rt);
                        nd6_numroutes--;
                }
 



Home | Main Index | Thread Index | Old Index