diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-09-06 02:40:43 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-09-06 02:40:43 +0000 |
commit | f729fe0a4a07f77cf2a60a88614a01b6bd649256 (patch) | |
tree | c9d6ec3dbd785e910055574e19a85daa63dc23d6 /sys/netinet6 | |
parent | 32d9aeaf2d0cb3d17941506155a2e52a94e50550 (diff) | |
download | FreeBSD-src-f729fe0a4a07f77cf2a60a88614a01b6bd649256.zip FreeBSD-src-f729fe0a4a07f77cf2a60a88614a01b6bd649256.tar.gz |
Wrap array accesses in macros, which also happen to be lvalues:
ifnet_addrs[i - 1] -> ifaddr_byindex(i)
ifindex2ifnet[i] -> ifnet_byindex(i)
This is intended to ease the conversion to SMPng.
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 2 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.c | 5 | ||||
-rw-r--r-- | sys/netinet6/in6_src.c | 9 | ||||
-rw-r--r-- | sys/netinet6/ip6_mroute.c | 2 | ||||
-rw-r--r-- | sys/netinet6/ip6_output.c | 12 | ||||
-rw-r--r-- | sys/netinet6/nd6.c | 2 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 2 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 4 |
8 files changed, 18 insertions, 20 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 529d122..c6d0d60 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -291,7 +291,7 @@ in6_ifindex2scopeid(idx) if (idx < 0 || if_index < idx) return -1; - ifp = ifindex2ifnet[idx]; + ifp = ifnet_byindex(idx); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index de4f1a8..5e8b3dd 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -424,8 +424,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) */ if (pi && pi->ipi6_ifindex) { /* XXX boundary check is assumed to be already done. */ - ia6 = in6_ifawithscope(ifindex2ifnet[pi->ipi6_ifindex], - dst); + ia6 = in6_ifawithscope(ifnet_byindex(pi->ipi6_ifindex), dst); if (ia6 == 0) { *errorp = EADDRNOTAVAIL; return(0); @@ -453,7 +452,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) *errorp = ENXIO; /* XXX: better error? */ return(0); } - ia6 = in6_ifawithscope(ifindex2ifnet[dstsock->sin6_scope_id], + ia6 = in6_ifawithscope(ifnet_byindex(dstsock->sin6_scope_id), dst); if (ia6 == 0) { *errorp = EADDRNOTAVAIL; diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 7bf28d2..708c4f5 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -141,8 +141,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) */ if (pi && pi->ipi6_ifindex) { /* XXX boundary check is assumed to be already done. */ - ia6 = in6_ifawithscope(ifindex2ifnet[pi->ipi6_ifindex], - dst); + ia6 = in6_ifawithscope(ifnet_byindex(pi->ipi6_ifindex), dst); if (ia6 == 0) { *errorp = EADDRNOTAVAIL; return(0); @@ -170,7 +169,7 @@ in6_selectsrc(dstsock, opts, mopts, ro, laddr, errorp) *errorp = ENXIO; /* XXX: better error? */ return(0); } - ia6 = in6_ifawithscope(ifindex2ifnet[dstsock->sin6_scope_id], + ia6 = in6_ifawithscope(ifnet_byindex(dstsock->sin6_scope_id), dst); if (ia6 == 0) { *errorp = EADDRNOTAVAIL; @@ -474,7 +473,7 @@ in6_embedscope(in6, sin6, in6p, ifpp) if (in6p && in6p->in6p_outputopts && (pi = in6p->in6p_outputopts->ip6po_pktinfo) && pi->ipi6_ifindex) { - ifp = ifindex2ifnet[pi->ipi6_ifindex]; + ifp = ifnet_byindex(pi->ipi6_ifindex); in6->s6_addr16[1] = htons(pi->ipi6_ifindex); } else if (in6p && IN6_IS_ADDR_MULTICAST(in6) && in6p->in6p_moptions && @@ -485,7 +484,7 @@ in6_embedscope(in6, sin6, in6p, ifpp) /* boundary check */ if (scopeid < 0 || if_index < scopeid) return ENXIO; /* XXX EINVAL? */ - ifp = ifindex2ifnet[scopeid]; + ifp = ifnet_byindex(scopeid); /*XXX assignment to 16bit from 32bit variable */ in6->s6_addr16[1] = htons(scopeid & 0xffff); } diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 2be8796..bb200da 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -546,7 +546,7 @@ add_m6if(mifcp) return EADDRINUSE; /* XXX: is it appropriate? */ if (mifcp->mif6c_pifi == 0 || mifcp->mif6c_pifi > if_index) return ENXIO; - ifp = ifindex2ifnet[mifcp->mif6c_pifi]; + ifp = ifnet_byindex(mifcp->mif6c_pifi); if (mifcp->mif6c_flags & MIFF_REGISTER) { if (reg_mif_num == (mifi_t)-1) { diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index fbe8821..41b25b6c 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -613,7 +613,7 @@ skip_ipsec2:; * Boundary check for ifindex is assumed to be already done. */ if (opt && opt->ip6po_pktinfo && opt->ip6po_pktinfo->ipi6_ifindex) - ifp = ifindex2ifnet[opt->ip6po_pktinfo->ipi6_ifindex]; + ifp = ifnet_byindex(opt->ip6po_pktinfo->ipi6_ifindex); /* * If the destination is a node-local scope multicast, @@ -795,9 +795,9 @@ skip_ipsec2:; */ origifp = NULL; if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) - origifp = ifindex2ifnet[ntohs(ip6->ip6_src.s6_addr16[1])]; + origifp = ifnet_byindex(ntohs(ip6->ip6_src.s6_addr16[1])); else if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) - origifp = ifindex2ifnet[ntohs(ip6->ip6_dst.s6_addr16[1])]; + origifp = ifnet_byindex(ntohs(ip6->ip6_dst.s6_addr16[1])); /* * XXX: origifp can be NULL even in those two cases above. * For example, if we remove the (only) link-local address @@ -1929,7 +1929,7 @@ ip6_setmoptions(optname, im6op, m) error = ENXIO; /* XXX EINVAL? */ break; } - ifp = ifindex2ifnet[ifindex]; + ifp = ifnet_byindex(ifindex); if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { error = EADDRNOTAVAIL; break; @@ -2038,7 +2038,7 @@ ip6_setmoptions(optname, im6op, m) rtfree(ro.ro_rt); } } else - ifp = ifindex2ifnet[mreq->ipv6mr_interface]; + ifp = ifnet_byindex(mreq->ipv6mr_interface); /* * See if we found an interface, and confirm that it @@ -2114,7 +2114,7 @@ ip6_setmoptions(optname, im6op, m) error = ENXIO; /* XXX EINVAL? */ break; } - ifp = ifindex2ifnet[mreq->ipv6mr_interface]; + ifp = ifnet_byindex(mreq->ipv6mr_interface); /* * Put interface index into the multicast address, * if the address has link-local scope. diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 1a6785c..6fa087a 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -183,7 +183,7 @@ nd6_ifattach(ifp) if (ND.basereachable) return; - ND.linkmtu = ifindex2ifnet[ifp->if_index]->if_mtu; + ND.linkmtu = ifnet_byindex(ifp->if_index)->if_mtu; ND.chlim = IPV6_DEFHLIM; ND.basereachable = REACHABLE_TIME; ND.reachable = ND_COMPUTE_RTIME(ND.basereachable); diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 120a25a..268884d 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -1959,7 +1959,7 @@ nd6_setdefaultiface(ifindex) if (nd6_defifindex != ifindex) { nd6_defifindex = ifindex; if (nd6_defifindex > 0) - nd6_defifp = ifindex2ifnet[nd6_defifindex]; + nd6_defifp = ifnet_byindex(nd6_defifindex); else nd6_defifp = NULL; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 1ee29cd..43aa54e 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -375,7 +375,7 @@ rip6_output(m, va_alist) */ if (optp && (pi = optp->ip6po_pktinfo) && pi->ipi6_ifindex) { ip6->ip6_dst.s6_addr16[1] = htons(pi->ipi6_ifindex); - oifp = ifindex2ifnet[pi->ipi6_ifindex]; + oifp = ifnet_byindex(pi->ipi6_ifindex); } else if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) && in6p->in6p_moptions && in6p->in6p_moptions->im6o_multicast_ifp) { @@ -410,7 +410,7 @@ rip6_output(m, va_alist) } ip6->ip6_src = *in6a; if (in6p->in6p_route.ro_rt) - oifp = ifindex2ifnet[in6p->in6p_route.ro_rt->rt_ifp->if_index]; + oifp = ifnet_byindex(in6p->in6p_route.ro_rt->rt_ifp->if_index); } ip6->ip6_flow = (ip6->ip6_flow & ~IPV6_FLOWINFO_MASK) | (in6p->in6p_flowinfo & IPV6_FLOWINFO_MASK); |