Module Name: src Committed By: ozaki-r Date: Sun Dec 11 07:38:50 UTC 2016
Modified Files: src/sys/netinet6: in6.c nd6.c nd6.h nd6_nbr.c nd6_rtr.c Log Message: Add nd6_ prefix to exported functions To generate a diff of this commit: cvs rdiff -u -r1.222 -r1.223 src/sys/netinet6/in6.c cvs rdiff -u -r1.212 -r1.213 src/sys/netinet6/nd6.c cvs rdiff -u -r1.75 -r1.76 src/sys/netinet6/nd6.h cvs rdiff -u -r1.130 -r1.131 src/sys/netinet6/nd6_nbr.c cvs rdiff -u -r1.122 -r1.123 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.222 src/sys/netinet6/in6.c:1.223 --- src/sys/netinet6/in6.c:1.222 Fri Nov 18 06:50:04 2016 +++ src/sys/netinet6/in6.c Sun Dec 11 07:38:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.222 2016/11/18 06:50:04 knakahara Exp $ */ +/* $NetBSD: in6.c,v 1.223 2016/12/11 07:38:50 ozaki-r 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.222 2016/11/18 06:50:04 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.223 2016/12/11 07:38:50 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -722,7 +722,7 @@ in6_control1(struct socket *so, u_long c in6_purgeaddr(&ia->ia_ifa); ia = NULL; if (pr && pr->ndpr_refcnt == 0) - prelist_remove(pr); + nd6_prelist_remove(pr); run_hooks = true; break; } @@ -1390,11 +1390,11 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st /* * Also, if the address being removed is autoconf'ed, call - * pfxlist_onlink_check() since the release might affect the status of + * nd6_pfxlist_onlink_check() since the release might affect the status of * other (detached) addresses. */ if ((ia->ia6_flags & IN6_IFF_AUTOCONF) != 0) - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); IN6_ADDRLIST_ENTRY_DESTROY(ia); @@ -2149,7 +2149,7 @@ in6_if_link_up(struct ifnet *ifp) curlwp_bindx(bound); /* Restore any detached prefixes */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); } void @@ -2176,7 +2176,7 @@ in6_if_link_down(struct ifnet *ifp) int s, bound; /* Any prefixes on this interface should be detached as well */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); bound = curlwp_bind(); s = pserialize_read_enter(); Index: src/sys/netinet6/nd6.c diff -u src/sys/netinet6/nd6.c:1.212 src/sys/netinet6/nd6.c:1.213 --- src/sys/netinet6/nd6.c:1.212 Sun Dec 11 07:37:53 2016 +++ src/sys/netinet6/nd6.c Sun Dec 11 07:38:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.c,v 1.212 2016/12/11 07:37:53 ozaki-r Exp $ */ +/* $NetBSD: nd6.c,v 1.213 2016/12/11 07:38:50 ozaki-r 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.212 2016/12/11 07:37:53 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.213 2016/12/11 07:38:50 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -595,7 +595,7 @@ nd6_timer_work(struct work *wk, void *ar TAILQ_FOREACH_SAFE(dr, &nd_defrouter, dr_entry, next_dr) { if (dr->expire && dr->expire < time_uptime) { - defrtrlist_del(dr, NULL); + nd6_defrtrlist_del(dr, NULL); } } @@ -706,7 +706,7 @@ nd6_timer_work(struct work *wk, void *ar * separate. NEVER perform in6_purgeaddr here. */ - prelist_remove(pr); + nd6_prelist_remove(pr); } } @@ -844,7 +844,7 @@ nd6_purge(struct ifnet *ifp, struct in6_ if (dr->ifp == ifp) { KASSERT(ext != NULL); - defrtrlist_del(dr, ext); + nd6_defrtrlist_del(dr, ext); } } @@ -854,7 +854,7 @@ nd6_purge(struct ifnet *ifp, struct in6_ if (dr->ifp == ifp) { KASSERT(ext != NULL); - defrtrlist_del(dr, ext); + nd6_defrtrlist_del(dr, ext); } } @@ -876,7 +876,7 @@ nd6_purge(struct ifnet *ifp, struct in6_ * by itself. * (jin...@kame.net 20010129) */ - prelist_remove(pr); + nd6_prelist_remove(pr); } } @@ -889,7 +889,7 @@ nd6_purge(struct ifnet *ifp, struct in6_ struct nd_ifinfo *ndi = ND_IFINFO(ifp); if (ndi && nd6_accepts_rtadv(ndi)) { /* refresh default router list */ - defrouter_select(); + nd6_defrouter_select(); } } @@ -1168,7 +1168,7 @@ nd6_free(struct llentry *ln, int gc) if (!ip6_forwarding) { int s; s = splsoftnet(); - dr = defrouter_lookup(in6, ifp); + dr = nd6_defrouter_lookup(in6, ifp); if (dr != NULL && dr->expire && ln->ln_state == ND6_LLINFO_STALE && gc) { @@ -1196,20 +1196,20 @@ nd6_free(struct llentry *ln, int gc) if (ln->ln_router || dr) { /* - * We need to unlock to avoid a LOR with rt6_flush() + * We need to unlock to avoid a LOR with nd6_rt_flush() * with the rnh and for the calls to - * pfxlist_onlink_check() and defrouter_select() in the + * nd6_pfxlist_onlink_check() and nd6_defrouter_select() in the * block further down for calls into nd6_lookup(). * We still hold a ref. */ LLE_WUNLOCK(ln); /* - * rt6_flush must be called whether or not the neighbor + * nd6_rt_flush must be called whether or not the neighbor * is in the Default Router List. * See a corresponding comment in nd6_na_input(). */ - rt6_flush(in6, ifp); + nd6_rt_flush(in6, ifp); } if (dr) { @@ -1229,17 +1229,17 @@ nd6_free(struct llentry *ln, int gc) ln->ln_state = ND6_LLINFO_INCOMPLETE; /* - * Since defrouter_select() does not affect the + * Since nd6_defrouter_select() does not affect the * on-link determination and MIP6 needs the check * before the default router selection, we perform * the check now. */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); /* * refresh default router list */ - defrouter_select(); + nd6_defrouter_select(); } #ifdef __FreeBSD__ @@ -1845,8 +1845,8 @@ nd6_ioctl(u_long cmd, void *data, struct #undef ND case SIOCSNDFLUSH_IN6: /* XXX: the ioctl name is confusing... */ /* sync kernel routing table with the default router list */ - defrouter_reset(); - defrouter_select(); + nd6_defrouter_reset(); + nd6_defrouter_select(); break; case SIOCSPFXFLUSH_IN6: { @@ -1880,7 +1880,7 @@ nd6_ioctl(u_long cmd, void *data, struct } } pserialize_read_exit(_s); - prelist_remove(pfx); + nd6_prelist_remove(pfx); } splx(s); break; @@ -1891,11 +1891,11 @@ nd6_ioctl(u_long cmd, void *data, struct struct nd_defrouter *drtr, *next; s = splsoftnet(); - defrouter_reset(); + nd6_defrouter_reset(); TAILQ_FOREACH_SAFE(drtr, &nd_defrouter, dr_entry, next) { - defrtrlist_del(drtr, NULL); + nd6_defrtrlist_del(drtr, NULL); } - defrouter_select(); + nd6_defrouter_select(); splx(s); break; } @@ -2172,17 +2172,17 @@ nd6_cache_lladdr( * Question: can we restrict the first condition to the "is_newentry" * case? * XXX: when we hear an RA from a new router with the link-layer - * address option, defrouter_select() is called twice, since + * address option, nd6_defrouter_select() is called twice, since * defrtrlist_update called the function as well. However, I believe * we can compromise the overhead, since it only happens the first * time. - * XXX: although defrouter_select() should not have a bad effect + * XXX: although nd6_defrouter_select() should not have a bad effect * for those are not autoconfigured hosts, we explicitly avoid such * cases for safety. */ if (do_update && router && !ip6_forwarding && nd6_accepts_rtadv(ndi)) - defrouter_select(); + nd6_defrouter_select(); } static void Index: src/sys/netinet6/nd6.h diff -u src/sys/netinet6/nd6.h:1.75 src/sys/netinet6/nd6.h:1.76 --- src/sys/netinet6/nd6.h:1.75 Sun Dec 11 07:37:53 2016 +++ src/sys/netinet6/nd6.h Sun Dec 11 07:38:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.h,v 1.75 2016/12/11 07:37:53 ozaki-r Exp $ */ +/* $NetBSD: nd6.h,v 1.76 2016/12/11 07:38:50 ozaki-r Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -433,13 +433,13 @@ void nd6_dad_duplicated(struct ifaddr *) /* nd6_rtr.c */ void nd6_rs_input(struct mbuf *, int, int); void nd6_ra_input(struct mbuf *, int, int); -void defrouter_reset(void); -void defrouter_select(void); -void defrtrlist_del(struct nd_defrouter *, struct in6_ifextra *); -void prelist_remove(struct nd_prefix *); -void pfxlist_onlink_check(void); -struct nd_defrouter *defrouter_lookup(const struct in6_addr *, struct ifnet *); -void rt6_flush(struct in6_addr *, struct ifnet *); +void nd6_defrouter_reset(void); +void nd6_defrouter_select(void); +void nd6_defrtrlist_del(struct nd_defrouter *, struct in6_ifextra *); +void nd6_prelist_remove(struct nd_prefix *); +void nd6_pfxlist_onlink_check(void); +struct nd_defrouter *nd6_defrouter_lookup(const struct in6_addr *, struct ifnet *); +void nd6_rt_flush(struct in6_addr *, struct ifnet *); int in6_tmpifadd(const struct in6_ifaddr *, int, int); bool nd6_accepts_rtadv(const struct nd_ifinfo *); Index: src/sys/netinet6/nd6_nbr.c diff -u src/sys/netinet6/nd6_nbr.c:1.130 src/sys/netinet6/nd6_nbr.c:1.131 --- src/sys/netinet6/nd6_nbr.c:1.130 Tue Nov 15 21:17:07 2016 +++ src/sys/netinet6/nd6_nbr.c Sun Dec 11 07:38:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.130 2016/11/15 21:17:07 mlelstv Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.131 2016/12/11 07:38:50 ozaki-r 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.130 2016/11/15 21:17:07 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.131 2016/12/11 07:38:50 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -819,18 +819,18 @@ nd6_na_input(struct mbuf *m, int off, in * context. However, we keep it just for safety. */ s = splsoftnet(); - dr = defrouter_lookup(in6, ln->lle_tbl->llt_ifp); + dr = nd6_defrouter_lookup(in6, ln->lle_tbl->llt_ifp); if (dr) - defrtrlist_del(dr, NULL); + nd6_defrtrlist_del(dr, NULL); else if (!ip6_forwarding) { /* * Even if the neighbor is not in the default * router list, the neighbor may be used * as a next hop for some destinations * (e.g. redirect case). So we must - * call rt6_flush explicitly. + * call nd6_rt_flush explicitly. */ - rt6_flush(&ip6->ip6_src, ln->lle_tbl->llt_ifp); + nd6_rt_flush(&ip6->ip6_src, ln->lle_tbl->llt_ifp); } splx(s); } @@ -853,7 +853,7 @@ nd6_na_input(struct mbuf *m, int off, in LLE_WUNLOCK(ln); if (checklink) - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); m_put_rcvif_psref(ifp, &psref); m_freem(m); Index: src/sys/netinet6/nd6_rtr.c diff -u src/sys/netinet6/nd6_rtr.c:1.122 src/sys/netinet6/nd6_rtr.c:1.123 --- src/sys/netinet6/nd6_rtr.c:1.122 Sun Dec 11 07:37:53 2016 +++ src/sys/netinet6/nd6_rtr.c Sun Dec 11 07:38:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.122 2016/12/11 07:37:53 ozaki-r Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.123 2016/12/11 07:38:50 ozaki-r 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.122 2016/12/11 07:37:53 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.123 2016/12/11 07:38:50 ozaki-r Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -432,7 +432,7 @@ nd6_ra_input(struct mbuf *m, int off, in * router's neighbor cache, which might also affect our on-link * detection of adveritsed prefixes. */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); } freeit: @@ -483,7 +483,7 @@ defrouter_addreq(struct nd_defrouter *ne } struct nd_defrouter * -defrouter_lookup(const struct in6_addr *addr, struct ifnet *ifp) +nd6_defrouter_lookup(const struct in6_addr *addr, struct ifnet *ifp) { struct nd_defrouter *dr; @@ -496,7 +496,7 @@ defrouter_lookup(const struct in6_addr * } void -defrtrlist_del(struct nd_defrouter *dr, struct in6_ifextra *ext) +nd6_defrtrlist_del(struct nd_defrouter *dr, struct in6_ifextra *ext) { struct nd_defrouter *deldr = NULL; struct nd_prefix *pr; @@ -517,7 +517,7 @@ defrtrlist_del(struct nd_defrouter *dr, */ /* XXX: better condition? */ if (!ip6_forwarding && nd6_accepts_rtadv(ndi)) - rt6_flush(&dr->rtaddr, dr->ifp); + nd6_rt_flush(&dr->rtaddr, dr->ifp); if (dr->installed) { deldr = dr; @@ -533,19 +533,19 @@ defrtrlist_del(struct nd_defrouter *dr, if ((pfxrtr = pfxrtr_lookup(pr, dr)) != NULL) pfxrtr_del(pfxrtr); } - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); /* * If the router is the primary one, choose a new one. - * Note that defrouter_select() will remove the current gateway + * Note that nd6_defrouter_select() will remove the current gateway * from the routing table. */ if (deldr) - defrouter_select(); + nd6_defrouter_select(); ext->ndefrouters--; if (ext->ndefrouters < 0) { - log(LOG_WARNING, "defrtrlist_del: negative count on %s\n", + log(LOG_WARNING, "nd6_defrtrlist_del: negative count on %s\n", dr->ifp->if_xname); } @@ -554,7 +554,7 @@ defrtrlist_del(struct nd_defrouter *dr, /* * Remove the default route for a given router. - * This is just a subroutine function for defrouter_select(), and should + * This is just a subroutine function for nd6_defrouter_select(), and should * not be called from anywhere else. */ static void @@ -595,7 +595,7 @@ defrouter_delreq(struct nd_defrouter *dr * remove all default routes from default router list */ void -defrouter_reset(void) +nd6_defrouter_reset(void) { struct nd_defrouter *dr; @@ -631,7 +631,7 @@ defrouter_reset(void) * complicated and the possibility of introducing bugs. */ void -defrouter_select(void) +nd6_defrouter_select(void) { struct nd_ifinfo *ndi; int s = splsoftnet(); @@ -678,7 +678,7 @@ defrouter_select(void) installed_dr = dr; else if (dr->installed && installed_dr) { /* this should not happen. warn for diagnosis. */ - log(LOG_ERR, "defrouter_select: more than one router" + log(LOG_ERR, "nd6_defrouter_select: more than one router" " is installed\n"); } } @@ -750,10 +750,10 @@ defrtrlist_update(struct nd_defrouter *n struct in6_ifextra *ext = newdr->ifp->if_afdata[AF_INET6]; int s = splsoftnet(); - if ((dr = defrouter_lookup(&newdr->rtaddr, newdr->ifp)) != NULL) { + if ((dr = nd6_defrouter_lookup(&newdr->rtaddr, newdr->ifp)) != NULL) { /* entry exists */ if (newdr->rtlifetime == 0) { - defrtrlist_del(dr, ext); + nd6_defrtrlist_del(dr, ext); dr = NULL; } else { int oldpref = rtpref(dr); @@ -776,9 +776,9 @@ defrtrlist_update(struct nd_defrouter *n * preferred router may be changed, so relocate * this router. * XXX: calling TAILQ_REMOVE directly is a bad manner. - * However, since defrtrlist_del() has many side + * However, since nd6_defrtrlist_del() has many side * effects, we intentionally do so here. - * defrouter_select() below will handle routing + * nd6_defrouter_select() below will handle routing * changes later. */ TAILQ_REMOVE(&nd_defrouter, dr, dr_entry); @@ -834,7 +834,7 @@ insert: else TAILQ_INSERT_TAIL(&nd_defrouter, n, dr_entry); - defrouter_select(); + nd6_defrouter_select(); ext->ndefrouters++; @@ -868,7 +868,7 @@ pfxrtr_add(struct nd_prefix *pr, struct LIST_INSERT_HEAD(&pr->ndpr_advrtrs, newpfr, pfr_entry); - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); } static void @@ -936,7 +936,7 @@ purge_detached(struct ifnet *ifp) pserialize_read_exit(s); if (pr->ndpr_refcnt == 0) - prelist_remove(pr); + nd6_prelist_remove(pr); } } @@ -1010,7 +1010,7 @@ nd6_prelist_add(struct nd_prefixctl *prc } void -prelist_remove(struct nd_prefix *pr) +nd6_prelist_remove(struct nd_prefix *pr) { struct nd_pfxrouter *pfr, *next; int e, s; @@ -1053,7 +1053,7 @@ prelist_remove(struct nd_prefix *pr) if (ext) { ext->nprefixes--; if (ext->nprefixes < 0) { - log(LOG_WARNING, "prelist_remove: negative count on " + log(LOG_WARNING, "nd6_prelist_remove: negative count on " "%s\n", pr->ndpr_ifp->if_xname); } } @@ -1061,7 +1061,7 @@ prelist_remove(struct nd_prefix *pr) free(pr, M_IP6NDP); - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); } static int @@ -1397,7 +1397,7 @@ prelist_update(struct nd_prefixctl *newp * of other addresses, so we check and update it. * XXX: what if address duplication happens? */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); } else { /* just set an error. do not bark here. */ error = EADDRNOTAVAIL; /* XXX: might be unused. */ @@ -1444,7 +1444,7 @@ find_pfxlist_reachable_router(struct nd_ * is no router around us. */ void -pfxlist_onlink_check(void) +nd6_pfxlist_onlink_check(void) { struct nd_prefix *pr; struct in6_ifaddr *ia; @@ -2101,7 +2101,7 @@ in6_tmpifadd( * and, in fact, we surely need the check when we create a new * temporary address due to deprecation of an old temporary address. */ - pfxlist_onlink_check(); + nd6_pfxlist_onlink_check(); return (0); } @@ -2158,7 +2158,7 @@ in6_init_address_ltimes(struct nd_prefix * it shouldn't be called when acting as a router. */ void -rt6_flush(struct in6_addr *gateway, struct ifnet *ifp) +nd6_rt_flush(struct in6_addr *gateway, struct ifnet *ifp) { int s = splsoftnet();