Module Name: src Committed By: roy Date: Wed Feb 25 12:45:34 UTC 2015
Modified Files: src/sys/net: route.c route.h src/sys/netinet6: nd6.c nd6.h nd6_nbr.c nd6_rtr.c Log Message: Rename nd6_rtmsg() to rt_newmsg() and move into the generic routing code as it's not IPv6 specific and will be used elsewhere. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/net/route.c cvs rdiff -u -r1.85 -r1.86 src/sys/net/route.h cvs rdiff -u -r1.159 -r1.160 src/sys/netinet6/nd6.c cvs rdiff -u -r1.63 -r1.64 src/sys/netinet6/nd6.h cvs rdiff -u -r1.105 -r1.106 src/sys/netinet6/nd6_nbr.c cvs rdiff -u -r1.97 -r1.98 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/net/route.c diff -u src/sys/net/route.c:1.134 src/sys/net/route.c:1.135 --- src/sys/net/route.c:1.134 Tue Dec 2 19:57:11 2014 +++ src/sys/net/route.c Wed Feb 25 12:45:34 2015 @@ -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 @@ rt_maskedcopy(const struct sockaddr *src } /* + * 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. */ Index: src/sys/net/route.h diff -u src/sys/net/route.h:1.85 src/sys/net/route.h:1.86 --- src/sys/net/route.h:1.85 Tue Feb 24 20:06:09 2015 +++ src/sys/net/route.h Wed Feb 25 12:45:34 2015 @@ -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 @@ struct rtentry * 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 *, Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.159 src/sys/netinet6/nd6.c:1.160 --- src/sys/netinet6/nd6.c:1.159 Wed Feb 25 00:26:58 2015 +++ src/sys/netinet6/nd6.c Wed Feb 25 12:45:34 2015 @@ -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 @@ nd6_free(struct rtentry *rt, int gc) 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 @@ fail: } 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 Index: src/sys/netinet6/nd6.h diff -u src/sys/netinet6/nd6.h:1.63 src/sys/netinet6/nd6.h:1.64 --- src/sys/netinet6/nd6.h:1.63 Wed Feb 25 00:26:58 2015 +++ src/sys/netinet6/nd6.h Wed Feb 25 12:45:34 2015 @@ -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 @@ void nd6_option_init(void *, int, union 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 *); Index: src/sys/netinet6/nd6_nbr.c diff -u src/sys/netinet6/nd6_nbr.c:1.105 src/sys/netinet6/nd6_nbr.c:1.106 --- src/sys/netinet6/nd6_nbr.c:1.105 Wed Feb 25 00:26:58 2015 +++ src/sys/netinet6/nd6_nbr.c Wed Feb 25 12:45:34 2015 @@ -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 @@ nd6_na_input(struct mbuf *m, int off, in 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); Index: src/sys/netinet6/nd6_rtr.c diff -u src/sys/netinet6/nd6_rtr.c:1.97 src/sys/netinet6/nd6_rtr.c:1.98 --- src/sys/netinet6/nd6_rtr.c:1.97 Wed Feb 25 00:26:58 2015 +++ src/sys/netinet6/nd6_rtr.c Wed Feb 25 12:45:34 2015 @@ -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 @@ nd6_ra_input(struct mbuf *m, int off, in /* * 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 @@ defrouter_addreq(struct nd_defrouter *ne 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 @@ defrouter_delreq(struct nd_defrouter *dr 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 @@ nd6_prefix_onlink(struct nd_prefix *pr) 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 @@ nd6_prefix_offlink(struct nd_prefix *pr) /* report the route deletion to the routing socket. */ if (rt != NULL) { - nd6_rtmsg(RTM_DELETE, rt); + rt_newmsg(RTM_DELETE, rt); nd6_numroutes--; }