Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet6 Use ia6 or ia instead of ifa as a variable name...



details:   https://anonhg.NetBSD.org/src/rev/7e5b05b8bc61
branches:  trunk
changeset: 346284:7e5b05b8bc61
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Tue Jul 05 03:40:52 2016 +0000

description:
Use ia6 or ia instead of ifa as a variable name of struct in6_ifaddr

We conventionally use ifa for struct ifaddr and use ia6 or ia for
struct in6_ifaddr.

No functional change.

diffstat:

 sys/netinet6/icmp6.c   |  34 +++++++++---------
 sys/netinet6/nd6_rtr.c |  86 +++++++++++++++++++++++++------------------------
 2 files changed, 61 insertions(+), 59 deletions(-)

diffs (truncated from 357 to 300 lines):

diff -r a119bdc37af1 -r 7e5b05b8bc61 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c      Mon Jul 04 23:55:54 2016 +0000
+++ b/sys/netinet6/icmp6.c      Tue Jul 05 03:40:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: icmp6.c,v 1.190 2016/06/28 02:02:56 ozaki-r Exp $      */
+/*     $NetBSD: icmp6.c,v 1.191 2016/07/05 03:40:52 ozaki-r Exp $      */
 /*     $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.190 2016/06/28 02:02:56 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.191 2016/07/05 03:40:52 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1660,7 +1660,7 @@
     struct ifnet **ifpp, char *subj)
 {
        struct ifnet *ifp;
-       struct in6_ifaddr *ifa6;
+       struct in6_ifaddr *ia6;
        struct ifaddr *ifa;
        struct sockaddr_in6 *subj_ip6 = NULL; /* XXX pedant */
        int addrs = 0, addrsofif, iffound = 0;
@@ -1687,11 +1687,11 @@
                IFADDR_FOREACH(ifa, ifp) {
                        if (ifa->ifa_addr->sa_family != AF_INET6)
                                continue;
-                       ifa6 = (struct in6_ifaddr *)ifa;
+                       ia6 = (struct in6_ifaddr *)ifa;
 
                        if ((niflags & NI_NODEADDR_FLAG_ALL) == 0 &&
                            IN6_ARE_ADDR_EQUAL(&subj_ip6->sin6_addr,
-                                              &ifa6->ia_addr.sin6_addr))
+                                              &ia6->ia_addr.sin6_addr))
                                iffound = 1;
 
                        /*
@@ -1705,7 +1705,7 @@
                         */
 
                        /* What do we have to do about ::1? */
-                       switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
+                       switch (in6_addrscope(&ia6->ia_addr.sin6_addr)) {
                        case IPV6_ADDR_SCOPE_LINKLOCAL:
                                if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0)
                                        continue;
@@ -1726,7 +1726,7 @@
                         * check if anycast is okay.
                         * XXX: just experimental.  not in the spec.
                         */
