Module Name:    src
Committed By:   ozaki-r
Date:           Tue Jul  5 03:40:52 UTC 2016

Modified Files:
        src/sys/netinet6: icmp6.c nd6_rtr.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.113 -r1.114 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/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.190 src/sys/netinet6/icmp6.c:1.191
--- src/sys/netinet6/icmp6.c:1.190	Tue Jun 28 02:02:56 2016
+++ src/sys/netinet6/icmp6.c	Tue Jul  5 03:40:52 2016
@@ -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 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
     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 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 		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 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 			 */
 
 			/* 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 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, st
 			 * 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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 	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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 		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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 
 				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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 			 * 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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 			 *
 			 * 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 @@ ni6_store_addrs(struct icmp6_nodeinfo *n
 			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);

Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.113 src/sys/netinet6/nd6_rtr.c:1.114
--- src/sys/netinet6/nd6_rtr.c:1.113	Mon Jul  4 06:48:14 2016
+++ src/sys/netinet6/nd6_rtr.c	Tue Jul  5 03:40:52 2016
@@ -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 @@ prelist_update(struct nd_prefixctl *newp
 	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 @@ prelist_update(struct nd_prefixctl *newp
 	 * "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 @@ prelist_update(struct nd_prefixctl *newp
 		 * 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 @@ prelist_update(struct nd_prefixctl *newp
 		 * 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 @@ prelist_update(struct nd_prefixctl *newp
 		 * - 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 @@ prelist_update(struct nd_prefixctl *newp
 			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 @@ prelist_update(struct nd_prefixctl *newp
 		 * 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 @@ prelist_update(struct nd_prefixctl *newp
 			}
 		}
 
-		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 @@ void
 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 @@ pfxlist_onlink_check(void)
 	 * 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 @@ pfxlist_onlink_check(void)
 			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) {
-			if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0)
+
+	if (ia) {
+		IN6_ADDRLIST_READER_FOREACH(ia) {
+			if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0)
 				continue;
 
-			if (ifa->ia6_ndpr == NULL) /* XXX: see above. */
+			if (ia->ia6_ndpr == NULL) /* XXX: see above. */
 				continue;
 
-			if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) {
-				if (ifa->ia6_flags & IN6_IFF_DETACHED) {
-					ifa->ia6_flags &= ~IN6_IFF_DETACHED;
-					ifa->ia6_flags |= IN6_IFF_TENTATIVE;
-					nd6_dad_start((struct ifaddr *)ifa,
+			if (find_pfxlist_reachable_router(ia->ia6_ndpr)) {
+				if (ia->ia6_flags & IN6_IFF_DETACHED) {
+					ia->ia6_flags &= ~IN6_IFF_DETACHED;
+					ia->ia6_flags |= IN6_IFF_TENTATIVE;
+					nd6_dad_start((struct ifaddr *)ia,
 					    0);
 					/* We will notify the routing socket
 					 * of the DAD result, so no need to
 					 * here */
 				}
 			} else {
-				if ((ifa->ia6_flags & IN6_IFF_DETACHED) == 0) {
-					ifa->ia6_flags |= IN6_IFF_DETACHED;
+				if ((ia->ia6_flags & IN6_IFF_DETACHED) == 0) {
+					ia->ia6_flags |= IN6_IFF_DETACHED;
 					rt_newaddrmsg(RTM_NEWADDR,
-					    (struct ifaddr *)ifa, 0, NULL);
+					    (struct ifaddr *)ia, 0, NULL);
 				}
 			}
 		}
 	}
 	else {
-		IN6_ADDRLIST_READER_FOREACH(ifa) {
-			if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0)
+		IN6_ADDRLIST_READER_FOREACH(ia) {
+			if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0)
 				continue;
 
-			if (ifa->ia6_flags & IN6_IFF_DETACHED) {
-				ifa->ia6_flags &= ~IN6_IFF_DETACHED;
-				ifa->ia6_flags |= IN6_IFF_TENTATIVE;
+			if (ia->ia6_flags & IN6_IFF_DETACHED) {
+				ia->ia6_flags &= ~IN6_IFF_DETACHED;
+				ia->ia6_flags |= IN6_IFF_TENTATIVE;
 				/* Do we need a delay in this case? */
-				nd6_dad_start((struct ifaddr *)ifa, 0);
+				nd6_dad_start((struct ifaddr *)ia, 0);
 			}
 		}
 	}

Reply via email to