Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Don't use C++ keyword as variable.



details:   https://anonhg.NetBSD.org/src/rev/9393f6c71420
branches:  trunk
changeset: 802187:9393f6c71420
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Sep 05 06:08:15 2014 +0000

description:
Don't use C++ keyword as variable.
Use different prefix for nd6_prefixctl members than for nd6_prefix members.

diffstat:

 sys/netinet6/in6.c          |   30 +++---
 sys/netinet6/in6_ifattach.c |   28 +++---
 sys/netinet6/in6_src.c      |   15 +-
 sys/netinet6/nd6.h          |   21 +++-
 sys/netinet6/nd6_rtr.c      |  189 ++++++++++++++++++++++---------------------
 5 files changed, 144 insertions(+), 139 deletions(-)

diffs (truncated from 707 to 300 lines):

diff -r caed16658c09 -r 9393f6c71420 sys/netinet6/in6.c
--- a/sys/netinet6/in6.c        Fri Sep 05 06:06:31 2014 +0000
+++ b/sys/netinet6/in6.c        Fri Sep 05 06:08:15 2014 +0000
@@ -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 @@
        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 @@
                 * 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 @@
                 * 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 "
diff -r caed16658c09 -r 9393f6c71420 sys/netinet6/in6_ifattach.c
--- a/sys/netinet6/in6_ifattach.c       Fri Sep 05 06:06:31 2014 +0000
+++ b/sys/netinet6/in6_ifattach.c       Fri Sep 05 06:08:15 2014 +0000
@@ -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 @@
 {
        struct in6_ifaddr *ia __diagused;
        struct in6_aliasreq ifra;
-       struct nd_prefixctl pr0;
+       struct nd_prefixctl prc0;
        int i, error;
 
        /*
@@ -597,24 +597,24 @@
         * 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 @@
         * 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;
        }
 
diff -r caed16658c09 -r 9393f6c71420 sys/netinet6/in6_src.c
--- a/sys/netinet6/in6_src.c    Fri Sep 05 06:06:31 2014 +0000
+++ b/sys/netinet6/in6_src.c    Fri Sep 05 06:08:15 2014 +0000
@@ -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 @@
 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 @@
                }
        }
 
-       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);
 }
diff -r caed16658c09 -r 9393f6c71420 sys/netinet6/nd6.h
--- a/sys/netinet6/nd6.h        Fri Sep 05 06:06:31 2014 +0000
+++ b/sys/netinet6/nd6.h        Fri Sep 05 06:08:15 2014 +0000
@@ -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,17 +272,22 @@
 };
 
 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 ndprc_vltime; /* advertised valid lifetime */
+       u_int32_t ndprc_pltime; /* advertised preferred lifetime */
 
-       u_int32_t ndpr_vltime;  /* advertised valid lifetime */
-       u_int32_t ndpr_pltime;  /* advertised preferred lifetime */
+       struct prf_ra ndprc_flags;
+};
 
-       struct prf_ra ndpr_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;
diff -r caed16658c09 -r 9393f6c71420 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Fri Sep 05 06:06:31 2014 +0000
+++ b/sys/netinet6/nd6_rtr.c    Fri Sep 05 06:08:15 2014 +0000
@@ -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 @@
        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 @@
                                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 @@
 }
 
 void
-defrouter_addreq(struct nd_defrouter *new)
+defrouter_addreq(struct nd_defrouter *newdr)
 {



Home | Main Index | Thread Index | Old Index