-                       if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
+                       if ((ia6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
                            (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
                                continue; /* we need only unicast addresses */
 
@@ -1749,7 +1749,7 @@
        int resid)
 {
        struct ifnet *ifp = ifp0 ? ifp0 : IFNET_READER_FIRST();
-       struct in6_ifaddr *ifa6;
+       struct in6_ifaddr *ia6;
        struct ifaddr *ifa;
        struct ifnet *ifp_dep = NULL;
        int copied = 0, allow_deprecated = 0;
@@ -1767,9 +1767,9 @@
                IFADDR_FOREACH(ifa, ifp) {
                        if (ifa->ifa_addr->sa_family != AF_INET6)
                                continue;
-                       ifa6 = (struct in6_ifaddr *)ifa;
+                       ia6 = (struct in6_ifaddr *)ifa;
 
-                       if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) != 0 &&
+                       if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) != 0 &&
                            allow_deprecated == 0) {
                                /*
                                 * prefererred address should be put before
@@ -1782,12 +1782,12 @@
 
                                continue;
                        }
-                       else if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) == 0 &&
+                       else if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) == 0 &&
                                 allow_deprecated != 0)
                                continue; /* we now collect deprecated addrs */
 
                        /* What do we have to do about ::1? */
-                       switch (in6_addrscope(&ifa6->ia_addr.sin6_addr)) {
+                       switch (in6_addrscope(&ia6->ia_addr.sin6_addr)) {
                        case IPV6_ADDR_SCOPE_LINKLOCAL:
                                if ((niflags & NI_NODEADDR_FLAG_LINKLOCAL) == 0)
                                        continue;
@@ -1808,7 +1808,7 @@
                         * check if anycast is okay.
                         * XXX: just experimental.  not in the spec.
                         */
-                       if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
+                       if ((ia6->ia6_flags & IN6_IFF_ANYCAST) != 0 &&
                            (niflags & NI_NODEADDR_FLAG_ANYCAST) == 0)
                                continue;
 
@@ -1840,12 +1840,12 @@
                         *
                         * TTL must be 2^31 > TTL >= 0.
                         */
-                       if (ifa6->ia6_lifetime.ia6t_expire == 0)
+                       if (ia6->ia6_lifetime.ia6t_expire == 0)
                                ltime = ND6_INFINITE_LIFETIME;
                        else {
-                               if (ifa6->ia6_lifetime.ia6t_expire >
+                               if (ia6->ia6_lifetime.ia6t_expire >
                                    time_uptime)
-                                       ltime = ifa6->ia6_lifetime.ia6t_expire -
+                                       ltime = ia6->ia6_lifetime.ia6t_expire -
                                            time_uptime;
                                else
                                        ltime = 0;
@@ -1858,7 +1858,7 @@
                        cp += sizeof(u_int32_t);
 
                        /* copy the address itself */
-                       bcopy(&ifa6->ia_addr.sin6_addr, cp,
+                       bcopy(&ia6->ia_addr.sin6_addr, cp,
                              sizeof(struct in6_addr));
                        in6_clearscope((struct in6_addr *)cp); /* XXX */
                        cp += sizeof(struct in6_addr);
diff -r a119bdc37af1 -r 7e5b05b8bc61 sys/netinet6/nd6_rtr.c
--- a/sys/netinet6/nd6_rtr.c    Mon Jul 04 23:55:54 2016 +0000
+++ b/sys/netinet6/nd6_rtr.c    Tue Jul 05 03:40:52 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nd6_rtr.c,v 1.113 2016/07/04 06:48:14 ozaki-r Exp $    */
+/*     $NetBSD: nd6_rtr.c,v 1.114 2016/07/05 03:40:52 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.113 2016/07/04 06:48:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.114 2016/07/05 03:40:52 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1056,7 +1056,7 @@
        struct mbuf *m, 
        int mcast)
 {
-       struct in6_ifaddr *ia6 = NULL, *ia6_match = NULL;
+       struct in6_ifaddr *ia6_match = NULL;
        struct ifaddr *ifa;
        struct ifnet *ifp = newprc->ndprc_ifp;
        struct nd_prefix *pr;
@@ -1187,18 +1187,18 @@
         * "address".
         */
        IFADDR_FOREACH(ifa, ifp) {
-               struct in6_ifaddr *ifa6;
+               struct in6_ifaddr *ia6;
                u_int32_t remaininglifetime;
 
                if (ifa->ifa_addr->sa_family != AF_INET6)
                        continue;
 
-               ifa6 = (struct in6_ifaddr *)ifa;
+               ia6 = (struct in6_ifaddr *)ifa;
 
                /*
                 * We only consider autoconfigured addresses as per rfc2462bis.
                 */
-               if (!(ifa6->ia6_flags & IN6_IFF_AUTOCONF))
+               if (!(ia6->ia6_flags & IN6_IFF_AUTOCONF))
                        continue;
 
                /*
@@ -1206,7 +1206,7 @@
                 * on unicast (i.e. not anycast) addresses.
                 * XXX: other ia6_flags? detached or duplicated?
                 */
-               if ((ifa6->ia6_flags & IN6_IFF_ANYCAST) != 0)
+               if ((ia6->ia6_flags & IN6_IFF_ANYCAST) != 0)
                        continue;
 
                /*
@@ -1214,11 +1214,11 @@
                 * or is associated with a prefix that is different from this
                 * one.  (pr is never NULL here)
                 */
-               if (ifa6->ia6_ndpr != pr)
+               if (ia6->ia6_ndpr != pr)
                        continue;
 
                if (ia6_match == NULL) /* remember the first one */
-                       ia6_match = ifa6;
+                       ia6_match = ia6;
 
                /*
                 * An already autoconfigured address matched.  Now that we
@@ -1231,10 +1231,10 @@
                 * - remove the dead code in the "two-hour" rule
                 */
 #define TWOHOUR                (120*60)
-               lt6_tmp = ifa6->ia6_lifetime;
+               lt6_tmp = ia6->ia6_lifetime;
                if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME)
                        remaininglifetime = ND6_INFINITE_LIFETIME;
-               else if (time_uptime - ifa6->ia6_updatetime >
+               else if (time_uptime - ia6->ia6_updatetime >
                         lt6_tmp.ia6t_vltime) {
                        /*
                         * The case of "invalid" address.  We should usually
@@ -1243,7 +1243,7 @@
                        remaininglifetime = 0;
                } else
                        remaininglifetime = lt6_tmp.ia6t_vltime -
-                           (time_uptime - ifa6->ia6_updatetime);
+                           (time_uptime - ia6->ia6_updatetime);
 
                /* when not updating, keep the current stored lifetime. */
                lt6_tmp.ia6t_vltime = remaininglifetime;
@@ -1274,22 +1274,22 @@
                 * we only update the lifetimes when they are in the maximum
                 * intervals.
                 */
-               if ((ifa6->ia6_flags & IN6_IFF_TEMPORARY) != 0) {
+               if ((ia6->ia6_flags & IN6_IFF_TEMPORARY) != 0) {
                        u_int32_t maxvltime, maxpltime;
 
                        if (ip6_temp_valid_lifetime >
-                           (u_int32_t)((time_uptime - ifa6->ia6_createtime) +
+                           (u_int32_t)((time_uptime - ia6->ia6_createtime) +
                            ip6_desync_factor)) {
                                maxvltime = ip6_temp_valid_lifetime -
-                                   (time_uptime - ifa6->ia6_createtime) -
+                                   (time_uptime - ia6->ia6_createtime) -
                                    ip6_desync_factor;
                        } else
                                maxvltime = 0;
                        if (ip6_temp_preferred_lifetime >
-                           (u_int32_t)((time_uptime - ifa6->ia6_createtime) +
+                           (u_int32_t)((time_uptime - ia6->ia6_createtime) +
                            ip6_desync_factor)) {
                                maxpltime = ip6_temp_preferred_lifetime -
-                                   (time_uptime - ifa6->ia6_createtime) -
+                                   (time_uptime - ia6->ia6_createtime) -
                                    ip6_desync_factor;
                        } else
                                maxpltime = 0;
@@ -1304,11 +1304,12 @@
                        }
                }
 
-               ifa6->ia6_lifetime = lt6_tmp;
-               ifa6->ia6_updatetime = time_uptime;
+               ia6->ia6_lifetime = lt6_tmp;
+               ia6->ia6_updatetime = time_uptime;
        }
        if (ia6_match == NULL && newprc->ndprc_vltime) {
                int ifidlen;
+               struct in6_ifaddr *ia6;
 
                /*
                 * 5.5.3 (d) (continued)
@@ -1421,7 +1422,7 @@
 pfxlist_onlink_check(void)
 {
        struct nd_prefix *pr;
-       struct in6_ifaddr *ifa;
+       struct in6_ifaddr *ia;
        struct nd_defrouter *dr;
        struct nd_pfxrouter *pfxrtr = NULL;
 
@@ -1538,11 +1539,11 @@
         * always be attached.
         * The precise detection logic is same as the one for prefixes.
         */
-       IN6_ADDRLIST_READER_FOREACH(ifa) {
-               if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF))
+       IN6_ADDRLIST_READER_FOREACH(ia) {
+               if (!(ia->ia6_flags & IN6_IFF_AUTOCONF))
                        continue;
 
-               if (ifa->ia6_ndpr == NULL) {
+               if (ia->ia6_ndpr == NULL) {
                        /*
                         * This can happen when we first configure the address
                         * (i.e. the address exists, but the prefix does not).
@@ -1551,46 +1552,47 @@
                        continue;
                }
 
-               if (find_pfxlist_reachable_router(ifa->ia6_ndpr))
+               if (find_pfxlist_reachable_router(ia->ia6_ndpr))
                        break;
        }
-       if (ifa) {
-               IN6_ADDRLIST_READER_FOREACH(ifa) {



Home | Main Index | Thread Index | Old Index