Use IFNET_FOREACH() and IFADDR_FOREACH().
This commit is contained in:
parent
5f717043e5
commit
5bbde3d775
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: icmp6.c,v 1.140 2007/11/01 20:33:56 dyoung Exp $ */
|
||||
/* $NetBSD: icmp6.c,v 1.141 2007/12/04 10:27:33 dyoung 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.140 2007/11/01 20:33:56 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.141 2007/12/04 10:27:33 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipsec.h"
|
||||
|
@ -1618,12 +1618,9 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m,
|
|||
}
|
||||
}
|
||||
|
||||
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
|
||||
{
|
||||
IFNET_FOREACH(ifp) {
|
||||
addrsofif = 0;
|
||||
for (ifa = ifp->if_addrlist.tqh_first; ifa;
|
||||
ifa = ifa->ifa_list.tqe_next)
|
||||
{
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
ifa6 = (struct in6_ifaddr *)ifa;
|
||||
|
@ -1703,9 +1700,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6,
|
|||
|
||||
for (; ifp; ifp = TAILQ_NEXT(ifp, if_list))
|
||||
{
|
||||
for (ifa = ifp->if_addrlist.tqh_first; ifa;
|
||||
ifa = ifa->ifa_list.tqe_next)
|
||||
{
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
ifa6 = (struct in6_ifaddr *)ifa;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6.c,v 1.135 2007/11/10 00:05:57 dyoung Exp $ */
|
||||
/* $NetBSD: in6.c,v 1.136 2007/12/04 10:27:33 dyoung 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.135 2007/11/10 00:05:57 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.136 2007/12/04 10:27:33 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_pfil_hooks.h"
|
||||
|
@ -1609,7 +1609,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, void *data,
|
|||
}
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
if (!cmp)
|
||||
|
@ -1706,7 +1706,7 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia,
|
|||
* if this is its first address,
|
||||
* and to validate the address if necessary.
|
||||
*/
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr == NULL)
|
||||
continue; /* just for safety */
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
|
@ -1762,7 +1762,7 @@ in6ifa_ifpforlinklocal(const struct ifnet *ifp, const int ignoreflags)
|
|||
{
|
||||
struct ifaddr *ifa;
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr == NULL)
|
||||
continue; /* just for safety */
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
|
@ -1787,7 +1787,7 @@ in6ifa_ifpwithaddr(const struct ifnet *ifp, const struct in6_addr *addr)
|
|||
{
|
||||
struct ifaddr *ifa;
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr == NULL)
|
||||
continue; /* just for safety */
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
|
@ -1981,7 +1981,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst)
|
|||
* If two or more, return one which matches the dst longest.
|
||||
* If none, return one of global addresses assigned other ifs.
|
||||
*/
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST)
|
||||
|
@ -2015,7 +2015,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst)
|
|||
if (besta)
|
||||
return besta;
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
if (((struct in6_ifaddr *)ifa)->ia6_flags & IN6_IFF_ANYCAST)
|
||||
|
@ -2051,7 +2051,7 @@ in6_if_up(struct ifnet *ifp)
|
|||
struct ifaddr *ifa;
|
||||
struct in6_ifaddr *ia;
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
continue;
|
||||
ia = (struct in6_ifaddr *)ifa;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6_ifattach.c,v 1.75 2007/11/10 00:14:31 dyoung Exp $ */
|
||||
/* $NetBSD: in6_ifattach.c,v 1.76 2007/12/04 10:27:33 dyoung 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.75 2007/11/10 00:14:31 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.76 2007/12/04 10:27:33 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -331,7 +331,7 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6)
|
|||
static u_int8_t allone[8] =
|
||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
sdl = satocsdl(ifa->ifa_addr);
|
||||
|
@ -854,6 +854,7 @@ in6_ifdetach(struct ifnet *ifp)
|
|||
/* remove neighbor management table */
|
||||
nd6_purge(ifp);
|
||||
|
||||
/* XXX this code is duplicated in in6_purgeif() --dyoung */
|
||||
/* nuke any of IPv6 addresses we have */
|
||||
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; ifa = next) {
|
||||
next = TAILQ_NEXT(ifa, ifa_list);
|
||||
|
@ -862,6 +863,8 @@ in6_ifdetach(struct ifnet *ifp)
|
|||
in6_purgeaddr(ifa);
|
||||
}
|
||||
|
||||
/* XXX isn't this code is redundant, given the above? --dyoung */
|
||||
/* XXX doesn't this code replicate code in in6_purgeaddr() ? --dyoung */
|
||||
/* undo everything done by in6_ifattach(), just in case */
|
||||
for (ifa = TAILQ_FIRST(&ifp->if_addrlist); ifa; ifa = next) {
|
||||
next = TAILQ_NEXT(ifa, ifa_list);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip6_input.c,v 1.112 2007/10/29 16:54:42 dyoung Exp $ */
|
||||
/* $NetBSD: ip6_input.c,v 1.113 2007/12/04 10:27:34 dyoung Exp $ */
|
||||
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -62,7 +62,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.112 2007/10/29 16:54:42 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.113 2007/12/04 10:27:34 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
|
@ -559,7 +559,7 @@ ip6_input(struct mbuf *m)
|
|||
* working right.
|
||||
*/
|
||||
struct ifaddr *ifa;
|
||||
TAILQ_FOREACH(ifa, &m->m_pkthdr.rcvif->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, m->m_pkthdr.rcvif) {
|
||||
if (ifa->ifa_addr == NULL)
|
||||
continue; /* just for safety */
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6.c,v 1.122 2007/11/10 00:07:57 dyoung Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.123 2007/12/04 10:27:34 dyoung Exp $ */
|
||||
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.122 2007/11/10 00:07:57 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.123 2007/12/04 10:27:34 dyoung Exp $");
|
||||
|
||||
#include "opt_ipsec.h"
|
||||
|
||||
|
@ -639,7 +639,7 @@ regen_tmpaddr(struct in6_ifaddr *ia6)
|
|||
struct in6_ifaddr *public_ifa6 = NULL;
|
||||
|
||||
ifp = ia6->ia_ifa.ifa_ifp;
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
struct in6_ifaddr *it6;
|
||||
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6_rtr.c,v 1.69 2007/11/10 00:14:32 dyoung Exp $ */
|
||||
/* $NetBSD: nd6_rtr.c,v 1.70 2007/12/04 10:27:34 dyoung 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.69 2007/11/10 00:14:32 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.70 2007/12/04 10:27:34 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -1095,7 +1095,7 @@ prelist_update(struct nd_prefixctl *new,
|
|||
* consider autoconfigured addresses while RFC2462 simply said
|
||||
* "address".
|
||||
*/
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
struct in6_ifaddr *ifa6;
|
||||
u_int32_t remaininglifetime;
|
||||
|
||||
|
@ -1554,7 +1554,7 @@ nd6_prefix_onlink(struct nd_prefix *pr)
|
|||
IN6_IFF_NOTREADY | IN6_IFF_ANYCAST);
|
||||
if (ifa == NULL) {
|
||||
/* XXX: freebsd does not have ifa_ifwithaf */
|
||||
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
if (ifa->ifa_addr->sa_family == AF_INET6)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xform_ipip.c,v 1.18 2007/10/28 15:48:23 adrianp Exp $ */
|
||||
/* $NetBSD: xform_ipip.c,v 1.19 2007/12/04 10:28:45 dyoung Exp $ */
|
||||
/* $FreeBSD: src/sys/netipsec/xform_ipip.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */
|
||||
/* $OpenBSD: ip_ipip.c,v 1.25 2002/06/10 18:04:55 itojun Exp $ */
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.18 2007/10/28 15:48:23 adrianp Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.19 2007/12/04 10:28:45 dyoung Exp $");
|
||||
|
||||
/*
|
||||
* IP-inside-IP processing
|
||||
|
@ -342,10 +342,8 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
|
|||
if ((m->m_pkthdr.rcvif == NULL ||
|
||||
!(m->m_pkthdr.rcvif->if_flags & IFF_LOOPBACK)) &&
|
||||
ipip_allow != 2) {
|
||||
for (ifp = ifnet.tqh_first; ifp != 0;
|
||||
ifp = ifp->if_list.tqe_next) {
|
||||
for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
|
||||
ifa = ifa->ifa_list.tqe_next) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
IFADDR_FOREACH(ifa, ifp) {
|
||||
#ifdef INET
|
||||
if (ipo) {
|
||||
if (ifa->ifa_addr->sa_family !=
|
||||
|
|
Loading…
Reference in New Issue