Module Name: src Committed By: matt Date: Fri Sep 5 06:08:15 UTC 2014
Modified Files: src/sys/netinet6: in6.c in6_ifattach.c in6_src.c nd6.h nd6_rtr.c Log Message: Don't use C++ keyword as variable. Use different prefix for nd6_prefixctl members than for nd6_prefix members. To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/netinet6/in6.c cvs rdiff -u -r1.91 -r1.92 src/sys/netinet6/in6_ifattach.c cvs rdiff -u -r1.54 -r1.55 src/sys/netinet6/in6_src.c cvs rdiff -u -r1.59 -r1.60 src/sys/netinet6/nd6.h cvs rdiff -u -r1.93 -r1.94 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.174 src/sys/netinet6/in6.c:1.175 --- src/sys/netinet6/in6.c:1.174 Tue Jul 1 23:01:54 2014 +++ src/sys/netinet6/in6.c Fri Sep 5 06:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: in6.c,v 1.174 2014/07/01 23:01:54 justin Exp $ */ +/* $NetBSD: in6.c,v 1.175 2014/09/05 06:08:15 matt 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.174 2014/07/01 23:01:54 justin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.175 2014/09/05 06:08:15 matt Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -643,7 +643,7 @@ in6_control1(struct socket *so, u_long c case SIOCAIFADDR_IN6: { int i; - struct nd_prefixctl pr0; + struct nd_prefixctl prc0; struct nd_prefix *pr; /* reject read-only flags */ @@ -679,17 +679,17 @@ in6_control1(struct socket *so, u_long c * convert mask to prefix length (prefixmask has already * been validated in in6_update_ifa(). */ - memset(&pr0, 0, sizeof(pr0)); - pr0.ndpr_ifp = ifp; - pr0.ndpr_plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, + memset(&prc0, 0, sizeof(prc0)); + prc0.ndprc_ifp = ifp; + prc0.ndprc_plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, NULL); - if (pr0.ndpr_plen == 128) { + if (prc0.ndprc_plen == 128) { break; /* we don't need to install a host route. */ } - pr0.ndpr_prefix = ifra->ifra_addr; + prc0.ndprc_prefix = ifra->ifra_addr; /* apply the mask for safety. */ for (i = 0; i < 4; i++) { - pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= + prc0.ndprc_prefix.sin6_addr.s6_addr32[i] &= ifra->ifra_prefixmask.sin6_addr.s6_addr32[i]; } /* @@ -699,19 +699,19 @@ in6_control1(struct socket *so, u_long c * later advertised RAs (when accept_rtadv is non 0), which is * an intended behavior. */ - pr0.ndpr_raf_onlink = 1; /* should be configurable? */ - pr0.ndpr_raf_auto = + prc0.ndprc_raf_onlink = 1; /* should be configurable? */ + prc0.ndprc_raf_auto = ((ifra->ifra_flags & IN6_IFF_AUTOCONF) != 0); - pr0.ndpr_vltime = ifra->ifra_lifetime.ia6t_vltime; - pr0.ndpr_pltime = ifra->ifra_lifetime.ia6t_pltime; + prc0.ndprc_vltime = ifra->ifra_lifetime.ia6t_vltime; + prc0.ndprc_pltime = ifra->ifra_lifetime.ia6t_pltime; /* add the prefix if not yet. */ - if ((pr = nd6_prefix_lookup(&pr0)) == NULL) { + if ((pr = nd6_prefix_lookup(&prc0)) == NULL) { /* * nd6_prelist_add will install the corresponding * interface route. */ - if ((error = nd6_prelist_add(&pr0, NULL, &pr)) != 0) + if ((error = nd6_prelist_add(&prc0, NULL, &pr)) != 0) return error; if (pr == NULL) { log(LOG_ERR, "nd6_prelist_add succeeded but " Index: src/sys/netinet6/in6_ifattach.c diff -u src/sys/netinet6/in6_ifattach.c:1.91 src/sys/netinet6/in6_ifattach.c:1.92 --- src/sys/netinet6/in6_ifattach.c:1.91 Thu Jun 5 16:06:49 2014 +++ src/sys/netinet6/in6_ifattach.c Fri Sep 5 06:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_ifattach.c,v 1.91 2014/06/05 16:06:49 roy Exp $ */ +/* $NetBSD: in6_ifattach.c,v 1.92 2014/09/05 06:08:15 matt Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.91 2014/06/05 16:06:49 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.92 2014/09/05 06:08:15 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -529,7 +529,7 @@ in6_ifattach_linklocal(struct ifnet *ifp { struct in6_ifaddr *ia __diagused; struct in6_aliasreq ifra; - struct nd_prefixctl pr0; + struct nd_prefixctl prc0; int i, error; /* @@ -597,24 +597,24 @@ in6_ifattach_linklocal(struct ifnet *ifp * and add it to the prefix list as a never-expire prefix. * XXX: this change might affect some existing code base... */ - memset(&pr0, 0, sizeof(pr0)); - pr0.ndpr_ifp = ifp; + memset(&prc0, 0, sizeof(prc0)); + prc0.ndprc_ifp = ifp; /* this should be 64 at this moment. */ - pr0.ndpr_plen = in6_mask2len(&ifra.ifra_prefixmask.sin6_addr, NULL); - pr0.ndpr_prefix = ifra.ifra_addr; + prc0.ndprc_plen = in6_mask2len(&ifra.ifra_prefixmask.sin6_addr, NULL); + prc0.ndprc_prefix = ifra.ifra_addr; /* apply the mask for safety. (nd6_prelist_add will apply it again) */ for (i = 0; i < 4; i++) { - pr0.ndpr_prefix.sin6_addr.s6_addr32[i] &= + prc0.ndprc_prefix.sin6_addr.s6_addr32[i] &= in6mask64.s6_addr32[i]; } /* * Initialize parameters. The link-local prefix must always be * on-link, and its lifetimes never expire. */ - pr0.ndpr_raf_onlink = 1; - pr0.ndpr_raf_auto = 1; /* probably meaningless */ - pr0.ndpr_vltime = ND6_INFINITE_LIFETIME; - pr0.ndpr_pltime = ND6_INFINITE_LIFETIME; + prc0.ndprc_raf_onlink = 1; + prc0.ndprc_raf_auto = 1; /* probably meaningless */ + prc0.ndprc_vltime = ND6_INFINITE_LIFETIME; + prc0.ndprc_pltime = ND6_INFINITE_LIFETIME; /* * Since there is no other link-local addresses, nd6_prefix_lookup() * probably returns NULL. However, we cannot always expect the result. @@ -622,8 +622,8 @@ in6_ifattach_linklocal(struct ifnet *ifp * address, and then reconfigure another one, the prefix is still * valid with referring to the old link-local address. */ - if (nd6_prefix_lookup(&pr0) == NULL) { - if ((error = nd6_prelist_add(&pr0, NULL, NULL)) != 0) + if (nd6_prefix_lookup(&prc0) == NULL) { + if ((error = nd6_prelist_add(&prc0, NULL, NULL)) != 0) return error; } Index: src/sys/netinet6/in6_src.c diff -u src/sys/netinet6/in6_src.c:1.54 src/sys/netinet6/in6_src.c:1.55 --- src/sys/netinet6/in6_src.c:1.54 Sat May 17 21:26:20 2014 +++ src/sys/netinet6/in6_src.c Fri Sep 5 06:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: in6_src.c,v 1.54 2014/05/17 21:26:20 rmind Exp $ */ +/* $NetBSD: in6_src.c,v 1.55 2014/09/05 06:08:15 matt Exp $ */ /* $KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $ */ /* @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.54 2014/05/17 21:26:20 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.55 2014/09/05 06:08:15 matt Exp $"); #include "opt_inet.h" @@ -970,11 +970,10 @@ init_policy_queue(void) static int add_addrsel_policyent(struct in6_addrpolicy *newpolicy) { - struct addrsel_policyent *new, *pol; + struct addrsel_policyent *newpol, *pol; /* duplication check */ - for (pol = TAILQ_FIRST(&addrsel_policytab); pol; - pol = TAILQ_NEXT(pol, ape_entry)) { + TAILQ_FOREACH(pol, &addrsel_policytab, ape_entry) { if (IN6_ARE_ADDR_EQUAL(&newpolicy->addr.sin6_addr, &pol->ape_policy.addr.sin6_addr) && IN6_ARE_ADDR_EQUAL(&newpolicy->addrmask.sin6_addr, @@ -983,12 +982,12 @@ add_addrsel_policyent(struct in6_addrpol } } - new = malloc(sizeof(*new), M_IFADDR, M_WAITOK|M_ZERO); + newpol = malloc(sizeof(*newpol), M_IFADDR, M_WAITOK|M_ZERO); /* XXX: should validate entry */ - new->ape_policy = *newpolicy; + newpol->ape_policy = *newpolicy; - TAILQ_INSERT_TAIL(&addrsel_policytab, new, ape_entry); + TAILQ_INSERT_TAIL(&addrsel_policytab, newpol, ape_entry); return (0); } Index: src/sys/netinet6/nd6.h diff -u src/sys/netinet6/nd6.h:1.59 src/sys/netinet6/nd6.h:1.60 --- src/sys/netinet6/nd6.h:1.59 Thu Jun 5 16:06:49 2014 +++ src/sys/netinet6/nd6.h Fri Sep 5 06:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6.h,v 1.59 2014/06/05 16:06:49 roy Exp $ */ +/* $NetBSD: nd6.h,v 1.60 2014/09/05 06:08:15 matt Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -272,18 +272,23 @@ struct nd_defrouter { }; struct nd_prefixctl { - struct ifnet *ndpr_ifp; + struct ifnet *ndprc_ifp; /* prefix */ - struct sockaddr_in6 ndpr_prefix; - u_char ndpr_plen; + struct sockaddr_in6 ndprc_prefix; + u_char ndprc_plen; - u_int32_t ndpr_vltime; /* advertised valid lifetime */ - u_int32_t ndpr_pltime; /* advertised preferred lifetime */ + u_int32_t ndprc_vltime; /* advertised valid lifetime */ + u_int32_t ndprc_pltime; /* advertised preferred lifetime */ - struct prf_ra ndpr_flags; + struct prf_ra ndprc_flags; }; +#define ndprc_raf ndprc_flags +#define ndprc_raf_onlink ndprc_flags.onlink +#define ndprc_raf_auto ndprc_flags.autonomous +#define ndprc_raf_router ndprc_flags.router + struct nd_prefix { struct ifnet *ndpr_ifp; LIST_ENTRY(nd_prefix) ndpr_entry; Index: src/sys/netinet6/nd6_rtr.c diff -u src/sys/netinet6/nd6_rtr.c:1.93 src/sys/netinet6/nd6_rtr.c:1.94 --- src/sys/netinet6/nd6_rtr.c:1.93 Thu Jul 31 06:35:47 2014 +++ src/sys/netinet6/nd6_rtr.c Fri Sep 5 06:08:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_rtr.c,v 1.93 2014/07/31 06:35:47 ozaki-r Exp $ */ +/* $NetBSD: nd6_rtr.c,v 1.94 2014/09/05 06:08:15 matt 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.93 2014/07/31 06:35:47 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.94 2014/09/05 06:08:15 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -284,7 +284,7 @@ nd6_ra_input(struct mbuf *m, int off, in if (ndopts.nd_opts_pi) { struct nd_opt_hdr *pt; struct nd_opt_prefix_info *pi = NULL; - struct nd_prefixctl pr; + struct nd_prefixctl prc; for (pt = (struct nd_opt_hdr *)ndopts.nd_opts_pi; pt <= (struct nd_opt_hdr *)ndopts.nd_opts_pi_end; @@ -319,20 +319,20 @@ nd6_ra_input(struct mbuf *m, int off, in continue; } - memset(&pr, 0, sizeof(pr)); - sockaddr_in6_init(&pr.ndpr_prefix, + memset(&prc, 0, sizeof(prc)); + sockaddr_in6_init(&prc.ndprc_prefix, &pi->nd_opt_pi_prefix, 0, 0, 0); - pr.ndpr_ifp = (struct ifnet *)m->m_pkthdr.rcvif; + prc.ndprc_ifp = (struct ifnet *)m->m_pkthdr.rcvif; - pr.ndpr_raf_onlink = (pi->nd_opt_pi_flags_reserved & + prc.ndprc_raf_onlink = (pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_ONLINK) ? 1 : 0; - pr.ndpr_raf_auto = (pi->nd_opt_pi_flags_reserved & + prc.ndprc_raf_auto = (pi->nd_opt_pi_flags_reserved & ND_OPT_PI_FLAG_AUTO) ? 1 : 0; - pr.ndpr_plen = pi->nd_opt_pi_prefix_len; - pr.ndpr_vltime = ntohl(pi->nd_opt_pi_valid_time); - pr.ndpr_pltime = ntohl(pi->nd_opt_pi_preferred_time); + prc.ndprc_plen = pi->nd_opt_pi_prefix_len; + prc.ndprc_vltime = ntohl(pi->nd_opt_pi_valid_time); + prc.ndprc_pltime = ntohl(pi->nd_opt_pi_preferred_time); - (void)prelist_update(&pr, dr, m, mcast); + (void)prelist_update(&prc, dr, m, mcast); } } @@ -434,7 +434,7 @@ nd6_rtmsg(int cmd, struct rtentry *rt) } void -defrouter_addreq(struct nd_defrouter *new) +defrouter_addreq(struct nd_defrouter *newdr) { union { struct sockaddr_in6 sin6; @@ -451,7 +451,7 @@ defrouter_addreq(struct nd_defrouter *ne def.sin6.sin6_len = mask.sin6.sin6_len = gate.sin6.sin6_len = sizeof(struct sockaddr_in6); def.sin6.sin6_family = mask.sin6.sin6_family = gate.sin6.sin6_family = AF_INET6; - gate.sin6.sin6_addr = new->rtaddr; + gate.sin6.sin6_addr = newdr->rtaddr; #ifndef SCOPEDROUTING gate.sin6.sin6_scope_id = 0; /* XXX */ #endif @@ -465,7 +465,7 @@ defrouter_addreq(struct nd_defrouter *ne nd6_numroutes++; } if (error == 0) - new->installed = 1; + newdr->installed = 1; splx(s); return; } @@ -741,30 +741,30 @@ rtpref(struct nd_defrouter *dr) } static struct nd_defrouter * -defrtrlist_update(struct nd_defrouter *new) +defrtrlist_update(struct nd_defrouter *newdr) { struct nd_defrouter *dr, *n; - struct in6_ifextra *ext = new->ifp->if_afdata[AF_INET6]; + struct in6_ifextra *ext = newdr->ifp->if_afdata[AF_INET6]; int s = splsoftnet(); - if ((dr = defrouter_lookup(&new->rtaddr, new->ifp)) != NULL) { + if ((dr = defrouter_lookup(&newdr->rtaddr, newdr->ifp)) != NULL) { /* entry exists */ - if (new->rtlifetime == 0) { + if (newdr->rtlifetime == 0) { defrtrlist_del(dr); dr = NULL; } else { int oldpref = rtpref(dr); /* override */ - dr->flags = new->flags; /* xxx flag check */ - dr->rtlifetime = new->rtlifetime; - dr->expire = new->expire; + dr->flags = newdr->flags; /* xxx flag check */ + dr->rtlifetime = newdr->rtlifetime; + dr->expire = newdr->expire; /* * If the preference does not change, there's no need * to sort the entries. */ - if (rtpref(new) == oldpref) { + if (rtpref(newdr) == oldpref) { splx(s); return (dr); } @@ -793,7 +793,7 @@ defrtrlist_update(struct nd_defrouter *n } /* entry does not exist */ - if (new->rtlifetime == 0) { + if (newdr->rtlifetime == 0) { splx(s); return (NULL); } @@ -810,7 +810,7 @@ defrtrlist_update(struct nd_defrouter *n return (NULL); } memset(n, 0, sizeof(*n)); - *n = *new; + *n = *newdr; insert: /* @@ -856,14 +856,14 @@ pfxrtr_lookup(struct nd_prefix *pr, stru static void pfxrtr_add(struct nd_prefix *pr, struct nd_defrouter *dr) { - struct nd_pfxrouter *new; + struct nd_pfxrouter *newpfr; - new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT|M_ZERO); - if (new == NULL) + newpfr = malloc(sizeof(*newpfr), M_IP6NDP, M_NOWAIT|M_ZERO); + if (newpfr == NULL) return; - new->router = dr; + newpfr->router = dr; - LIST_INSERT_HEAD(&pr->ndpr_advrtrs, new, pfr_entry); + LIST_INSERT_HEAD(&pr->ndpr_advrtrs, newpfr, pfr_entry); pfxlist_onlink_check(); } @@ -881,10 +881,10 @@ nd6_prefix_lookup(struct nd_prefixctl *k struct nd_prefix *search; LIST_FOREACH(search, &nd_prefix, ndpr_entry) { - if (key->ndpr_ifp == search->ndpr_ifp && - key->ndpr_plen == search->ndpr_plen && - in6_are_prefix_equal(&key->ndpr_prefix.sin6_addr, - &search->ndpr_prefix.sin6_addr, key->ndpr_plen)) { + if (key->ndprc_ifp == search->ndpr_ifp && + key->ndprc_plen == search->ndpr_plen && + in6_are_prefix_equal(&key->ndprc_prefix.sin6_addr, + &search->ndpr_prefix.sin6_addr, key->ndprc_plen)) { break; } } @@ -929,67 +929,68 @@ purge_detached(struct ifnet *ifp) } } int -nd6_prelist_add(struct nd_prefixctl *pr, struct nd_defrouter *dr, +nd6_prelist_add(struct nd_prefixctl *prc, struct nd_defrouter *dr, struct nd_prefix **newp) { - struct nd_prefix *new = NULL; + struct nd_prefix *newpr = NULL; int i, s; int error; - struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6]; + struct in6_ifextra *ext = prc->ndprc_ifp->if_afdata[AF_INET6]; if (ip6_maxifprefixes >= 0) { if (ext->nprefixes >= ip6_maxifprefixes / 2) - purge_detached(pr->ndpr_ifp); + purge_detached(prc->ndprc_ifp); if (ext->nprefixes >= ip6_maxifprefixes) return ENOMEM; } error = 0; - new = malloc(sizeof(*new), M_IP6NDP, M_NOWAIT|M_ZERO); - if (new == NULL) + newpr = malloc(sizeof(*newpr), M_IP6NDP, M_NOWAIT|M_ZERO); + if (newpr == NULL) return ENOMEM; - new->ndpr_ifp = pr->ndpr_ifp; - new->ndpr_prefix = pr->ndpr_prefix; - new->ndpr_plen = pr->ndpr_plen; - new->ndpr_vltime = pr->ndpr_vltime; - new->ndpr_pltime = pr->ndpr_pltime; - new->ndpr_flags = pr->ndpr_flags; - if ((error = in6_init_prefix_ltimes(new)) != 0) { - free(new, M_IP6NDP); + newpr->ndpr_ifp = prc->ndprc_ifp; + newpr->ndpr_prefix = prc->ndprc_prefix; + newpr->ndpr_plen = prc->ndprc_plen; + newpr->ndpr_vltime = prc->ndprc_vltime; + newpr->ndpr_pltime = prc->ndprc_pltime; + newpr->ndpr_flags = prc->ndprc_flags; + if ((error = in6_init_prefix_ltimes(newpr)) != 0) { + free(newpr, M_IP6NDP); return(error); } - new->ndpr_lastupdate = time_second; + newpr->ndpr_lastupdate = time_second; if (newp != NULL) - *newp = new; + *newp = newpr; /* initialization */ - LIST_INIT(&new->ndpr_advrtrs); - in6_prefixlen2mask(&new->ndpr_mask, new->ndpr_plen); + LIST_INIT(&newpr->ndpr_advrtrs); + in6_prefixlen2mask(&newpr->ndpr_mask, newpr->ndpr_plen); /* make prefix in the canonical form */ - for (i = 0; i < 4; i++) - new->ndpr_prefix.sin6_addr.s6_addr32[i] &= - new->ndpr_mask.s6_addr32[i]; + for (i = 0; i < 4; i++) { + newpr->ndpr_prefix.sin6_addr.s6_addr32[i] &= + newpr->ndpr_mask.s6_addr32[i]; + } s = splsoftnet(); /* link ndpr_entry to nd_prefix list */ - LIST_INSERT_HEAD(&nd_prefix, new, ndpr_entry); + LIST_INSERT_HEAD(&nd_prefix, newpr, ndpr_entry); splx(s); /* ND_OPT_PI_FLAG_ONLINK processing */ - if (new->ndpr_raf_onlink) { + if (newpr->ndpr_raf_onlink) { int e; - if ((e = nd6_prefix_onlink(new)) != 0) { + if ((e = nd6_prefix_onlink(newpr)) != 0) { nd6log((LOG_ERR, "nd6_prelist_add: failed to make " "the prefix %s/%d on-link on %s (errno=%d)\n", - ip6_sprintf(&pr->ndpr_prefix.sin6_addr), - pr->ndpr_plen, if_name(pr->ndpr_ifp), e)); + ip6_sprintf(&prc->ndprc_prefix.sin6_addr), + prc->ndprc_plen, if_name(prc->ndprc_ifp), e)); /* proceed anyway. XXX: is it correct? */ } } if (dr) - pfxrtr_add(new, dr); + pfxrtr_add(newpr, dr); ext->nprefixes++; @@ -1052,14 +1053,14 @@ prelist_remove(struct nd_prefix *pr) } static int -prelist_update(struct nd_prefixctl *new, +prelist_update(struct nd_prefixctl *newprc, struct nd_defrouter *dr, /* may be NULL */ struct mbuf *m, int mcast) { struct in6_ifaddr *ia6 = NULL, *ia6_match = NULL; struct ifaddr *ifa; - struct ifnet *ifp = new->ndpr_ifp; + struct ifnet *ifp = newprc->ndprc_ifp; struct nd_prefix *pr; int s = splsoftnet(); int error = 0; @@ -1078,9 +1079,9 @@ prelist_update(struct nd_prefixctl *new, #endif } - if ((pr = nd6_prefix_lookup(new)) != NULL) { + if ((pr = nd6_prefix_lookup(newprc)) != NULL) { /* - * nd6_prefix_lookup() ensures that pr and new have the same + * nd6_prefix_lookup() ensures that pr and newprc have the same * prefix on a same interface. */ @@ -1089,18 +1090,18 @@ prelist_update(struct nd_prefixctl *new, * and the autonomous (A) bit should NOT be changed from 1 * to 0. */ - if (new->ndpr_raf_onlink == 1) + if (newprc->ndprc_raf_onlink == 1) pr->ndpr_raf_onlink = 1; - if (new->ndpr_raf_auto == 1) + if (newprc->ndprc_raf_auto == 1) pr->ndpr_raf_auto = 1; - if (new->ndpr_raf_onlink) { - pr->ndpr_vltime = new->ndpr_vltime; - pr->ndpr_pltime = new->ndpr_pltime; + if (newprc->ndprc_raf_onlink) { + pr->ndpr_vltime = newprc->ndprc_vltime; + pr->ndpr_pltime = newprc->ndprc_pltime; (void)in6_init_prefix_ltimes(pr); /* XXX error case? */ pr->ndpr_lastupdate = time_second; } - if (new->ndpr_raf_onlink && + if (newprc->ndprc_raf_onlink && (pr->ndpr_stateflags & NDPRF_ONLINK) == 0) { int e; @@ -1120,9 +1121,9 @@ prelist_update(struct nd_prefixctl *new, } else { struct nd_prefix *newpr = NULL; - if (new->ndpr_vltime == 0) + if (newprc->ndprc_vltime == 0) goto end; - if (new->ndpr_raf_onlink == 0 && new->ndpr_raf_auto == 0) + if (newprc->ndprc_raf_onlink == 0 && newprc->ndprc_raf_auto == 0) goto end; if (ip6_rtadv_maxroutes <= nd6_numroutes) { @@ -1130,13 +1131,13 @@ prelist_update(struct nd_prefixctl *new, goto end; } - error = nd6_prelist_add(new, dr, &newpr); + error = nd6_prelist_add(newprc, dr, &newpr); if (error != 0 || newpr == NULL) { nd6log((LOG_NOTICE, "prelist_update: " "nd6_prelist_add failed for %s/%d on %s " "errno=%d, returnpr=%p\n", - ip6_sprintf(&new->ndpr_prefix.sin6_addr), - new->ndpr_plen, if_name(new->ndpr_ifp), + ip6_sprintf(&newprc->ndprc_prefix.sin6_addr), + newprc->ndprc_plen, if_name(newprc->ndprc_ifp), error, newpr)); goto end; /* we should just give up in this case. */ } @@ -1163,7 +1164,7 @@ prelist_update(struct nd_prefixctl *new, */ /* 5.5.3 (a). Ignore the prefix without the A bit set. */ - if (!new->ndpr_raf_auto) + if (!newprc->ndprc_raf_auto) goto end; /* @@ -1172,7 +1173,7 @@ prelist_update(struct nd_prefixctl *new, */ /* 5.5.3 (c). Consistency check on lifetimes: pltime <= vltime. */ - if (new->ndpr_pltime > new->ndpr_vltime) { + if (newprc->ndprc_pltime > newprc->ndprc_vltime) { error = EINVAL; /* XXX: won't be used */ goto end; } @@ -1249,22 +1250,22 @@ prelist_update(struct nd_prefixctl *new, /* when not updating, keep the current stored lifetime. */ lt6_tmp.ia6t_vltime = remaininglifetime; - if (TWOHOUR < new->ndpr_vltime || - remaininglifetime < new->ndpr_vltime) { - lt6_tmp.ia6t_vltime = new->ndpr_vltime; + if (TWOHOUR < newprc->ndprc_vltime || + remaininglifetime < newprc->ndprc_vltime) { + lt6_tmp.ia6t_vltime = newprc->ndprc_vltime; } else if (remaininglifetime <= TWOHOUR) { if (auth) - lt6_tmp.ia6t_vltime = new->ndpr_vltime; + lt6_tmp.ia6t_vltime = newprc->ndprc_vltime; } else { /* - * new->ndpr_vltime <= TWOHOUR && + * newprc->ndprc_vltime <= TWOHOUR && * TWOHOUR < remaininglifetime */ lt6_tmp.ia6t_vltime = TWOHOUR; } /* The 2 hour rule is not imposed for preferred lifetime. */ - lt6_tmp.ia6t_pltime = new->ndpr_pltime; + lt6_tmp.ia6t_pltime = newprc->ndprc_pltime; in6_init_address_ltimes(pr, <6_tmp); @@ -1308,7 +1309,7 @@ prelist_update(struct nd_prefixctl *new, ifa6->ia6_lifetime = lt6_tmp; ifa6->ia6_updatetime = time_second; } - if (ia6_match == NULL && new->ndpr_vltime) { + if (ia6_match == NULL && newprc->ndprc_vltime) { int ifidlen; /* @@ -1340,9 +1341,9 @@ prelist_update(struct nd_prefixctl *new, goto end; } - if ((ia6 = in6_ifadd(new, mcast)) != NULL) { + if ((ia6 = in6_ifadd(newprc, mcast)) != NULL) { /* - * note that we should use pr (not new) for reference. + * note that we should use pr (not newprc) for reference. */ pr->ndpr_refcnt++; ia6->ia6_ndpr = pr; @@ -1804,15 +1805,15 @@ nd6_prefix_offlink(struct nd_prefix *pr) } static struct in6_ifaddr * -in6_ifadd(struct nd_prefixctl *pr, int mcast) +in6_ifadd(struct nd_prefixctl *prc, int mcast) { - struct ifnet *ifp = pr->ndpr_ifp; + struct ifnet *ifp = prc->ndprc_ifp; struct ifaddr *ifa; struct in6_aliasreq ifra; struct in6_ifaddr *ia, *ib; int error, plen0; struct in6_addr mask; - int prefixlen = pr->ndpr_plen; + int prefixlen = prc->ndprc_plen; int updateflags; in6_prefixlen2mask(&mask, prefixlen); @@ -1868,7 +1869,7 @@ in6_ifadd(struct nd_prefixctl *pr, int m * for safety. */ strncpy(ifra.ifra_name, if_name(ifp), sizeof(ifra.ifra_name)); - sockaddr_in6_init(&ifra.ifra_addr, &pr->ndpr_prefix.sin6_addr, 0, 0, 0); + sockaddr_in6_init(&ifra.ifra_addr, &prc->ndprc_prefix.sin6_addr, 0, 0, 0); /* prefix */ ifra.ifra_addr.sin6_addr.s6_addr32[0] &= mask.s6_addr32[0]; ifra.ifra_addr.sin6_addr.s6_addr32[1] &= mask.s6_addr32[1]; @@ -1889,8 +1890,8 @@ in6_ifadd(struct nd_prefixctl *pr, int m sockaddr_in6_init(&ifra.ifra_prefixmask, &mask, 0, 0, 0); /* lifetimes */ - ifra.ifra_lifetime.ia6t_vltime = pr->ndpr_vltime; - ifra.ifra_lifetime.ia6t_pltime = pr->ndpr_pltime; + ifra.ifra_lifetime.ia6t_vltime = prc->ndprc_vltime; + ifra.ifra_lifetime.ia6t_pltime = prc->ndprc_pltime; /* XXX: scope zone ID? */ @@ -2084,7 +2085,7 @@ in6_init_prefix_ltimes(struct nd_prefix } static void -in6_init_address_ltimes(struct nd_prefix *new, +in6_init_address_ltimes(struct nd_prefix *newpr, struct in6_addrlifetime *lt6) {