From: bluhm Date: Mon, 13 Jan 2014 23:03:52 +0000 (+0000) Subject: Call all local valiables of type struct in6_ifaddr "ia6". This is X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b9e83c60a4e56c6dd88dea22c5646807d7f38c48;p=openbsd Call all local valiables of type struct in6_ifaddr "ia6". This is consistent with struct ifaddr "ifa" and struct in_ifaddr "ia". OK mpi@ --- diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index fed5ff3a79e..98f7688effc 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.116 2014/01/12 15:38:06 stsp Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.117 2014/01/13 23:03:52 bluhm Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -4727,7 +4727,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst, struct in6_addr *srcmask) { struct ifnet *ifp = &sp->pp_if; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_addr ssrc, ddst; bzero(&ssrc, sizeof(ssrc)); @@ -4736,18 +4736,18 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst, * Pick the first link-local AF_INET6 address from the list, * aliases don't make any sense on a p2p link anyway. */ - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia) { - if (!IN6_IS_ADDR_UNSPECIFIED(&ia->ia_addr.sin6_addr)) { - bcopy(&ia->ia_addr.sin6_addr, &ssrc, sizeof(ssrc)); + ia6 = in6ifa_ifpforlinklocal(ifp, 0); + if (ia6) { + if (!IN6_IS_ADDR_UNSPECIFIED(&ia6->ia_addr.sin6_addr)) { + bcopy(&ia6->ia_addr.sin6_addr, &ssrc, sizeof(ssrc)); if (srcmask) { - bcopy(&ia->ia_prefixmask.sin6_addr, srcmask, + bcopy(&ia6->ia_prefixmask.sin6_addr, srcmask, sizeof(*srcmask)); } } - if (!IN6_IS_ADDR_UNSPECIFIED(&ia->ia_dstaddr.sin6_addr)) - bcopy(&ia->ia_dstaddr.sin6_addr, &ddst, sizeof(ddst)); + if (!IN6_IS_ADDR_UNSPECIFIED(&ia6->ia_dstaddr.sin6_addr)) + bcopy(&ia6->ia_dstaddr.sin6_addr, &ddst, sizeof(ddst)); } if (dst) @@ -4764,13 +4764,13 @@ sppp_update_ip6_addr(void *arg1, void *arg2) struct ifnet *ifp = &sp->pp_if; struct in6_aliasreq *ifra = arg2; struct in6_addr mask = in6mask128; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; int s, error; s = splnet(); - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia == NULL) { + ia6 = in6ifa_ifpforlinklocal(ifp, 0); + if (ia6 == NULL) { /* IPv6 disabled? */ splx(s); return; @@ -4796,14 +4796,14 @@ sppp_update_ip6_addr(void *arg1, void *arg2) */ /* Destination address can only be set for /128. */ - if (!in6_are_prefix_equal(&ia->ia_prefixmask.sin6_addr, &mask, 128)) { + if (!in6_are_prefix_equal(&ia6->ia_prefixmask.sin6_addr, &mask, 128)) { ifra->ifra_dstaddr.sin6_len = 0; ifra->ifra_dstaddr.sin6_family = AF_UNSPEC; } - ifra->ifra_lifetime = ia->ia6_lifetime; + ifra->ifra_lifetime = ia6->ia6_lifetime; - error = in6_update_ifa(ifp, ifra, ia); + error = in6_update_ifa(ifp, ifra, ia6); if (error) { log(LOG_ERR, SPP_FMT "could not update IPv6 address (error %d)\n", diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 20cab9b69c0..179b60b26c9 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.218 2014/01/09 06:29:06 tedu Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.219 2014/01/13 23:03:52 bluhm Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -2094,7 +2094,7 @@ int carp_set_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6) { struct ifnet *ifp = sc->sc_carpdev; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; int error = 0; if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { @@ -2107,31 +2107,31 @@ carp_set_addr6(struct carp_softc *sc, struct sockaddr_in6 *sin6) } /* we have to do this by hand to ensure we don't match on ourselves */ - TAILQ_FOREACH(ia, &in6_ifaddr, ia_list) { + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) { int i; for (i = 0; i < 4; i++) { if ((sin6->sin6_addr.s6_addr32[i] & - ia->ia_prefixmask.sin6_addr.s6_addr32[i]) != - (ia->ia_addr.sin6_addr.s6_addr32[i] & - ia->ia_prefixmask.sin6_addr.s6_addr32[i])) + ia6->ia_prefixmask.sin6_addr.s6_addr32[i]) != + (ia6->ia_addr.sin6_addr.s6_addr32[i] & + ia6->ia_prefixmask.sin6_addr.s6_addr32[i])) break; } /* and, yeah, we need a multicast-capable iface too */ - if (ia->ia_ifp != &sc->sc_if && - ia->ia_ifp->if_type != IFT_CARP && - (ia->ia_ifp->if_flags & IFF_MULTICAST) && - ia->ia_ifp->if_rdomain == sc->sc_if.if_rdomain && + if (ia6->ia_ifp != &sc->sc_if && + ia6->ia_ifp->if_type != IFT_CARP && + (ia6->ia_ifp->if_flags & IFF_MULTICAST) && + ia6->ia_ifp->if_rdomain == sc->sc_if.if_rdomain && (i == 4)) break; } - if (ia) { + if (ia6) { if (sc->sc_carpdev) { - if (sc->sc_carpdev != ia->ia_ifp) + if (sc->sc_carpdev != ia6->ia_ifp) return (EADDRNOTAVAIL); } else { - ifp = ia->ia_ifp; + ifp = ia6->ia_ifp; } } diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 0160e2ff484..325a211019a 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.138 2014/01/07 17:07:46 mikeb Exp $ */ +/* $OpenBSD: icmp6.c,v 1.139 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -1629,7 +1629,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, 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; @@ -1656,11 +1656,11 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; - ifa6 = ifatoia6(ifa); + ia6 = ifatoia6(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; /* @@ -1674,7 +1674,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, */ /* 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; @@ -1695,7 +1695,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m, struct ifnet **ifpp, * 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 */ @@ -1717,7 +1717,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, struct ifnet *ifp0, int resid) { struct ifnet *ifp = ifp0 ? ifp0 : TAILQ_FIRST(&ifnet); - struct in6_ifaddr *ifa6; + struct in6_ifaddr *ia6; struct ifaddr *ifa; struct ifnet *ifp_dep = NULL; int copied = 0, allow_deprecated = 0; @@ -1734,9 +1734,9 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; - ifa6 = ifatoia6(ifa); + ia6 = ifatoia6(ifa); - if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) != 0 && + if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) != 0 && allow_deprecated == 0) { /* * preferred address should be put before @@ -1749,12 +1749,12 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, 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; @@ -1775,7 +1775,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, * 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; @@ -1808,10 +1808,10 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, * * 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 { - time_t diff = ifa6->ia6_lifetime.ia6t_expire - + time_t diff = ia6->ia6_lifetime.ia6t_expire - time_second; if (diff <= 0) @@ -1826,10 +1826,10 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6, struct icmp6_nodeinfo *nni6, 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)); /* XXX: KAME link-local hack; remove ifindex */ - if (IN6_IS_ADDR_LINKLOCAL(&ifa6->ia_addr.sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL(&ia6->ia_addr.sin6_addr)) ((struct in6_addr *)cp)->s6_addr16[1] = 0; cp += sizeof(struct in6_addr); @@ -1961,7 +1961,7 @@ icmp6_reflect(struct mbuf *m, size_t off) { struct ip6_hdr *ip6; struct icmp6_hdr *icmp6; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_addr t, *src = 0; int plen; int type, code; @@ -2046,13 +2046,13 @@ icmp6_reflect(struct mbuf *m, size_t off) * (for example) when we encounter an error while forwarding procedure * destined to a duplicated address of ours. */ - TAILQ_FOREACH(ia, &in6_ifaddr, ia_list) - if (IN6_ARE_ADDR_EQUAL(&t, &ia->ia_addr.sin6_addr) && - (ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) { + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) + if (IN6_ARE_ADDR_EQUAL(&t, &ia6->ia_addr.sin6_addr) && + (ia6->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY)) == 0) { src = &t; break; } - if (ia == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) { + if (ia6 == NULL && IN6_IS_ADDR_LINKLOCAL(&t) && (m->m_flags & M_LOOP)) { /* * This is the case if the dst is our link-local address * and the sender is also ourselves. @@ -2438,12 +2438,12 @@ icmp6_redirect_output(struct mbuf *m0, struct rtentry *rt) { /* get ip6 linklocal address for ifp(my outgoing interface). */ - struct in6_ifaddr *ia; - if ((ia = in6ifa_ifpforlinklocal(ifp, + struct in6_ifaddr *ia6; + if ((ia6 = in6ifa_ifpforlinklocal(ifp, IN6_IFF_NOTREADY| IN6_IFF_ANYCAST)) == NULL) goto fail; - ifp_ll6 = &ia->ia_addr.sin6_addr; + ifp_ll6 = &ia6->ia_addr.sin6_addr; } /* get ip6 linklocal address for the router. */ diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 80c357124f8..5b9973da5b8 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.127 2014/01/07 16:34:05 stsp Exp $ */ +/* $OpenBSD: in6.c,v 1.128 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -237,7 +237,7 @@ in6_ifaddloop(struct ifaddr *ifa) void in6_ifremloop(struct ifaddr *ifa) { - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct rtentry *rt; int ia_count = 0; @@ -256,8 +256,8 @@ in6_ifremloop(struct ifaddr *ifa) * (probably p2p) interfaces. * XXX: we should avoid such a configuration in IPv6... */ - TAILQ_FOREACH(ia, &in6_ifaddr, ia_list) { - if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ia->ia_addr.sin6_addr)) { + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) { + if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ia6->ia_addr.sin6_addr)) { ia_count++; if (ia_count > 1) break; @@ -322,7 +322,7 @@ int in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) { struct in6_ifreq *ifr = (struct in6_ifreq *)data; - struct in6_ifaddr *ia = NULL; + struct in6_ifaddr *ia6 = NULL; struct in6_aliasreq *ifra = (struct in6_aliasreq *)data; struct sockaddr_in6 *sa6; int privileged; @@ -444,9 +444,9 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) sa6->sin6_scope_id = 0; /* XXX: good way? */ } } - ia = in6ifa_ifpwithaddr(ifp, &sa6->sin6_addr); + ia6 = in6ifa_ifpwithaddr(ifp, &sa6->sin6_addr); } else - ia = NULL; + ia6 = NULL; switch (cmd) { case SIOCSIFADDR_IN6: @@ -466,7 +466,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) * interface address from the day one, we consider "remove the * first one" semantics to be not preferable. */ - if (ia == NULL) + if (ia6 == NULL) return (EADDRNOTAVAIL); /* FALLTHROUGH */ case SIOCAIFADDR_IN6: @@ -490,7 +490,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) case SIOCGIFDSTADDR_IN6: case SIOCGIFALIFETIME_IN6: /* must think again about its semantics */ - if (ia == NULL) + if (ia6 == NULL) return (EADDRNOTAVAIL); break; case SIOCSIFALIFETIME_IN6: @@ -499,7 +499,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) if (!privileged) return (EPERM); - if (ia == NULL) + if (ia6 == NULL) return (EADDRNOTAVAIL); /* sanity for overflow - beware unsigned */ lt = &ifr->ifr_ifru.ifru_lifetime; @@ -518,7 +518,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) switch (cmd) { case SIOCGIFADDR_IN6: - ifr->ifr_addr = ia->ia_addr; + ifr->ifr_addr = ia6->ia_addr; break; case SIOCGIFDSTADDR_IN6: @@ -528,15 +528,15 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) * XXX: should we check if ifa_dstaddr is NULL and return * an error? */ - ifr->ifr_dstaddr = ia->ia_dstaddr; + ifr->ifr_dstaddr = ia6->ia_dstaddr; break; case SIOCGIFNETMASK_IN6: - ifr->ifr_addr = ia->ia_prefixmask; + ifr->ifr_addr = ia6->ia_prefixmask; break; case SIOCGIFAFLAG_IN6: - ifr->ifr_ifru.ifru_flags6 = ia->ia6_flags; + ifr->ifr_ifru.ifru_flags6 = ia6->ia6_flags; break; case SIOCGIFSTAT_IN6: @@ -558,8 +558,8 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) break; case SIOCGIFALIFETIME_IN6: - ifr->ifr_ifru.ifru_lifetime = ia->ia6_lifetime; - if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + ifr->ifr_ifru.ifru_lifetime = ia6->ia6_lifetime; + if (ia6->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { time_t maxexpire; struct in6_addrlifetime *retlt = &ifr->ifr_ifru.ifru_lifetime; @@ -570,14 +570,14 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) */ maxexpire = (time_t)~(1ULL << ((sizeof(maxexpire) * 8) - 1)); - if (ia->ia6_lifetime.ia6t_vltime < - maxexpire - ia->ia6_updatetime) { - retlt->ia6t_expire = ia->ia6_updatetime + - ia->ia6_lifetime.ia6t_vltime; + if (ia6->ia6_lifetime.ia6t_vltime < + maxexpire - ia6->ia6_updatetime) { + retlt->ia6t_expire = ia6->ia6_updatetime + + ia6->ia6_lifetime.ia6t_vltime; } else retlt->ia6t_expire = maxexpire; } - if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + if (ia6->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { time_t maxexpire; struct in6_addrlifetime *retlt = &ifr->ifr_ifru.ifru_lifetime; @@ -588,28 +588,28 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) */ maxexpire = (time_t)~(1ULL << ((sizeof(maxexpire) * 8) - 1)); - if (ia->ia6_lifetime.ia6t_pltime < - maxexpire - ia->ia6_updatetime) { - retlt->ia6t_preferred = ia->ia6_updatetime + - ia->ia6_lifetime.ia6t_pltime; + if (ia6->ia6_lifetime.ia6t_pltime < + maxexpire - ia6->ia6_updatetime) { + retlt->ia6t_preferred = ia6->ia6_updatetime + + ia6->ia6_lifetime.ia6t_pltime; } else retlt->ia6t_preferred = maxexpire; } break; case SIOCSIFALIFETIME_IN6: - ia->ia6_lifetime = ifr->ifr_ifru.ifru_lifetime; + ia6->ia6_lifetime = ifr->ifr_ifru.ifru_lifetime; /* for sanity */ - if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_expire = - time_second + ia->ia6_lifetime.ia6t_vltime; + if (ia6->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + ia6->ia6_lifetime.ia6t_expire = + time_second + ia6->ia6_lifetime.ia6t_vltime; } else - ia->ia6_lifetime.ia6t_expire = 0; - if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_preferred = - time_second + ia->ia6_lifetime.ia6t_pltime; + ia6->ia6_lifetime.ia6t_expire = 0; + if (ia6->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + ia6->ia6_lifetime.ia6t_preferred = + time_second + ia6->ia6_lifetime.ia6t_pltime; } else - ia->ia6_lifetime.ia6t_preferred = 0; + ia6->ia6_lifetime.ia6t_preferred = 0; break; case SIOCAIFADDR_IN6: @@ -630,11 +630,11 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) * and link it to the list. */ s = splsoftnet(); - error = in6_update_ifa(ifp, ifra, ia); + error = in6_update_ifa(ifp, ifra, ia6); splx(s); if (error != 0) return (error); - if ((ia = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr)) + if ((ia6 = in6ifa_ifpwithaddr(ifp, &ifra->ifra_addr.sin6_addr)) == NULL) { /* * this can happen when the user specify the 0 valid @@ -698,8 +698,8 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) } /* relate the address to the prefix */ - if (ia->ia6_ndpr == NULL) { - ia->ia6_ndpr = pr; + if (ia6->ia6_ndpr == NULL) { + ia6->ia6_ndpr = pr; pr->ndpr_refcnt++; } @@ -714,7 +714,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) } case SIOCDIFADDR_IN6: - in6_purgeaddr(&ia->ia_ifa); + in6_purgeaddr(&ia6->ia_ifa); dohooks(ifp->if_addrhooks, 0); break; @@ -734,7 +734,7 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp) */ int in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, - struct in6_ifaddr *ia) + struct in6_ifaddr *ia6) { int error = 0, hostIsNew = 0, plen = -1; struct sockaddr_in6 dst6; @@ -774,7 +774,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * We also require the prefix (when specified) mask is valid, and thus * reject a non-consecutive mask. */ - if (ia == NULL && ifra->ifra_prefixmask.sin6_len == 0) + if (ia6 == NULL && ifra->ifra_prefixmask.sin6_len == 0) return (EINVAL); if (ifra->ifra_prefixmask.sin6_len != 0) { plen = in6_mask2len(&ifra->ifra_prefixmask.sin6_addr, @@ -784,10 +784,10 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, return (EINVAL); } else { /* - * In this case, ia must not be NULL. We just use its prefix + * In this case, ia6 must not be NULL. We just use its prefix * length. */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); + plen = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL); } /* * If the destination address on a p2p interface is specified, @@ -863,7 +863,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, inet_ntop(AF_INET6, &ifra->ifra_addr.sin6_addr, addr, sizeof(addr)))); - if (ia == NULL) + if (ia6 == NULL) return (0); /* there's nothing to do */ } @@ -871,30 +871,30 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * If this is a new address, allocate a new ifaddr and link it * into chains. */ - if (ia == NULL) { + if (ia6 == NULL) { hostIsNew = 1; - ia = malloc(sizeof(*ia), M_IFADDR, M_WAITOK | M_ZERO); - LIST_INIT(&ia->ia6_memberships); + ia6 = malloc(sizeof(*ia6), M_IFADDR, M_WAITOK | M_ZERO); + LIST_INIT(&ia6->ia6_memberships); /* Initialize the address and masks, and put time stamp */ - ia->ia_ifa.ifa_addr = sin6tosa(&ia->ia_addr); - ia->ia_addr.sin6_family = AF_INET6; - ia->ia_addr.sin6_len = sizeof(ia->ia_addr); - ia->ia6_createtime = ia->ia6_updatetime = time_second; + ia6->ia_ifa.ifa_addr = sin6tosa(&ia6->ia_addr); + ia6->ia_addr.sin6_family = AF_INET6; + ia6->ia_addr.sin6_len = sizeof(ia6->ia_addr); + ia6->ia6_createtime = ia6->ia6_updatetime = time_second; if ((ifp->if_flags & (IFF_POINTOPOINT | IFF_LOOPBACK)) != 0) { /* * XXX: some functions expect that ifa_dstaddr is not * NULL for p2p interfaces. */ - ia->ia_ifa.ifa_dstaddr = sin6tosa(&ia->ia_dstaddr); + ia6->ia_ifa.ifa_dstaddr = sin6tosa(&ia6->ia_dstaddr); } else { - ia->ia_ifa.ifa_dstaddr = NULL; + ia6->ia_ifa.ifa_dstaddr = NULL; } - ia->ia_ifa.ifa_netmask = sin6tosa(&ia->ia_prefixmask); + ia6->ia_ifa.ifa_netmask = sin6tosa(&ia6->ia_prefixmask); - ia->ia_ifp = ifp; - TAILQ_INSERT_TAIL(&in6_ifaddr, ia, ia_list); - ia->ia_addr = ifra->ifra_addr; - ifa_add(ifp, &ia->ia_ifa); + ia6->ia_ifp = ifp; + TAILQ_INSERT_TAIL(&in6_ifaddr, ia6, ia_list); + ia6->ia_addr = ifra->ifra_addr; + ifa_add(ifp, &ia6->ia_ifa); } /* set prefix mask */ @@ -905,16 +905,16 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * + such an operation should be rare in IPv6, and * + the operation would confuse prefix management. */ - if (ia->ia_prefixmask.sin6_len && - in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) { + if (ia6->ia_prefixmask.sin6_len && + in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL) != plen) { nd6log((LOG_INFO, "in6_update_ifa: the prefix length of an" " existing (%s) address should not be changed\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)))); error = EINVAL; goto unlink; } - ia->ia_prefixmask = ifra->ifra_prefixmask; + ia6->ia_prefixmask = ifra->ifra_prefixmask; } /* @@ -923,19 +923,19 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * p2p or loopback (see the check above.) */ if (dst6.sin6_family == AF_INET6 && - !IN6_ARE_ADDR_EQUAL(&dst6.sin6_addr, &ia->ia_dstaddr.sin6_addr)) { + !IN6_ARE_ADDR_EQUAL(&dst6.sin6_addr, &ia6->ia_dstaddr.sin6_addr)) { int e; - if ((ia->ia_flags & IFA_ROUTE) != 0 && - (e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) != 0) { + if ((ia6->ia_flags & IFA_ROUTE) != 0 && + (e = rtinit(&(ia6->ia_ifa), (int)RTM_DELETE, RTF_HOST)) != 0) { nd6log((LOG_ERR, "in6_update_ifa: failed to remove " "a route to the old destination: %s\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)))); /* proceed anyway... */ } else - ia->ia_flags &= ~IFA_ROUTE; - ia->ia_dstaddr = dst6; + ia6->ia_flags &= ~IFA_ROUTE; + ia6->ia_dstaddr = dst6; } /* @@ -943,43 +943,43 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * to see if the address is deprecated or invalidated, but initialize * these members for applications. */ - ia->ia6_lifetime = ifra->ifra_lifetime; - if (ia->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_expire = - time_second + ia->ia6_lifetime.ia6t_vltime; + ia6->ia6_lifetime = ifra->ifra_lifetime; + if (ia6->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME) { + ia6->ia6_lifetime.ia6t_expire = + time_second + ia6->ia6_lifetime.ia6t_vltime; } else - ia->ia6_lifetime.ia6t_expire = 0; - if (ia->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { - ia->ia6_lifetime.ia6t_preferred = - time_second + ia->ia6_lifetime.ia6t_pltime; + ia6->ia6_lifetime.ia6t_expire = 0; + if (ia6->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME) { + ia6->ia6_lifetime.ia6t_preferred = + time_second + ia6->ia6_lifetime.ia6t_pltime; } else - ia->ia6_lifetime.ia6t_preferred = 0; + ia6->ia6_lifetime.ia6t_preferred = 0; /* reset the interface and routing table appropriately. */ - if ((error = in6_ifinit(ifp, ia, hostIsNew)) != 0) + if ((error = in6_ifinit(ifp, ia6, hostIsNew)) != 0) goto unlink; /* * configure address flags. */ - ia->ia6_flags = ifra->ifra_flags; + ia6->ia6_flags = ifra->ifra_flags; /* * backward compatibility - if IN6_IFF_DEPRECATED is set from the * userland, make it deprecated. */ if ((ifra->ifra_flags & IN6_IFF_DEPRECATED) != 0) { - ia->ia6_lifetime.ia6t_pltime = 0; - ia->ia6_lifetime.ia6t_preferred = time_second; + ia6->ia6_lifetime.ia6t_pltime = 0; + ia6->ia6_lifetime.ia6t_preferred = time_second; } /* * Make the address tentative before joining multicast addresses, * so that corresponding MLD responses would not have a tentative * source address. */ - ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ + ia6->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ if (hostIsNew && in6if_do_dad(ifp) && (ifra->ifra_flags & IN6_IFF_NODAD) == 0) - ia->ia6_flags |= IN6_IFF_TENTATIVE; + ia6->ia6_flags |= IN6_IFF_TENTATIVE; /* * We are done if we have simply modified an existing address. @@ -1018,7 +1018,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, ifp->if_xname, error)); goto cleanup; } - LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); + LIST_INSERT_HEAD(&ia6->ia6_memberships, imm, i6mm_chain); bzero(&mltmask, sizeof(mltmask)); mltmask.sin6_len = sizeof(struct sockaddr_in6); @@ -1058,9 +1058,9 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = sin6tosa(&mltaddr); - info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia->ia_addr); + info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr); info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask); - info.rti_info[RTAX_IFA] = sin6tosa(&ia->ia_addr); + info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr); /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ info.rti_flags = RTF_UP | RTF_CLONING; error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL, @@ -1080,7 +1080,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, ifp->if_xname, error)); goto cleanup; } - LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); + LIST_INSERT_HEAD(&ia6->ia6_memberships, imm, i6mm_chain); /* * join node information group address @@ -1095,7 +1095,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, ifp->if_xname, error)); /* XXX not very fatal, go on... */ } else { - LIST_INSERT_HEAD(&ia->ia6_memberships, + LIST_INSERT_HEAD(&ia6->ia6_memberships, imm, i6mm_chain); } } @@ -1127,9 +1127,9 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, bzero(&info, sizeof(info)); info.rti_info[RTAX_DST] = sin6tosa(&mltaddr); - info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia->ia_addr); + info.rti_info[RTAX_GATEWAY] = sin6tosa(&ia6->ia_addr); info.rti_info[RTAX_NETMASK] = sin6tosa(&mltmask); - info.rti_info[RTAX_IFA] = sin6tosa(&ia->ia_addr); + info.rti_info[RTAX_IFA] = sin6tosa(&ia6->ia_addr); info.rti_flags = RTF_UP | RTF_CLONING; error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL, ifp->if_rdomain); @@ -1147,7 +1147,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, ifp->if_xname, error)); goto cleanup; } - LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); + LIST_INSERT_HEAD(&ia6->ia6_memberships, imm, i6mm_chain); } /* @@ -1158,7 +1158,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, if (hostIsNew && in6if_do_dad(ifp) && (ifra->ifra_flags & IN6_IFF_NODAD) == 0) { - nd6_dad_start(&ia->ia_ifa, NULL); + nd6_dad_start(&ia6->ia_ifa, NULL); } return (error); @@ -1169,11 +1169,11 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra, * anyway. */ if (hostIsNew) - in6_unlink_ifa(ia, ifp); + in6_unlink_ifa(ia6, ifp); return (error); cleanup: - in6_purgeaddr(&ia->ia_ifa); + in6_purgeaddr(&ia6->ia_ifa); return error; } @@ -1181,7 +1181,7 @@ void in6_purgeaddr(struct ifaddr *ifa) { struct ifnet *ifp = ifa->ifa_ifp; - struct in6_ifaddr *ia = ifatoia6(ifa); + struct in6_ifaddr *ia6 = ifatoia6(ifa); struct in6_multi_mship *imm; /* stop DAD processing */ @@ -1191,70 +1191,70 @@ in6_purgeaddr(struct ifaddr *ifa) * delete route to the destination of the address being purged. * The interface must be p2p or loopback in this case. */ - if ((ia->ia_flags & IFA_ROUTE) != 0 && ia->ia_dstaddr.sin6_len != 0) { + if ((ia6->ia_flags & IFA_ROUTE) != 0 && ia6->ia_dstaddr.sin6_len != 0) { int e; - if ((e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) + if ((e = rtinit(&(ia6->ia_ifa), (int)RTM_DELETE, RTF_HOST)) != 0) { char addr[INET6_ADDRSTRLEN]; log(LOG_ERR, "in6_purgeaddr: failed to remove " "a route to the p2p destination: %s on %s, " "errno=%d\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), ifp->if_xname, e); /* proceed anyway... */ } else - ia->ia_flags &= ~IFA_ROUTE; + ia6->ia_flags &= ~IFA_ROUTE; } /* Remove ownaddr's loopback rtentry, if it exists. */ - in6_ifremloop(&(ia->ia_ifa)); + in6_ifremloop(&(ia6->ia_ifa)); /* * leave from multicast groups we have joined for the interface */ - while (!LIST_EMPTY(&ia->ia6_memberships)) { - imm = LIST_FIRST(&ia->ia6_memberships); + while (!LIST_EMPTY(&ia6->ia6_memberships)) { + imm = LIST_FIRST(&ia6->ia6_memberships); LIST_REMOVE(imm, i6mm_chain); in6_leavegroup(imm); } - in6_unlink_ifa(ia, ifp); + in6_unlink_ifa(ia6, ifp); } void -in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) +in6_unlink_ifa(struct in6_ifaddr *ia6, struct ifnet *ifp) { int s = splnet(); - ifa_del(ifp, &ia->ia_ifa); + ifa_del(ifp, &ia6->ia_ifa); - TAILQ_REMOVE(&in6_ifaddr, ia, ia_list); + TAILQ_REMOVE(&in6_ifaddr, ia6, ia_list); /* Release the reference to the base prefix. */ - if (ia->ia6_ndpr == NULL) { + if (ia6->ia6_ndpr == NULL) { char addr[INET6_ADDRSTRLEN]; - if (!IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia)) && - !IN6_IS_ADDR_LOOPBACK(IA6_IN6(ia)) && - !IN6_ARE_ADDR_EQUAL(IA6_MASKIN6(ia), &in6mask128)) + if (!IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia6)) && + !IN6_IS_ADDR_LOOPBACK(IA6_IN6(ia6)) && + !IN6_ARE_ADDR_EQUAL(IA6_MASKIN6(ia6), &in6mask128)) log(LOG_NOTICE, "in6_unlink_ifa: interface address " "%s has no prefix\n", - inet_ntop(AF_INET6, IA6_IN6(ia), addr, + inet_ntop(AF_INET6, IA6_IN6(ia6), addr, sizeof(addr))); } else { - ia->ia6_flags &= ~IN6_IFF_AUTOCONF; - if (--ia->ia6_ndpr->ndpr_refcnt == 0) - prelist_remove(ia->ia6_ndpr); - ia->ia6_ndpr = NULL; + ia6->ia6_flags &= ~IN6_IFF_AUTOCONF; + if (--ia6->ia6_ndpr->ndpr_refcnt == 0) + prelist_remove(ia6->ia6_ndpr); + ia6->ia6_ndpr = NULL; } /* * release another refcnt for the link from in6_ifaddr. * Note that we should decrement the refcnt at least once for all *BSD. */ - ifafree(&ia->ia_ifa); + ifafree(&ia6->ia_ifa); splx(s); } @@ -1396,7 +1396,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, case SIOCGLIFADDR: case SIOCDLIFADDR: { - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_addr mask, candidate, match; struct sockaddr_in6 *sin6; int cmp; @@ -1448,21 +1448,21 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, } if (!ifa) return EADDRNOTAVAIL; - ia = ifatoia6(ifa); + ia6 = ifatoia6(ifa); if (cmd == SIOCGLIFADDR) { /* fill in the if_laddrreq structure */ - bcopy(&ia->ia_addr, &iflr->addr, ia->ia_addr.sin6_len); + bcopy(&ia6->ia_addr, &iflr->addr, ia6->ia_addr.sin6_len); if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { - bcopy(&ia->ia_dstaddr, &iflr->dstaddr, - ia->ia_dstaddr.sin6_len); + bcopy(&ia6->ia_dstaddr, &iflr->dstaddr, + ia6->ia_dstaddr.sin6_len); } else bzero(&iflr->dstaddr, sizeof(iflr->dstaddr)); iflr->prefixlen = - in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); + in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL); - iflr->flags = ia->ia6_flags; /*XXX*/ + iflr->flags = ia6->ia6_flags; /*XXX*/ return 0; } else { @@ -1473,19 +1473,19 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name)); - bcopy(&ia->ia_addr, &ifra.ifra_addr, - ia->ia_addr.sin6_len); + bcopy(&ia6->ia_addr, &ifra.ifra_addr, + ia6->ia_addr.sin6_len); if ((ifp->if_flags & IFF_POINTOPOINT) != 0) { - bcopy(&ia->ia_dstaddr, &ifra.ifra_dstaddr, - ia->ia_dstaddr.sin6_len); + bcopy(&ia6->ia_dstaddr, &ifra.ifra_dstaddr, + ia6->ia_dstaddr.sin6_len); } else { bzero(&ifra.ifra_dstaddr, sizeof(ifra.ifra_dstaddr)); } - bcopy(&ia->ia_prefixmask, &ifra.ifra_dstaddr, - ia->ia_prefixmask.sin6_len); + bcopy(&ia6->ia_prefixmask, &ifra.ifra_dstaddr, + ia6->ia_prefixmask.sin6_len); - ifra.ifra_flags = ia->ia6_flags; + ifra.ifra_flags = ia6->ia6_flags; return in6_control(so, SIOCDIFADDR_IN6, (caddr_t)&ifra, ifp); } @@ -1500,7 +1500,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, * and routing table entry. */ int -in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia, int newhost) +in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia6, int newhost) { int error = 0, plen, ifacount = 0; int s = splnet(); @@ -1520,13 +1520,13 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia, int newhost) } if ((ifacount <= 1 || ifp->if_type == IFT_CARP) && ifp->if_ioctl && - (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia))) { + (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia6))) { splx(s); return (error); } splx(s); - ia->ia_ifa.ifa_metric = ifp->if_metric; + ia6->ia_ifa.ifa_metric = ifp->if_metric; /* we could do in(6)_socktrim here, but just omit it at this moment. */ @@ -1536,19 +1536,19 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia, int newhost) * interface, install a route to the destination as an interface * direct route. */ - plen = in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ - if (plen == 128 && ia->ia_dstaddr.sin6_family == AF_INET6) { - if ((error = rtinit(&(ia->ia_ifa), (int)RTM_ADD, + plen = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL); /* XXX */ + if (plen == 128 && ia6->ia_dstaddr.sin6_family == AF_INET6) { + if ((error = rtinit(&(ia6->ia_ifa), (int)RTM_ADD, RTF_UP | RTF_HOST)) != 0) return (error); - ia->ia_flags |= IFA_ROUTE; + ia6->ia_flags |= IFA_ROUTE; } /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ if (newhost) { /* set the rtrequest function to create llinfo */ - ia->ia_ifa.ifa_rtrequest = nd6_rtrequest; - in6_ifaddloop(&(ia->ia_ifa)); + ia6->ia_ifa.ifa_rtrequest = nd6_rtrequest; + in6_ifaddloop(&(ia6->ia_ifa)); } return (error); @@ -1935,7 +1935,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) int blen = -1; struct ifaddr *ifa; struct ifnet *ifp; - struct in6_ifaddr *ifa_best = NULL; + struct in6_ifaddr *ia6_best = NULL; #if NCARP > 0 struct sockaddr_dl *proxydl = NULL; #endif @@ -1989,13 +1989,13 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) "newaddr=%s, scope=%x, dcmp=%d, bcmp=%d, " "matchlen=%d, flgs=%x\n", inet_ntop(AF_INET6, dst, adst, sizeof(adst)), - (ifa_best == NULL) ? "none" : - inet_ntop(AF_INET6, &ifa_best->ia_addr.sin6_addr, + (ia6_best == NULL) ? "none" : + inet_ntop(AF_INET6, &ia6_best->ia_addr.sin6_addr, bestaddr, sizeof(bestaddr)), inet_ntop(AF_INET6, IFA_IN6(ifa), asrc, sizeof(asrc)), src_scope, dscopecmp, - ifa_best ? IN6_ARE_SCOPE_CMP(src_scope, best_scope) : -1, + ia6_best ? IN6_ARE_SCOPE_CMP(src_scope, best_scope) : -1, in6_matchlen(IFA_IN6(ifa), dst), ifatoia6(ifa)->ia6_flags); } @@ -2019,20 +2019,20 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) * If this is the first address we find, * keep it anyway. */ - if (ifa_best == NULL) + if (ia6_best == NULL) goto replace; /* - * ifa_best is never NULL beyond this line except + * ia6_best is never NULL beyond this line except * within the block labeled "replace". */ /* - * If ifa_best has a smaller scope than dst and + * If ia6_best has a smaller scope than dst and * the current address has a larger one than - * (or equal to) dst, always replace ifa_best. + * (or equal to) dst, always replace ia6_best. * Also, if the current address has a smaller scope - * than dst, ignore it unless ifa_best also has a + * than dst, ignore it unless ia6_best also has a * smaller scope. */ if (IN6_ARE_SCOPE_CMP(best_scope, dst_scope) < 0 && @@ -2060,7 +2060,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) * If we have already found a non-deprecated * candidate, just ignore deprecated addresses. */ - if ((ifa_best->ia6_flags & IN6_IFF_DEPRECATED) + if ((ia6_best->ia6_flags & IN6_IFF_DEPRECATED) == 0) continue; } @@ -2070,7 +2070,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) * to a deprecated one regardless of scopes and * address matching. */ - if ((ifa_best->ia6_flags & IN6_IFF_DEPRECATED) && + if ((ia6_best->ia6_flags & IN6_IFF_DEPRECATED) && (ifatoia6(ifa)->ia6_flags & IN6_IFF_DEPRECATED) == 0) goto replace; @@ -2078,9 +2078,9 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) /* * At this point, we have two cases: * 1. we are looking at a non-deprecated address, - * and ifa_best is also non-deprecated. + * and ia6_best is also non-deprecated. * 2. we are looking at a deprecated address, - * and ifa_best is also deprecated. + * and ia6_best is also deprecated. * Also, we do not have to consider a case where * the scope of if_best is larger(smaller) than dst and * the scope of the current address is smaller(larger) @@ -2090,8 +2090,8 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) * - the scope comparison between the address and * dst (dscopecmp) * - the scope comparison between the address and - * ifa_best (bscopecmp) - * - if the address match dst longer than ifa_best + * ia6_best (bscopecmp) + * - if the address match dst longer than ia6_best * (matchcmp) * - if the address is on the outgoing I/F (outI/F) * @@ -2156,14 +2156,14 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) if (oifp == ifp) { /* Do not replace temporary autoconf addresses * with non-temporary addresses. */ - if ((ifa_best->ia6_flags & IN6_IFF_PRIVACY) && + if ((ia6_best->ia6_flags & IN6_IFF_PRIVACY) && !(ifatoia6(ifa)->ia6_flags & IN6_IFF_PRIVACY)) continue; /* Replace non-temporary autoconf addresses * with temporary addresses. */ - if (!(ifa_best->ia6_flags & IN6_IFF_PRIVACY) && + if (!(ia6_best->ia6_flags & IN6_IFF_PRIVACY) && (ifatoia6(ifa)->ia6_flags & IN6_IFF_PRIVACY)) goto replace; @@ -2179,18 +2179,18 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) continue; /* (b) */ replace: - ifa_best = ifatoia6(ifa); + ia6_best = ifatoia6(ifa); blen = tlen >= 0 ? tlen : in6_matchlen(IFA_IN6(ifa), dst); - best_scope = in6_addrscope(&ifa_best->ia_addr.sin6_addr); + best_scope = in6_addrscope(&ia6_best->ia_addr.sin6_addr); } } /* count statistics for future improvements */ - if (ifa_best == NULL) + if (ia6_best == NULL) ip6stat.ip6s_sources_none++; else { - if (oifp == ifa_best->ia_ifp) + if (oifp == ia6_best->ia_ifp) ip6stat.ip6s_sources_sameif[best_scope]++; else ip6stat.ip6s_sources_otherif[best_scope]++; @@ -2200,11 +2200,11 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain) else ip6stat.ip6s_sources_otherscope[best_scope]++; - if ((ifa_best->ia6_flags & IN6_IFF_DEPRECATED) != 0) + if ((ia6_best->ia6_flags & IN6_IFF_DEPRECATED) != 0) ip6stat.ip6s_sources_deprecated[best_scope]++; } - return (ifa_best); + return (ia6_best); } /* @@ -2214,7 +2214,7 @@ void in6_if_up(struct ifnet *ifp) { struct ifaddr *ifa; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; int dad_delay; /* delay ticks before DAD output */ /* @@ -2226,8 +2226,8 @@ in6_if_up(struct ifnet *ifp) TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; - ia = ifatoia6(ifa); - if (ia->ia6_flags & IN6_IFF_TENTATIVE) + ia6 = ifatoia6(ifa); + if (ia6->ia6_flags & IN6_IFF_TENTATIVE) nd6_dad_start(ifa, &dad_delay); } } diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 26369b05230..567caa0b219 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_ifattach.c,v 1.66 2014/01/07 16:34:05 stsp Exp $ */ +/* $OpenBSD: in6_ifattach.c,v 1.67 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */ /* @@ -315,7 +315,7 @@ success: int in6_ifattach_linklocal(struct ifnet *ifp, struct in6_addr *ifid) { - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_aliasreq ifra; struct nd_prefix pr0; int i, s, error; @@ -398,17 +398,17 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct in6_addr *ifid) * XXX: Some P2P interfaces seem not to send packets just after * becoming up, so we skip p2p interfaces for safety. */ - ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ + ia6 = in6ifa_ifpforlinklocal(ifp, 0); /* ia6 must not be NULL */ #ifdef DIAGNOSTIC - if (!ia) { - panic("ia == NULL in in6_ifattach_linklocal"); + if (!ia6) { + panic("ia6 == NULL in in6_ifattach_linklocal"); /* NOTREACHED */ } #endif if (in6if_do_dad(ifp) && ((ifp->if_flags & IFF_POINTOPOINT) || (ifp->if_type == IFT_CARP)) == 0) { - ia->ia6_flags &= ~IN6_IFF_NODAD; - ia->ia6_flags |= IN6_IFF_TENTATIVE; + ia6->ia6_flags &= ~IN6_IFF_NODAD; + ia6->ia6_flags |= IN6_IFF_TENTATIVE; } /* @@ -567,7 +567,7 @@ in6_nigroup(struct ifnet *ifp, const char *name, int namelen, void in6_ifattach(struct ifnet *ifp) { - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_addr in6; /* some of the interfaces are inherently not IPv6 capable */ @@ -628,8 +628,8 @@ in6_ifattach(struct ifnet *ifp) * assign a link-local address, if there's none. */ if (ip6_auto_linklocal) { - ia = in6ifa_ifpforlinklocal(ifp, 0); - if (ia == NULL) { + ia6 = in6ifa_ifpforlinklocal(ifp, 0); + if (ia6 == NULL) { if (in6_ifattach_linklocal(ifp, NULL) == 0) { /* linklocal address assigned */ } else { diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 5882598f092..b2f11f617fb 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.148 2013/10/23 19:57:50 deraadt Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.149 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -159,7 +159,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt, struct route_in6 *ro, struct rtentry *rt = NULL; struct sockaddr_in6 *dst, dstsock; int error = 0; - struct in6_ifaddr *ia = NULL; + struct in6_ifaddr *ia6 = NULL; u_long mtu; int alwaysfrag, dontfrag; u_int32_t optlen = 0, plen = 0, unfragpartlen = 0; @@ -567,7 +567,7 @@ reroute: * then rt (for unicast) and ifp must be non-NULL valid values. */ if (rt) { - ia = ifatoia6(rt->rt_ifa); + ia6 = ifatoia6(rt->rt_ifa); rt->rt_use++; } @@ -581,8 +581,8 @@ reroute: * destination addresses. We should use ia_ifp to support the * case of sending packets to an address of our own. */ - if (ia != NULL && ia->ia_ifp) - origifp = ia->ia_ifp; + if (ia6 != NULL && ia6->ia_ifp) + origifp = ia6->ia_ifp; else origifp = ifp; diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c index 534493806f4..95648c14080 100644 --- a/sys/netinet6/mld6.c +++ b/sys/netinet6/mld6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6.c,v 1.34 2013/11/28 10:16:44 mpi Exp $ */ +/* $OpenBSD: mld6.c,v 1.35 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */ /* @@ -373,7 +373,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) struct mld_hdr *mldh; struct ip6_hdr *ip6; struct ip6_moptions im6o; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct ifnet *ifp = in6m->in6m_ifp; int ignflags; @@ -384,10 +384,10 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) * the case where we first join a link-local address. */ ignflags = (IN6_IFF_NOTREADY|IN6_IFF_ANYCAST) & ~IN6_IFF_TENTATIVE; - if ((ia = in6ifa_ifpforlinklocal(ifp, ignflags)) == NULL) + if ((ia6 = in6ifa_ifpforlinklocal(ifp, ignflags)) == NULL) return; - if ((ia->ia6_flags & IN6_IFF_TENTATIVE)) - ia = NULL; + if ((ia6->ia6_flags & IN6_IFF_TENTATIVE)) + ia6 = NULL; /* * Allocate mbufs to store ip6 header and MLD header. @@ -418,7 +418,7 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) /* ip6_plen will be set later */ ip6->ip6_nxt = IPPROTO_ICMPV6; /* ip6_hlim will be set by im6o.im6o_multicast_hlim */ - ip6->ip6_src = ia ? ia->ia_addr.sin6_addr : in6addr_any; + ip6->ip6_src = ia6 ? ia6->ia_addr.sin6_addr : in6addr_any; ip6->ip6_dst = dst ? *dst : in6m->in6m_addr; /* fill in the MLD header */ @@ -464,6 +464,6 @@ mld6_sendpkt(struct in6_multi *in6m, int type, const struct in6_addr *dst) break; } - ip6_output(mh, &ip6_opts, NULL, ia ? 0 : IPV6_UNSPECSRC, &im6o, NULL, + ip6_output(mh, &ip6_opts, NULL, ia6 ? 0 : IPV6_UNSPECSRC, &im6o, NULL, NULL); } diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 03a8bf648ed..8b6d863f9ce 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.108 2014/01/10 14:29:08 tedu Exp $ */ +/* $OpenBSD: nd6.c,v 1.109 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -1264,18 +1264,18 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) s = splsoftnet(); /* First purge the addresses referenced by a prefix. */ LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, npr) { - struct in6_ifaddr *ia, *ia_next; + struct in6_ifaddr *ia6, *ia6_next; if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr)) continue; /* XXX */ /* do we really have to remove addresses as well? */ - TAILQ_FOREACH_SAFE(ia, &in6_ifaddr, ia_list, ia_next) { - if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) + TAILQ_FOREACH_SAFE(ia6, &in6_ifaddr, ia_list, ia6_next) { + if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; - if (ia->ia6_ndpr == pr) - in6_purgeaddr(&ia->ia_ifa); + if (ia6->ia6_ndpr == pr) + in6_purgeaddr(&ia6->ia_ifa); } } /* diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index b45c56b49d0..587a561cc93 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.73 2014/01/07 17:07:46 mikeb Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.74 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -1123,7 +1123,7 @@ nd6_dad_stoptimer(struct dadq *dp) void nd6_dad_start(struct ifaddr *ifa, int *tick) { - struct in6_ifaddr *ia = ifatoia6(ifa); + struct in6_ifaddr *ia6 = ifatoia6(ifa); struct dadq *dp; char addr[INET6_ADDRSTRLEN]; @@ -1138,21 +1138,21 @@ nd6_dad_start(struct ifaddr *ifa, int *tick) * - DAD is disabled (ip6_dad_count == 0) * - the interface address is anycast */ - if (!(ia->ia6_flags & IN6_IFF_TENTATIVE)) { + if (!(ia6->ia6_flags & IN6_IFF_TENTATIVE)) { log(LOG_DEBUG, "nd6_dad_start: called with non-tentative address " "%s(%s)\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), ifa->ifa_ifp ? ifa->ifa_ifp->if_xname : "???"); return; } - if (ia->ia6_flags & IN6_IFF_ANYCAST) { - ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + if (ia6->ia6_flags & IN6_IFF_ANYCAST) { + ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; return; } if (!ip6_dad_count) { - ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; return; } if (!ifa->ifa_ifp) @@ -1168,7 +1168,7 @@ nd6_dad_start(struct ifaddr *ifa, int *tick) if (dp == NULL) { log(LOG_ERR, "nd6_dad_start: memory allocation failed for " "%s(%s)\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), ifa->ifa_ifp ? ifa->ifa_ifp->if_xname : "???"); return; @@ -1178,7 +1178,7 @@ nd6_dad_start(struct ifaddr *ifa, int *tick) ip6_dad_pending++; nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", ifa->ifa_ifp->if_xname, - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, addr, sizeof(addr)))); + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)))); /* * Send NS packet for DAD, ip6_dad_count times. @@ -1237,14 +1237,14 @@ void nd6_dad_timer(struct ifaddr *ifa) { int s; - struct in6_ifaddr *ia = ifatoia6(ifa); + struct in6_ifaddr *ia6 = ifatoia6(ifa); struct dadq *dp; char addr[INET6_ADDRSTRLEN]; s = splsoftnet(); /* XXX */ /* Sanity check */ - if (ia == NULL) { + if (ia6 == NULL) { log(LOG_ERR, "nd6_dad_timer: called with null parameter\n"); goto done; } @@ -1253,18 +1253,18 @@ nd6_dad_timer(struct ifaddr *ifa) log(LOG_ERR, "nd6_dad_timer: DAD structure not found\n"); goto done; } - if (ia->ia6_flags & IN6_IFF_DUPLICATED) { + if (ia6->ia6_flags & IN6_IFF_DUPLICATED) { log(LOG_ERR, "nd6_dad_timer: called with duplicated address " "%s(%s)\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), ifa->ifa_ifp ? ifa->ifa_ifp->if_xname : "???"); goto done; } - if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) { + if ((ia6->ia6_flags & IN6_IFF_TENTATIVE) == 0) { log(LOG_ERR, "nd6_dad_timer: called with non-tentative address " "%s(%s)\n", - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), ifa->ifa_ifp ? ifa->ifa_ifp->if_xname : "???"); goto done; @@ -1322,12 +1322,12 @@ nd6_dad_timer(struct ifaddr *ifa) * We are done with DAD. No NA came, no NS came. * duplicated address found. */ - ia->ia6_flags &= ~IN6_IFF_TENTATIVE; + ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; nd6log((LOG_DEBUG, "%s: DAD complete for %s - no duplicates found\n", ifa->ifa_ifp->if_xname, - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)))); TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list); @@ -1345,7 +1345,7 @@ done: void nd6_dad_duplicated(struct ifaddr *ifa) { - struct in6_ifaddr *ia = ifatoia6(ifa); + struct in6_ifaddr *ia6 = ifatoia6(ifa); struct dadq *dp; char addr[INET6_ADDRSTRLEN]; @@ -1358,18 +1358,18 @@ nd6_dad_duplicated(struct ifaddr *ifa) log(LOG_ERR, "%s: DAD detected duplicate IPv6 address %s: " "NS in/out=%d/%d, NA in=%d\n", ifa->ifa_ifp->if_xname, - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, addr, sizeof(addr)), + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr)), dp->dad_ns_icount, dp->dad_ns_ocount, dp->dad_na_icount); - ia->ia6_flags &= ~IN6_IFF_TENTATIVE; - ia->ia6_flags |= IN6_IFF_DUPLICATED; + ia6->ia6_flags &= ~IN6_IFF_TENTATIVE; + ia6->ia6_flags |= IN6_IFF_DUPLICATED; /* We are done with DAD, with duplicated address found. (failure) */ nd6_dad_stoptimer(dp); log(LOG_ERR, "%s: DAD complete for %s - duplicate found\n", ifa->ifa_ifp->if_xname, - inet_ntop(AF_INET6, &ia->ia_addr.sin6_addr, addr, sizeof(addr))); + inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr, addr, sizeof(addr))); log(LOG_ERR, "%s: manual intervention required\n", ifa->ifa_ifp->if_xname); @@ -1383,7 +1383,7 @@ nd6_dad_duplicated(struct ifaddr *ifa) void nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) { - struct in6_ifaddr *ia = ifatoia6(ifa); + struct in6_ifaddr *ia6 = ifatoia6(ifa); struct ifnet *ifp = ifa->ifa_ifp; dp->dad_ns_tcount++; @@ -1401,13 +1401,13 @@ nd6_dad_ns_output(struct dadq *dp, struct ifaddr *ifa) } dp->dad_ns_ocount++; - nd6_ns_output(ifp, NULL, &ia->ia_addr.sin6_addr, NULL, 1); + nd6_ns_output(ifp, NULL, &ia6->ia_addr.sin6_addr, NULL, 1); } void nd6_dad_ns_input(struct ifaddr *ifa) { - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct in6_addr *taddr6; struct dadq *dp; int duplicate; @@ -1415,8 +1415,8 @@ nd6_dad_ns_input(struct ifaddr *ifa) if (!ifa) panic("ifa == NULL in nd6_dad_ns_input"); - ia = ifatoia6(ifa); - taddr6 = &ia->ia_addr.sin6_addr; + ia6 = ifatoia6(ifa); + taddr6 = &ia6->ia_addr.sin6_addr; duplicate = 0; dp = nd6_dad_find(ifa); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 5779c4ab37e..280def0d385 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_rtr.c,v 1.76 2014/01/10 14:29:08 tedu Exp $ */ +/* $OpenBSD: nd6_rtr.c,v 1.77 2014/01/13 23:03:52 bluhm Exp $ */ /* $KAME: nd6_rtr.c,v 1.97 2001/02/07 11:09:13 itojun Exp $ */ /* @@ -905,7 +905,7 @@ void purge_detached(struct ifnet *ifp) { struct nd_prefix *pr, *pr_next; - struct in6_ifaddr *ia; + struct in6_ifaddr *ia6; struct ifaddr *ifa, *ifa_next; LIST_FOREACH_SAFE(pr, &nd_prefix, ndpr_entry, pr_next) { @@ -925,9 +925,9 @@ purge_detached(struct ifnet *ifp) TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrlist, ifa_list, ifa_next) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; - ia = ifatoia6(ifa); - if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == - IN6_IFF_AUTOCONF && ia->ia6_ndpr == pr) { + ia6 = ifatoia6(ifa); + if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == + IN6_IFF_AUTOCONF && ia6->ia6_ndpr == pr) { in6_purgeaddr(ifa); } } @@ -1176,33 +1176,33 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) * should reject autoconfiguration of a new address. */ TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { - struct in6_ifaddr *ifa6; + struct in6_ifaddr *ia6; int ifa_plen; u_int32_t storedlifetime; if (ifa->ifa_addr->sa_family != AF_INET6) continue; - ifa6 = ifatoia6(ifa); + ia6 = ifatoia6(ifa); /* * Spec is not clear here, but I believe we should concentrate * 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; - ifa_plen = in6_mask2len(&ifa6->ia_prefixmask.sin6_addr, NULL); + ifa_plen = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL); if (ifa_plen != new->ndpr_plen || - !in6_are_prefix_equal(&ifa6->ia_addr.sin6_addr, + !in6_are_prefix_equal(&ia6->ia_addr.sin6_addr, &new->ndpr_prefix.sin6_addr, ifa_plen)) continue; if (ia6_match == NULL) /* remember the first one */ - ia6_match = ifa6; + ia6_match = ia6; - if ((ifa6->ia6_flags & IN6_IFF_AUTOCONF) == 0) { + if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == 0) { statique = 1; continue; } @@ -1230,25 +1230,25 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) * See the discussion in the IETF ipngwg ML in August 2001, * with the Subject "StoredLifetime in RFC 2462". */ - lt6_tmp = ifa6->ia6_lifetime; + lt6_tmp = ia6->ia6_lifetime; /* RFC 4941 temporary addresses (privacy extension). */ - if (ifa6->ia6_flags & IN6_IFF_PRIVACY) { + if (ia6->ia6_flags & IN6_IFF_PRIVACY) { /* Do we still have a non-deprecated address? */ - if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) == 0) + if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) == 0) tempaddr_preferred = 1; /* Don't extend lifetime for temporary addresses. */ if (new->ndpr_vltime >= lt6_tmp.ia6t_vltime) continue; if (new->ndpr_pltime >= lt6_tmp.ia6t_pltime) continue; - } else if ((ifa6->ia6_flags & IN6_IFF_DEPRECATED) == 0) + } else if ((ia6->ia6_flags & IN6_IFF_DEPRECATED) == 0) /* We have a regular SLAAC address. */ autoconf = 1; if (lt6_tmp.ia6t_vltime == ND6_INFINITE_LIFETIME) storedlifetime = ND6_INFINITE_LIFETIME; - else if (time_second - ifa6->ia6_updatetime > + else if (time_second - ia6->ia6_updatetime > lt6_tmp.ia6t_vltime) { /* * The case of "invalid" address. We should usually @@ -1257,7 +1257,7 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) storedlifetime = 0; } else storedlifetime = lt6_tmp.ia6t_vltime - - (time_second - ifa6->ia6_updatetime); + (time_second - ia6->ia6_updatetime); if (TWOHOUR < new->ndpr_vltime || storedlifetime < new->ndpr_vltime) { lt6_tmp.ia6t_vltime = new->ndpr_vltime; @@ -1287,8 +1287,8 @@ prelist_update(struct nd_prefix *new, struct nd_defrouter *dr, struct mbuf *m) in6_init_address_ltimes(pr, <6_tmp); - ifa6->ia6_lifetime = lt6_tmp; - ifa6->ia6_updatetime = time_second; + ia6->ia6_lifetime = lt6_tmp; + ia6->ia6_updatetime = time_second; } if ((!autoconf || ((ifp->if_xflags & IFXF_INET6_NOPRIVACY) == 0 && @@ -1426,7 +1426,7 @@ void pfxlist_onlink_check(void) { struct nd_prefix *pr; - struct in6_ifaddr *ifa; + struct in6_ifaddr *ia6; char addr[INET6_ADDRSTRLEN]; /* @@ -1532,11 +1532,11 @@ pfxlist_onlink_check(void) * always be attached. * The precise detection logic is same as the one for prefixes. */ - TAILQ_FOREACH(ifa, &in6_ifaddr, ia_list) { - if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) { + if (!(ia6->ia6_flags & IN6_IFF_AUTOCONF)) continue; - if (ifa->ia6_ndpr == NULL) { + if (ia6->ia6_ndpr == NULL) { /* * This can happen when we first configure the address * (i.e. the address exists, but the prefix does not). @@ -1545,29 +1545,29 @@ pfxlist_onlink_check(void) continue; } - if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) + if (find_pfxlist_reachable_router(ia6->ia6_ndpr)) break; } - if (ifa) { - TAILQ_FOREACH(ifa, &in6_ifaddr, ia_list) { - if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) + if (ia6) { + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) { + if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; - if (ifa->ia6_ndpr == NULL) /* XXX: see above. */ + if (ia6->ia6_ndpr == NULL) /* XXX: see above. */ continue; - if (find_pfxlist_reachable_router(ifa->ia6_ndpr)) - ifa->ia6_flags &= ~IN6_IFF_DETACHED; + if (find_pfxlist_reachable_router(ia6->ia6_ndpr)) + ia6->ia6_flags &= ~IN6_IFF_DETACHED; else - ifa->ia6_flags |= IN6_IFF_DETACHED; + ia6->ia6_flags |= IN6_IFF_DETACHED; } } else { - TAILQ_FOREACH(ifa, &in6_ifaddr, ia_list) { - if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) + TAILQ_FOREACH(ia6, &in6_ifaddr, ia_list) { + if ((ia6->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; - ifa->ia6_flags &= ~IN6_IFF_DETACHED; + ia6->ia6_flags &= ~IN6_IFF_DETACHED; } } } @@ -1801,7 +1801,7 @@ in6_ifadd(struct nd_prefix *pr, int privacy) struct ifnet *ifp = pr->ndpr_ifp; struct ifaddr *ifa; struct in6_aliasreq ifra; - struct in6_ifaddr *ia, *ib; + struct in6_ifaddr *ia6; int error, s, plen0; struct in6_addr mask, rand_ifid; int prefixlen = pr->ndpr_plen; @@ -1830,7 +1830,7 @@ in6_ifadd(struct nd_prefix *pr, int privacy) */ ifa = &in6ifa_ifpforlinklocal(ifp, 0)->ia_ifa; /* 0 is OK? */ if (ifa) - ib = ifatoia6(ifa); + ia6 = ifatoia6(ifa); else return NULL; @@ -1843,7 +1843,7 @@ in6_ifadd(struct nd_prefix *pr, int privacy) #endif /* prefixlen + ifidlen must be equal to 128 */ - plen0 = in6_mask2len(&ib->ia_prefixmask.sin6_addr, NULL); + plen0 = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL); if (prefixlen != plen0) { nd6log((LOG_INFO, "in6_ifadd: wrong prefixlen for %s " "(prefix=%d ifid=%d)\n", @@ -1885,13 +1885,13 @@ in6_ifadd(struct nd_prefix *pr, int privacy) (rand_ifid.s6_addr32[3] & ~mask.s6_addr32[3]); } else { ifra.ifra_addr.sin6_addr.s6_addr32[0] |= - (ib->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); + (ia6->ia_addr.sin6_addr.s6_addr32[0] & ~mask.s6_addr32[0]); ifra.ifra_addr.sin6_addr.s6_addr32[1] |= - (ib->ia_addr.sin6_addr.s6_addr32[1] & ~mask.s6_addr32[1]); + (ia6->ia_addr.sin6_addr.s6_addr32[1] & ~mask.s6_addr32[1]); ifra.ifra_addr.sin6_addr.s6_addr32[2] |= - (ib->ia_addr.sin6_addr.s6_addr32[2] & ~mask.s6_addr32[2]); + (ia6->ia_addr.sin6_addr.s6_addr32[2] & ~mask.s6_addr32[2]); ifra.ifra_addr.sin6_addr.s6_addr32[3] |= - (ib->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); + (ia6->ia_addr.sin6_addr.s6_addr32[3] & ~mask.s6_addr32[3]); } /* new prefix mask. */ @@ -1936,9 +1936,8 @@ in6_ifadd(struct nd_prefix *pr, int privacy) return (NULL); /* ifaddr must not have been allocated. */ } - ia = in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr); - - return (ia); /* this is always non-NULL */ + /* this is always non-NULL */ + return (in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr)); } int