Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
This commit is contained in:
ozaki-r 2016-07-07 09:32:01 +00:00
parent b791414fa5
commit 9e4c2bda8a
37 changed files with 248 additions and 189 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmt.c,v 1.12 2016/05/12 02:24:16 ozaki-r Exp $ */
/* $NetBSD: vmt.c,v 1.13 2016/07/07 09:32:01 ozaki-r Exp $ */
/* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */
/*
@ -817,7 +817,7 @@ vmt_tclo_tick(void *xarg)
continue;
}
IFADDR_FOREACH(iface_addr, iface) {
IFADDR_READER_FOREACH(iface_addr, iface) {
if (iface_addr->ifa_addr->sa_family != AF_INET) {
continue;
}

View File

@ -1,9 +1,9 @@
/* $NetBSD: uipc_syscalls_40.c,v 1.10 2016/06/16 02:38:40 ozaki-r Exp $ */
/* $NetBSD: uipc_syscalls_40.c,v 1.11 2016/07/07 09:32:02 ozaki-r Exp $ */
/* written by Pavel Cahyna, 2006. Public domain. */
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.10 2016/06/16 02:38:40 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.11 2016/07/07 09:32:02 ozaki-r Exp $");
/*
* System call interface to the socket abstraction.
@ -60,7 +60,7 @@ compat_ifconf(u_long cmd, void *data)
error = ENAMETOOLONG;
goto release_exit;
}
if (IFADDR_EMPTY(ifp)) {
if (IFADDR_READER_EMPTY(ifp)) {
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
if (space >= sz) {
error = copyout(&ifr, ifrp, sz);
@ -72,7 +72,7 @@ compat_ifconf(u_long cmd, void *data)
continue;
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
struct sockaddr *sa = ifa->ifa_addr;
#ifdef COMPAT_OSOCK
if (cmd == OOSIOCGIFCONF) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_socket.c,v 1.130 2016/07/05 07:55:08 ozaki-r Exp $ */
/* $NetBSD: linux_socket.c,v 1.131 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.130 2016/07/05 07:55:08 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.131 2016/07/07 09:32:02 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -1150,7 +1150,7 @@ linux_getifconf(struct lwp *l, register_t *retval, void *data)
goto release_exit;
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sa = ifa->ifa_addr;
if (sa->sa_family != AF_INET ||
sa->sa_len > sizeof(*osa))
@ -1239,12 +1239,12 @@ linux_getifhwaddr(struct lwp *l, register_t *retval, u_int fd,
continue;
found=1;
if (IFADDR_EMPTY(ifp)) {
if (IFADDR_READER_EMPTY(ifp)) {
pserialize_read_exit(s);
error = ENODEV;
goto out;
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sadl = satosdl(ifa->ifa_addr);
/* only return ethernet addresses */
/* XXX what about FDDI, etc. ? */
@ -1282,7 +1282,7 @@ linux_getifhwaddr(struct lwp *l, register_t *retval, u_int fd,
IFNET_READER_FOREACH(ifp) {
memcpy(lreq.ifr_name, ifp->if_xname,
MIN(LINUX_IFNAMSIZ, IFNAMSIZ));
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sadl = satosdl(ifa->ifa_addr);
/* only return ethernet addresses */
/* XXX what about FDDI, etc. ? */

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux32_socket.c,v 1.24 2016/07/05 08:48:51 ozaki-r Exp $ */
/* $NetBSD: linux32_socket.c,v 1.25 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.24 2016/07/05 08:48:51 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.25 2016/07/07 09:32:02 ozaki-r Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -451,7 +451,7 @@ linux32_getifconf(struct lwp *l, register_t *retval, void *data)
goto release_exit;
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sa = ifa->ifa_addr;
if (sa->sa_family != AF_INET ||
sa->sa_len > sizeof(*osa))
@ -538,11 +538,11 @@ linux32_getifhwaddr(struct lwp *l, register_t *retval, u_int fd,
/* not this interface */
continue;
found=1;
if (IFADDR_EMPTY(ifp)) {
if (IFADDR_READER_EMPTY(ifp)) {
error = ENODEV;
goto out;
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sadl = satosdl(ifa->ifa_addr);
/* only return ethernet addresses */
/* XXX what about FDDI, etc. ? */
@ -575,7 +575,7 @@ linux32_getifhwaddr(struct lwp *l, register_t *retval, u_int fd,
IFNET_READER_FOREACH(ifp) {
memcpy(lreq.ifr_name, ifp->if_xname,
MIN(LINUX32_IFNAMSIZ, IFNAMSIZ));
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
sadl = satosdl(ifa->ifa_addr);
/* only return ethernet addresses */
/* XXX what about FDDI, etc. ? */

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_sockio.c,v 1.37 2016/05/12 02:24:16 ozaki-r Exp $ */
/* $NetBSD: svr4_sockio.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 1995, 2008 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: svr4_sockio.c,v 1.37 2016/05/12 02:24:16 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: svr4_sockio.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -88,7 +88,7 @@ svr4_count_ifnum(struct ifnet *ifp)
struct ifaddr *ifa;
int ifnum = 0;
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
ifnum++;
return MAX(1, ifnum);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_dmc.c,v 1.24 2016/04/20 09:01:04 knakahara Exp $ */
/* $NetBSD: if_dmc.c,v 1.25 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.24 2016/04/20 09:01:04 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_dmc.c,v 1.25 2016/07/07 09:32:02 ozaki-r Exp $");
#undef DMCDEBUG /* for base table dump on fatal error */
@ -313,10 +313,10 @@ dmcinit(struct ifnet *ifp)
* Check to see that an address has been set
* (both local and destination for an address family).
*/
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
if (ifa->ifa_addr->sa_family && ifa->ifa_dstaddr->sa_family)
break;
if (ifa == (struct ifaddr *) 0)
if (ifa == NULL)
return 0;
if ((DMC_RBYTE(DMC_BSEL1) & DMC_RUN) == 0) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: pf_if.c,v 1.29 2016/06/22 07:48:17 ozaki-r Exp $ */
/* $NetBSD: pf_if.c,v 1.30 2016/07/07 09:32:02 ozaki-r Exp $ */
/* $OpenBSD: pf_if.c,v 1.47 2007/07/13 09:17:48 markus Exp $ */
/*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pf_if.c,v 1.29 2016/06/22 07:48:17 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: pf_if.c,v 1.30 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -559,7 +559,7 @@ pfi_instance_add(struct ifnet *ifp, int net, int flags)
if (ifp == NULL)
return;
IFADDR_FOREACH(ia, ifp) {
IFADDR_READER_FOREACH(ia, ifp) {
af = ia->ifa_addr->sa_family;
if (af != AF_INET && af != AF_INET6)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_fil_netbsd.c,v 1.15 2016/06/20 06:46:37 knakahara Exp $ */
/* $NetBSD: ip_fil_netbsd.c,v 1.16 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (C) 2012 by Darren Reed.
@ -8,7 +8,7 @@
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.15 2016/06/20 06:46:37 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.16 2016/07/07 09:32:02 ozaki-r Exp $");
#else
static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@ -1545,7 +1545,7 @@ ipf_ifpaddr(ipf_main_softc_t *softc, int v, int atype, void *ifptr,
bzero((char *)inp, sizeof(*inp));
#endif
ifa = IFADDR_FIRST(ifp);
ifa = IFADDR_READER_FIRST(ifp);
sock = ifa ? ifa->ifa_addr : NULL;
while (sock != NULL && ifa != NULL) {
sin = (struct sockaddr_in *)sock;
@ -1559,7 +1559,7 @@ ipf_ifpaddr(ipf_main_softc_t *softc, int v, int atype, void *ifptr,
break;
}
#endif
ifa = IFADDR_NEXT(ifa);
ifa = IFADDR_READER_NEXT(ifa);
if (ifa != NULL)
sock = ifa->ifa_addr;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_agr.c,v 1.36 2016/06/20 06:46:37 knakahara Exp $ */
/* $NetBSD: if_agr.c,v 1.37 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c)2005 YAMAMOTO Takashi,
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.36 2016/06/20 06:46:37 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_agr.c,v 1.37 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -591,7 +591,7 @@ agr_addport(struct ifnet *ifp, struct ifnet *ifp_port)
}
port->port_flags = AGRPORT_LARVAL;
IFADDR_FOREACH(ifa, ifp_port) {
IFADDR_READER_FOREACH(ifa, ifp_port) {
if (ifa->ifa_addr->sa_family != AF_LINK) {
error = EBUSY;
goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.353 2016/07/05 07:42:51 knakahara Exp $ */
/* $NetBSD: if.c,v 1.354 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.353 2016/07/05 07:42:51 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.354 2016/07/07 09:32:02 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -496,8 +496,9 @@ if_activate_sadl(struct ifnet *ifp, struct ifaddr *ifa,
if_deactivate_sadl(ifp);
if_sadl_setrefs(ifp, ifa);
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
rtinit(ifa, RTM_LLINFO_UPD, 0);
splx(s);
}
@ -656,6 +657,7 @@ if_initialize(ifnet_t *ifp)
}
PSLIST_ENTRY_INIT(ifp, if_pslist_entry);
PSLIST_INIT(&ifp->if_addr_pslist);
psref_target_init(&ifp->if_psref, ifnet_psref_class);
ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
@ -1026,7 +1028,8 @@ if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *))
{
struct ifaddr *ifa, *nifa;
IFADDR_FOREACH_SAFE(ifa, ifp, nifa) {
for (ifa = IFADDR_READER_FIRST(ifp); ifa; ifa = nifa) {
nifa = IFADDR_READER_NEXT(ifa);
if (ifa->ifa_addr->sa_family != family)
continue;
(*purgeaddr)(ifa);
@ -1047,7 +1050,7 @@ if_build_ifa_list(struct ifnet *ifp)
KASSERT(ifa_list == NULL);
KASSERT(ifa_list_size == 0);
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
ifa_list_size++;
ifa_list = kmem_alloc(sizeof(*ifa) * ifa_list_size, KM_SLEEP);
@ -1055,7 +1058,7 @@ if_build_ifa_list(struct ifnet *ifp)
return;
i = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
ifa_list[i++] = ifa;
ifaref(ifa);
}
@ -1180,7 +1183,7 @@ if_detach(struct ifnet *ifp)
* least one ifaddr.
*/
again:
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
family = ifa->ifa_addr->sa_family;
#ifdef IFAREF_DEBUG
printf("if_detach: ifaddr %p, family %d, refcnt %d\n",
@ -1566,6 +1569,8 @@ ifa_insert(struct ifnet *ifp, struct ifaddr *ifa)
{
ifa->ifa_ifp = ifp;
TAILQ_INSERT_TAIL(&ifp->if_addrlist, ifa, ifa_list);
IFADDR_ENTRY_INIT(ifa);
IFADDR_WRITER_INSERT_TAIL(ifp, ifa);
ifaref(ifa);
}
@ -1574,6 +1579,9 @@ ifa_remove(struct ifnet *ifp, struct ifaddr *ifa)
{
KASSERT(ifa->ifa_ifp == ifp);
TAILQ_REMOVE(&ifp->if_addrlist, ifa, ifa_list);
IFADDR_WRITER_REMOVE(ifa);
/* TODO psref_target_destroy */
IFADDR_ENTRY_DESTROY(ifa);
ifafree(ifa);
}
@ -1598,7 +1606,7 @@ ifa_ifwithaddr(const struct sockaddr *addr)
IFNET_READER_FOREACH(ifp) {
if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != addr->sa_family)
continue;
if (equal(addr, ifa->ifa_addr))
@ -1632,7 +1640,7 @@ ifa_ifwithdstaddr(const struct sockaddr *addr)
continue;
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
continue;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != addr->sa_family ||
ifa->ifa_dstaddr == NULL)
continue;
@ -1694,7 +1702,7 @@ ifa_ifwithnet(const struct sockaddr *addr)
IFNET_READER_FOREACH(ifp) {
if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
const char *cp, *cp2, *cp3;
if (ifa->ifa_addr->sa_family != af ||
@ -1749,7 +1757,7 @@ ifa_ifwithaf(int af)
IFNET_READER_FOREACH(ifp) {
if (if_is_deactivated(ifp))
continue;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == af)
goto out;
}
@ -1778,7 +1786,7 @@ ifaof_ifpforaddr(const struct sockaddr *addr, struct ifnet *ifp)
if (af >= AF_MAX)
return NULL;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != af)
continue;
ifa_maybe = ifa;
@ -2031,7 +2039,7 @@ p2p_rtrequest(int req, struct rtentry *rt,
rt->rt_ifp = lo0ifp;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (equal(rt_getkey(rt), ifa->ifa_addr))
break;
}
@ -2041,7 +2049,7 @@ p2p_rtrequest(int req, struct rtentry *rt,
/*
* Ensure lo0 has an address of the same family.
*/
IFADDR_FOREACH(lo0ifa, lo0ifp) {
IFADDR_READER_FOREACH(lo0ifa, lo0ifp) {
if (lo0ifa->ifa_addr->sa_family ==
ifa->ifa_addr->sa_family)
break;
@ -2076,7 +2084,7 @@ if_down(struct ifnet *ifp)
ifp->if_flags &= ~IFF_UP;
nanotime(&ifp->if_lastchange);
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
pfctlinput(PRC_IFDOWN, ifa->ifa_addr);
IFQ_PURGE(&ifp->if_snd);
#if NCARP > 0
@ -2107,7 +2115,7 @@ if_up(struct ifnet *ifp)
nanotime(&ifp->if_lastchange);
#ifdef notyet
/* this has no effect on IP, and will kill all ISO connections XXX */
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
pfctlinput(PRC_IFUP, ifa->ifa_addr);
#endif
#if NCARP > 0
@ -2528,7 +2536,7 @@ ifaddrpref_ioctl(struct socket *so, u_long cmd, void *data, struct ifnet *ifp)
sockaddr_externalize(&v.sa, sizeof(v.ss), sa);
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != sa->sa_family)
continue;
sockaddr_externalize(&u.sa, sizeof(u.ss), ifa->ifa_addr);
@ -2775,7 +2783,7 @@ ifconf(u_long cmd, void *data)
error = ENAMETOOLONG;
goto release_exit;
}
if (IFADDR_EMPTY(ifp)) {
if (IFADDR_READER_EMPTY(ifp)) {
/* Interface with no addresses - send zero sockaddr. */
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
if (!docopy) {
@ -2791,7 +2799,7 @@ ifconf(u_long cmd, void *data)
}
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
struct sockaddr *sa = ifa->ifa_addr;
/* all sockaddrs must fit in sockaddr_storage */
KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru));

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.h,v 1.219 2016/06/30 09:44:58 ozaki-r Exp $ */
/* $NetBSD: if.h,v 1.220 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -341,6 +341,7 @@ typedef struct ifnet {
uint16_t if_link_queue; /* masked link state change queue */
struct pslist_entry if_pslist_entry;
struct psref_target if_psref;
struct pslist_head if_addr_pslist;
#endif
} ifnet_t;
@ -598,6 +599,9 @@ struct ifaddr {
const struct sockaddr *);
uint32_t *ifa_seqno;
int16_t ifa_preference; /* preference level for this address */
#ifdef _KERNEL
struct pslist_entry ifa_pslist_entry;
#endif
};
#define IFA_ROUTE RTF_UP /* (0x01) route installed */
@ -1052,6 +1056,52 @@ __END_DECLS
&(__ifp)->if_addrlist, ifa_list, __nifa)
#define IFADDR_EMPTY(__ifp) TAILQ_EMPTY(&(__ifp)->if_addrlist)
#define IFADDR_ENTRY_INIT(__ifa) \
PSLIST_ENTRY_INIT((__ifa), ifa_pslist_entry)
#define IFADDR_ENTRY_DESTROY(__ifa) \
PSLIST_ENTRY_DESTROY((__ifa), ifa_pslist_entry)
#define IFADDR_READER_EMPTY(__ifp) \
(PSLIST_READER_FIRST(&(__ifp)->if_addr_pslist, struct ifaddr, \
ifa_pslist_entry) == NULL)
#define IFADDR_READER_FIRST(__ifp) \
PSLIST_READER_FIRST(&(__ifp)->if_addr_pslist, struct ifaddr, \
ifa_pslist_entry)
#define IFADDR_READER_NEXT(__ifa) \
PSLIST_READER_NEXT((__ifa), struct ifaddr, ifa_pslist_entry)
#define IFADDR_READER_FOREACH(__ifa, __ifp) \
PSLIST_READER_FOREACH((__ifa), &(__ifp)->if_addr_pslist, struct ifaddr,\
ifa_pslist_entry)
#define IFADDR_WRITER_INSERT_HEAD(__ifp, __ifa) \
PSLIST_WRITER_INSERT_HEAD(&(__ifp)->if_addr_pslist, (__ifa), \
ifa_pslist_entry)
#define IFADDR_WRITER_REMOVE(__ifa) \
PSLIST_WRITER_REMOVE((__ifa), ifa_pslist_entry)
#define IFADDR_WRITER_FOREACH(__ifa, __ifp) \
PSLIST_WRITER_FOREACH((__ifa), &(__ifp)->if_addr_pslist, struct ifaddr,\
ifa_pslist_entry)
#define IFADDR_WRITER_NEXT(__ifp) \
PSLIST_WRITER_NEXT((__ifp), struct ifaddr, ifa_pslist_entry)
#define IFADDR_WRITER_INSERT_AFTER(__ifp, __new) \
PSLIST_WRITER_INSERT_AFTER((__ifp), (__new), ifa_pslist_entry)
#define IFADDR_WRITER_EMPTY(__ifp) \
(PSLIST_WRITER_FIRST(&(__ifp)->if_addr_pslist, struct ifaddr, \
ifa_pslist_entry) == NULL)
#define IFADDR_WRITER_INSERT_TAIL(__ifp, __new) \
do { \
if (IFADDR_WRITER_EMPTY((__ifp))) { \
IFADDR_WRITER_INSERT_HEAD((__ifp), (__new)); \
} else { \
struct ifaddr *__ifa; \
IFADDR_WRITER_FOREACH(__ifa, (__ifp)) { \
if (IFADDR_WRITER_NEXT(__ifa) == NULL) {\
IFADDR_WRITER_INSERT_AFTER(__ifa,\
(__new)); \
break; \
} \
} \
} \
} while (0)
#define IFNET_LOCK() mutex_enter(&ifnet_mtx)
#define IFNET_UNLOCK() mutex_exit(&ifnet_mtx)
#define IFNET_LOCKED() mutex_owned(&ifnet_mtx)

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_spppsubr.c,v 1.145 2016/07/06 05:27:52 ozaki-r Exp $ */
/* $NetBSD: if_spppsubr.c,v 1.146 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.145 2016/07/06 05:27:52 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.146 2016/07/07 09:32:02 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@ -4821,7 +4821,7 @@ sppp_get_ip_addrs(struct sppp *sp, uint32_t *src, uint32_t *dst, uint32_t *srcma
* aliases don't make any sense on a p2p link anyway.
*/
si = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
sm = (struct sockaddr_in *)ifa->ifa_netmask;
@ -4861,7 +4861,7 @@ sppp_set_ip_addrs(struct sppp *sp, uint32_t myaddr, uint32_t hisaddr)
* aliases don't make any sense on a p2p link anyway.
*/
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
dest = (struct sockaddr_in *)ifa->ifa_dstaddr;
@ -4940,7 +4940,7 @@ sppp_clear_ip_addrs(struct sppp *sp)
* aliases don't make any sense on a p2p link anyway.
*/
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
dest = (struct sockaddr_in *)ifa->ifa_dstaddr;
@ -4996,7 +4996,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
* aliases don't make any sense on a p2p link anyway.
*/
si = 0;
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
if (ifa->ifa_addr->sa_family == AF_INET6) {
si = (struct sockaddr_in6 *)ifa->ifa_addr;
sm = (struct sockaddr_in6 *)ifa->ifa_netmask;
@ -5049,7 +5049,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)
*/
sin6 = NULL;
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
{
if (ifa->ifa_addr->sa_family == AF_INET6)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_stf.c,v 1.94 2016/07/06 08:42:34 ozaki-r Exp $ */
/* $NetBSD: if_stf.c,v 1.95 2016/07/07 09:32:02 ozaki-r Exp $ */
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
@ -75,7 +75,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.94 2016/07/06 08:42:34 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.95 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -313,7 +313,7 @@ stf_getsrcifa6(struct ifnet *ifp)
struct sockaddr_in6 *sin6;
struct in_addr in;
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
{
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tun.c,v 1.126 2016/06/10 13:27:16 ozaki-r Exp $ */
/* $NetBSD: if_tun.c,v 1.127 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.126 2016/06/10 13:27:16 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.127 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -361,7 +361,7 @@ tunclose(dev_t dev, int flag, int mode,
if (ifp->if_flags & IFF_RUNNING) {
/* find internet addresses and delete routes */
struct ifaddr *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
#if defined(INET) || defined(INET6)
if (ifa->ifa_addr->sa_family == AF_INET ||
ifa->ifa_addr->sa_family == AF_INET6) {
@ -393,7 +393,7 @@ tuninit(struct tun_softc *tp)
ifp->if_flags |= IFF_UP | IFF_RUNNING;
tp->tun_flags &= ~(TUN_IASET|TUN_DSTADDR);
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in *sin;

View File

@ -1,4 +1,4 @@
/* $NetBSD: link_proto.c,v 1.30 2016/01/21 15:41:29 riastradh Exp $ */
/* $NetBSD: link_proto.c,v 1.31 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.30 2016/01/21 15:41:29 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.31 2016/07/07 09:32:02 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@ -170,7 +170,7 @@ link_control(struct socket *so, unsigned long cmd, void *data,
s = splnet();
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (sockaddr_cmp(&u.sa, ifa->ifa_addr) == 0)
break;
}
@ -178,7 +178,7 @@ link_control(struct socket *so, unsigned long cmd, void *data,
switch (cmd) {
case SIOCGLIFADDR:
if ((iflr->flags & IFLR_PREFIX) == 0) {
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == AF_LINK)
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.190 2016/06/16 02:38:40 ozaki-r Exp $ */
/* $NetBSD: rtsock.c,v 1.191 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.190 2016/06/16 02:38:40 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.191 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1468,7 +1468,7 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
IFNET_READER_FOREACH(ifp) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
if (IFADDR_EMPTY(ifp))
if (IFADDR_READER_EMPTY(ifp))
continue;
psref_acquire(&psref, &ifp->if_psref, ifnet_psref_class);
@ -1530,7 +1530,7 @@ sysctl_iflist(int af, struct rt_walkarg *w, int type)
panic("sysctl_iflist(2)");
}
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (af && af != ifa->ifa_addr->sa_family)
continue;
info.rti_info[RTAX_IFA] = ifa->ifa_addr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: aarp.c,v 1.37 2016/06/20 06:46:38 knakahara Exp $ */
/* $NetBSD: aarp.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.37 2016/06/20 06:46:38 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $");
#include "opt_mbuftrace.h"
@ -135,7 +135,7 @@ at_ifawithnet(const struct sockaddr_at *sat, struct ifnet *ifp)
struct sockaddr_at *sat2;
struct netrange *nr;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_APPLETALK)
continue;
@ -367,7 +367,7 @@ at_aarpinput(struct ifnet *ifp, struct mbuf *m)
* Since we don't know the net, we just look for the first
* phase 1 address on the interface.
*/
IFADDR_FOREACH(ia, ifp) {
IFADDR_READER_FOREACH(ia, ifp) {
aa = (struct at_ifaddr *)ia;
if (AA_SAT(aa)->sat_family == AF_APPLETALK &&
(aa->aa_flags & AFA_PHASE2) == 0)
@ -560,7 +560,7 @@ aarpprobe(void *arp)
* interface with the same address as we're looking for. If the
* net is phase 2, generate an 802.2 and SNAP header.
*/
IFADDR_FOREACH(ia, ifp) {
IFADDR_READER_FOREACH(ia, ifp) {
aa = (struct at_ifaddr *)ia;
if (AA_SAT(aa)->sat_family == AF_APPLETALK &&
(aa->aa_flags & AFA_PROBING))

View File

@ -1,4 +1,4 @@
/* $NetBSD: at_control.c,v 1.37 2014/10/18 08:33:29 snj Exp $ */
/* $NetBSD: at_control.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 1990,1994 Regents of The University of Michigan.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.37 2014/10/18 08:33:29 snj Exp $");
__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.38 2016/07/07 09:32:02 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -830,7 +830,7 @@ aa_clean(void)
TAILQ_REMOVE(&at_ifaddr, aa, aa_list);
ifp = aa->aa_ifp;
at_scrub(ifp, aa);
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa == &aa->aa_ifa)
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in.c,v 1.171 2016/07/06 08:42:34 ozaki-r Exp $ */
/* $NetBSD: in.c,v 1.172 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.171 2016/07/06 08:42:34 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.172 2016/07/07 09:32:02 ozaki-r Exp $");
#include "arp.h"
@ -874,7 +874,7 @@ in_lifaddr_ioctl(struct socket *so, u_long cmd, void *data,
}
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
if (cmp == 0)
@ -1191,7 +1191,7 @@ in_broadcast(struct in_addr in, struct ifnet *ifp)
* with a broadcast address.
*/
#define ia (ifatoia(ifa))
IFADDR_FOREACH(ifa, ifp)
IFADDR_READER_FOREACH(ifa, ifp)
if (ifa->ifa_addr->sa_family == AF_INET &&
!in_hosteq(in, ia->ia_addr.sin_addr) &&
(in_hosteq(in, ia->ia_broadaddr.sin_addr) ||
@ -1222,7 +1222,7 @@ in_if_link_up(struct ifnet *ifp)
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
return;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
ia = (struct in_ifaddr *)ifa;
@ -1261,7 +1261,7 @@ in_if_link_down(struct ifnet *ifp)
struct ifaddr *ifa;
struct in_ifaddr *ia;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
ia = (struct in_ifaddr *)ifa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_selsrc.c,v 1.16 2015/09/21 13:32:26 skrll Exp $ */
/* $NetBSD: in_selsrc.c,v 1.17 2016/07/07 09:32:02 ozaki-r Exp $ */
/*-
* Copyright (c) 2005 David Young. All rights reserved.
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_selsrc.c,v 1.16 2015/09/21 13:32:26 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_selsrc.c,v 1.17 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -326,7 +326,7 @@ in_getifa(struct ifaddr *ifa, const struct sockaddr *dst0)
/* Find out the index of this ifaddr. */
idx = 0;
IFADDR_FOREACH(alt_ifa, ifa->ifa_ifp) {
IFADDR_READER_FOREACH(alt_ifa, ifa->ifa_ifp) {
if (alt_ifa == best_ifa)
break;
idx++;
@ -344,7 +344,7 @@ in_getifa(struct ifaddr *ifa, const struct sockaddr *dst0)
#endif /* GETIFA_DEBUG */
idx = -1;
IFADDR_FOREACH(alt_ifa, ifa->ifa_ifp) {
IFADDR_READER_FOREACH(alt_ifa, ifa->ifa_ifp) {
++idx;
src = IA_SIN(alt_ifa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_carp.c,v 1.73 2016/07/06 08:42:34 ozaki-r Exp $ */
/* $NetBSD: ip_carp.c,v 1.74 2016/07/07 09:32:02 ozaki-r Exp $ */
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
/*
@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.73 2016/07/06 08:42:34 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.74 2016/07/07 09:32:02 ozaki-r Exp $");
/*
* TODO:
@ -284,7 +284,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found = 0;
last = cur;
cur.s_addr = 0xffffffff;
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr;
if (ifa->ifa_addr->sa_family == AF_INET &&
ntohl(in.s_addr) > ntohl(last.s_addr) &&
@ -304,7 +304,7 @@ carp_hmac_prepare(struct carp_softc *sc)
found = 0;
last6 = cur6;
memset(&cur6, 0xff, sizeof(cur6));
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
in6 = ifatoia6(ifa)->ia_addr.sin6_addr;
if (IN6_IS_ADDR_LINKLOCAL(&in6))
in6.s6_addr16[1] = 0;
@ -363,7 +363,7 @@ carp_setroute(struct carp_softc *sc, int cmd)
KERNEL_LOCK(1, NULL);
s = splsoftnet();
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
switch (ifa->ifa_addr->sa_family) {
case AF_INET: {
int count = 0;
@ -1193,7 +1193,7 @@ carp_send_arp(struct carp_softc *sc)
KERNEL_LOCK(1, NULL);
s = splsoftnet();
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
@ -1217,7 +1217,7 @@ carp_send_na(struct carp_softc *sc)
KERNEL_LOCK(1, NULL);
s = splsoftnet();
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
@ -1279,7 +1279,7 @@ carp_addrcount(struct carp_if *cif, struct in_ifaddr *ia, int type)
(vh->sc_if.if_flags & (IFF_UP|IFF_RUNNING)) ==
(IFF_UP|IFF_RUNNING)) ||
(type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) {
IFADDR_FOREACH(ifa, &vh->sc_if) {
IFADDR_READER_FOREACH(ifa, &vh->sc_if) {
if (ifa->ifa_addr->sa_family == AF_INET &&
ia->ia_addr.sin_addr.s_addr ==
ifatoia(ifa)->ia_addr.sin_addr.s_addr)
@ -1335,7 +1335,7 @@ carp_iamatch6(void *v, struct in6_addr *taddr)
struct ifaddr *ifa;
TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) {
IFADDR_FOREACH(ifa, &vh->sc_if) {
IFADDR_READER_FOREACH(ifa, &vh->sc_if) {
if (IN6_ARE_ADDR_EQUAL(taddr,
&ifatoia6(ifa)->ia_addr.sin6_addr) &&
((vh->sc_if.if_flags & (IFF_UP|IFF_RUNNING)) ==
@ -1683,7 +1683,7 @@ carp_addr_updated(void *v)
struct ifaddr *ifa;
int new_naddrs = 0, new_naddrs6 = 0;
IFADDR_FOREACH(ifa, &sc->sc_if) {
IFADDR_READER_FOREACH(ifa, &sc->sc_if) {
if (ifa->ifa_addr->sa_family == AF_INET)
new_naddrs++;
else if (ifa->ifa_addr->sa_family == AF_INET6)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_icmp.c,v 1.148 2016/07/06 08:42:34 ozaki-r Exp $ */
/* $NetBSD: ip_icmp.c,v 1.149 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -94,7 +94,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.148 2016/07/06 08:42:34 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_icmp.c,v 1.149 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -721,7 +721,7 @@ icmp_reflect(struct mbuf *m)
/* look for packet sent to broadcast address */
if (ia == NULL && rcvif &&
(rcvif->if_flags & IFF_BROADCAST)) {
IFADDR_FOREACH(ifa, rcvif) {
IFADDR_READER_FOREACH(ifa, rcvif) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
if (in_hosteq(t,ifatoia(ifa)->ia_broadaddr.sin_addr)) {
@ -776,7 +776,7 @@ icmp_reflect(struct mbuf *m)
* when the incoming packet was encapsulated
*/
if (sin == NULL && rcvif) {
IFADDR_FOREACH(ifa, rcvif) {
IFADDR_READER_FOREACH(ifa, rcvif) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
sin = &(ifatoia(ifa)->ia_addr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_input.c,v 1.335 2016/07/06 08:42:34 ozaki-r Exp $ */
/* $NetBSD: ip_input.c,v 1.336 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.335 2016/07/06 08:42:34 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.336 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -394,7 +394,7 @@ ip_match_our_address_broadcast(struct ifnet *ifp, struct ip *ip)
struct in_ifaddr *ia = NULL;
struct ifaddr *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET)
continue;
ia = ifatoia(ifa);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sctp_asconf.c,v 1.4 2016/07/07 06:54:26 ozaki-r Exp $ */
/* $NetBSD: sctp_asconf.c,v 1.5 2016/07/07 09:32:02 ozaki-r Exp $ */
/* $KAME: sctp_asconf.c,v 1.25 2005/06/16 20:44:24 jinmei Exp $ */
/*
@ -30,7 +30,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.4 2016/07/07 06:54:26 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp_asconf.c,v 1.5 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -2123,7 +2123,7 @@ sctp_find_valid_localaddr(struct sctp_tcb *stcb)
/* Skip if loopback_scope not set */
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (ifa->ifa_addr->sa_family == AF_INET &&
stcb->asoc.ipv4_addr_legal) {
struct sockaddr_in *sin;
@ -2790,7 +2790,7 @@ sctp_check_address_list_all(struct sctp_tcb *stcb, struct mbuf *m, int offset,
}
/* go through each interface address */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
/* do i have it implicitly? */
if (sctp_cmpaddr(ifa->ifa_addr, init_addr)) {
#ifdef SCTP_DEBUG

View File

@ -1,4 +1,4 @@
/* $NetBSD: sctp_output.c,v 1.6 2016/06/10 13:31:44 ozaki-r Exp $ */
/* $NetBSD: sctp_output.c,v 1.7 2016/07/07 09:32:02 ozaki-r Exp $ */
/* $KAME: sctp_output.c,v 1.48 2005/06/16 18:29:24 jinmei Exp $ */
/*
@ -30,7 +30,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.6 2016/06/10 13:31:44 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp_output.c,v 1.7 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_ipsec.h"
@ -546,7 +546,7 @@ sctp_choose_v4_boundspecific_inp(struct sctp_inpcb *inp,
ifn = rt->rt_ifp;
if (ifn) {
/* is a prefered one on the interface we route out? */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
continue;
@ -555,7 +555,7 @@ sctp_choose_v4_boundspecific_inp(struct sctp_inpcb *inp,
}
}
/* is an acceptable one on the interface we route out? */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
continue;
@ -648,7 +648,7 @@ sctp_choose_v4_boundspecific_stcb(struct sctp_inpcb *inp,
*/
if (ifn) {
/* first try for an prefered address on the ep */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_addr_in_ep(inp, ifa)) {
sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
@ -662,7 +662,7 @@ sctp_choose_v4_boundspecific_stcb(struct sctp_inpcb *inp,
}
}
/* next try for an acceptable address on the ep */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_addr_in_ep(inp, ifa)) {
sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
@ -762,7 +762,7 @@ sctp_choose_v4_boundspecific_stcb(struct sctp_inpcb *inp,
continue;
/* first question, is laddr->ifa an address associated with the emit interface */
if (ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (laddr->ifa == ifa) {
sin = (struct sockaddr_in *)laddr->ifa->ifa_addr;
return (sin->sin_addr);
@ -786,7 +786,7 @@ sctp_choose_v4_boundspecific_stcb(struct sctp_inpcb *inp,
continue;
/* first question, is laddr->ifa an address associated with the emit interface */
if (ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (laddr->ifa == ifa) {
sin = (struct sockaddr_in *)laddr->ifa->ifa_addr;
return (sin->sin_addr);
@ -836,7 +836,7 @@ sctp_select_v4_nth_prefered_addr_from_ifn_boundall (struct ifnet *ifn, struct sc
struct sockaddr_in *sin;
uint8_t sin_loop, sin_local;
int num_eligible_addr = 0;
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
continue;
@ -864,7 +864,7 @@ sctp_count_v4_num_prefered_boundall (struct ifnet *ifn, struct sctp_tcb *stcb, i
struct sockaddr_in *sin;
int num_eligible_addr = 0;
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_prefered (ifa, loopscope, ipv4_scope, sin_loop, sin_local);
if (sin == NULL)
continue;
@ -957,7 +957,7 @@ sctp_choose_v4_boundall(struct sctp_inpcb *inp,
* and see if we can find an acceptable address.
*/
bound_all_v4_plan_b:
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
continue;
@ -1037,7 +1037,7 @@ sctp_choose_v4_boundall(struct sctp_inpcb *inp,
/* already looked at this guy */
continue;
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin = sctp_is_v4_ifa_addr_acceptable (ifa, loopscope, ipv4_scope, &sin_loop, &sin_local);
if (sin == NULL)
continue;
@ -1304,7 +1304,7 @@ sctp_choose_v6_boundspecific_stcb(struct sctp_inpcb *inp,
* in our list, if so, we want that one.
*/
if (ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_addr_in_ep(inp, ifa)) {
sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local);
if (sin6 == NULL)
@ -1405,7 +1405,7 @@ sctp_choose_v6_boundspecific_stcb(struct sctp_inpcb *inp,
continue;
/* first question, is laddr->ifa an address associated with the emit interface */
if (ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (laddr->ifa == ifa) {
sin6 = (struct sockaddr_in6 *)laddr->ifa->ifa_addr;
return (sin6);
@ -1484,7 +1484,7 @@ sctp_choose_v6_boundspecific_inp(struct sctp_inpcb *inp,
ifn = rt->rt_ifp;
if (ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local);
if (sin6 == NULL)
continue;
@ -1554,7 +1554,7 @@ sctp_select_v6_nth_addr_from_ifn_boundall (struct ifnet *ifn, struct sctp_tcb *s
int sin_loop, sin_local;
int num_eligible_addr = 0;
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local);
if (sin6 == NULL)
continue;
@ -1602,7 +1602,7 @@ sctp_count_v6_num_eligible_boundall (struct ifnet *ifn, struct sctp_tcb *stcb,
int num_eligible_addr = 0;
int sin_loop, sin_local;
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
sin6 = sctp_is_v6_ifa_addr_acceptable (ifa, loopscope, loc_scope, &sin_loop, &sin_local);
if (sin6 == NULL)
continue;
@ -2737,7 +2737,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
*/
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_address_in_scope(ifa,
stcb->asoc.ipv4_addr_legal,
stcb->asoc.ipv6_addr_legal,
@ -2763,7 +2763,7 @@ sctp_send_initiate(struct sctp_inpcb *inp, struct sctp_tcb *stcb)
*/
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_address_in_scope(ifa,
stcb->asoc.ipv4_addr_legal,
stcb->asoc.ipv6_addr_legal,
@ -3688,7 +3688,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
*/
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_address_in_scope(ifa,
stc.ipv4_addr_legal, stc.ipv6_addr_legal,
stc.loopback_scope, stc.ipv4_scope,
@ -3711,7 +3711,7 @@ sctp_send_initiate_ack(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
*/
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (sctp_is_address_in_scope(ifa,
stc.ipv4_addr_legal,
stc.ipv6_addr_legal,

View File

@ -1,5 +1,5 @@
/* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */
/* $NetBSD: sctp_pcb.c,v 1.6 2016/05/22 22:18:41 rjs Exp $ */
/* $NetBSD: sctp_pcb.c,v 1.7 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.6 2016/05/22 22:18:41 rjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.7 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -2342,7 +2342,7 @@ sctp_is_address_on_local_host(struct sockaddr *addr)
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (addr->sa_family == ifa->ifa_addr->sa_family) {
/* same family */
if (addr->sa_family == AF_INET) {

View File

@ -1,5 +1,5 @@
/* $KAME: sctp_usrreq.c,v 1.50 2005/06/16 20:45:29 jinmei Exp $ */
/* $NetBSD: sctp_usrreq.c,v 1.5 2016/05/12 02:24:17 ozaki-r Exp $ */
/* $NetBSD: sctp_usrreq.c,v 1.6 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.5 2016/05/12 02:24:17 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp_usrreq.c,v 1.6 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -950,7 +950,7 @@ sctp_fill_up_addresses(struct sctp_inpcb *inp,
/* Skip loopback if loopback_scope not set */
continue;
}
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
if (stcb) {
/*
* For the BOUND-ALL case, the list
@ -1103,7 +1103,7 @@ sctp_count_max_addresses(struct sctp_inpcb *inp)
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifn) {
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
/* Count them if they are the right type */
if (ifa->ifa_addr->sa_family == AF_INET) {
if (inp->sctp_flags & SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)
@ -3850,7 +3850,7 @@ static int
sctp_purgeif(struct socket *so, struct ifnet *ifp)
{
struct ifaddr *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == PF_INET) {
sctp_delete_ip_address(ifa);
}

View File

@ -1,5 +1,5 @@
/* $KAME: sctputil.c,v 1.39 2005/06/16 20:54:06 jinmei Exp $ */
/* $NetBSD: sctputil.c,v 1.9 2016/06/10 13:27:16 ozaki-r Exp $ */
/* $NetBSD: sctputil.c,v 1.10 2016/07/07 09:32:02 ozaki-r Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.9 2016/06/10 13:27:16 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctputil.c,v 1.10 2016/07/07 09:32:02 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -3613,7 +3613,7 @@ sctp_find_ifa_by_addr(struct sockaddr *sa)
s = pserialize_read_enter();
IFNET_READER_FOREACH(ifn) {
/* go through each interface addresses */
IFADDR_FOREACH(ifa, ifn) {
IFADDR_READER_FOREACH(ifa, ifn) {
/* correct family? */
if (ifa->ifa_addr->sa_family != sa->sa_family)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: icmp6.c,v 1.191 2016/07/05 03:40:52 ozaki-r Exp $ */
/* $NetBSD: icmp6.c,v 1.192 2016/07/07 09:32:03 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.191 2016/07/05 03:40:52 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.192 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1684,7 +1684,7 @@ ni6_addrs(struct icmp6_nodeinfo *ni6, struct mbuf *m,
IFNET_READER_FOREACH(ifp) {
addrsofif = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia6 = (struct in6_ifaddr *)ifa;
@ -1764,7 +1764,7 @@ ni6_store_addrs(struct icmp6_nodeinfo *ni6,
for (; ifp; ifp = IFNET_READER_NEXT(ifp))
{
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia6 = (struct in6_ifaddr *)ifa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6.c,v 1.206 2016/07/06 10:49:49 ozaki-r Exp $ */
/* $NetBSD: in6.c,v 1.207 2016/07/07 09:32:03 ozaki-r 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.206 2016/07/06 10:49:49 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.207 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1593,7 +1593,7 @@ in6_lifaddr_ioctl(struct socket *so, u_long cmd, void *data,
}
}
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
if (!cmp)
@ -1689,7 +1689,7 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia,
* if this is its first address,
* and to validate the address if necessary.
*/
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ifacount++;
@ -1757,7 +1757,7 @@ in6ifa_ifpforlinklocal(const struct ifnet *ifp, const int ignoreflags)
{
struct ifaddr *best_ifa = NULL, *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
if (!IN6_IS_ADDR_LINKLOCAL(IFA_IN6(ifa)))
@ -1807,7 +1807,7 @@ in6ifa_ifpwithaddr(const struct ifnet *ifp, const struct in6_addr *addr)
{
struct ifaddr *best_ifa = NULL, *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
if (!IN6_ARE_ADDR_EQUAL(addr, IFA_IN6(ifa)))
@ -1972,7 +1972,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.
*/
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;
@ -2009,7 +2009,7 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst)
if (best_ia != NULL)
return best_ia;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;
@ -2054,7 +2054,7 @@ in6_if_link_up(struct ifnet *ifp)
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
return;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;
@ -2118,7 +2118,7 @@ in6_if_link_down(struct ifnet *ifp)
/* Any prefixes on this interface should be detached as well */
pfxlist_onlink_check();
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_ifattach.c,v 1.100 2016/07/04 06:48:14 ozaki-r Exp $ */
/* $NetBSD: in6_ifattach.c,v 1.101 2016/07/07 09:32:03 ozaki-r 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.100 2016/07/04 06:48:14 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.101 2016/07/07 09:32:03 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -325,7 +325,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 };
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_LINK)
continue;
tsdl = satocsdl(ifa->ifa_addr);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip6_input.c,v 1.163 2016/07/06 10:49:49 ozaki-r Exp $ */
/* $NetBSD: ip6_input.c,v 1.164 2016/07/07 09:32:03 ozaki-r 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.163 2016/07/06 10:49:49 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.164 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_gateway.h"
@ -534,7 +534,7 @@ ip6_input(struct mbuf *m, struct ifnet *rcvif)
* working right.
*/
struct ifaddr *ifa;
IFADDR_FOREACH(ifa, rcvif) {
IFADDR_READER_FOREACH(ifa, rcvif) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
if (IN6_ARE_ADDR_EQUAL(IFA_IN6(ifa), &ip6->ip6_dst)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mld6.c,v 1.70 2016/07/04 06:48:14 ozaki-r Exp $ */
/* $NetBSD: mld6.c,v 1.71 2016/07/07 09:32:03 ozaki-r Exp $ */
/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
/*
@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.70 2016/07/04 06:48:14 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.71 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -997,7 +997,7 @@ in6_multicast_sysctl(SYSCTLFN_ARGS)
if (oldp == NULL) {
*oldlenp = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ifa6 = (struct in6_ifaddr *)ifa;
@ -1013,7 +1013,7 @@ in6_multicast_sysctl(SYSCTLFN_ARGS)
error = 0;
written = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ifa6 = (struct in6_ifaddr *)ifa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6.c,v 1.201 2016/07/05 06:32:18 ozaki-r Exp $ */
/* $NetBSD: nd6.c,v 1.202 2016/07/07 09:32:03 ozaki-r 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.201 2016/07/05 06:32:18 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.202 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@ -687,7 +687,7 @@ regen_tmpaddr(const struct in6_ifaddr *ia6)
struct in6_ifaddr *public_ifa6 = NULL;
ifp = ia6->ia_ifa.ifa_ifp;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
struct in6_ifaddr *it6;
if (ifa->ifa_addr->sa_family != AF_INET6)
@ -1692,7 +1692,7 @@ nd6_ioctl(u_long cmd, void *data, struct ifnet *ifp)
*/
int duplicated_linklocal = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;
@ -1720,7 +1720,7 @@ nd6_ioctl(u_long cmd, void *data, struct ifnet *ifp)
/* Mark all IPv6 addresses as tentative. */
ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
nd6_dad_stop(ifa);
@ -1746,7 +1746,7 @@ nd6_ioctl(u_long cmd, void *data, struct ifnet *ifp)
*/
int haslinklocal = 0;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family !=AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: nd6_rtr.c,v 1.114 2016/07/05 03:40:52 ozaki-r Exp $ */
/* $NetBSD: nd6_rtr.c,v 1.115 2016/07/07 09:32:03 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.114 2016/07/05 03:40:52 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.115 2016/07/07 09:32:03 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -913,7 +913,8 @@ purge_detached(struct ifnet *ifp)
!LIST_EMPTY(&pr->ndpr_advrtrs)))
continue;
IFADDR_FOREACH_SAFE(ifa, ifp, ifa_next) {
for (ifa = IFADDR_READER_FIRST(ifp); ifa; ifa = ifa_next) {
ifa_next = IFADDR_READER_NEXT(ifa);
if (ifa->ifa_addr->sa_family != AF_INET6)
continue;
ia = (struct in6_ifaddr *)ifa;
@ -1186,7 +1187,7 @@ prelist_update(struct nd_prefixctl *newprc,
* consider autoconfigured addresses while RFC2462 simply said
* "address".
*/
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
struct in6_ifaddr *ia6;
u_int32_t remaininglifetime;
@ -1643,7 +1644,7 @@ nd6_prefix_onlink(struct nd_prefix *pr)
IN6_IFF_NOTREADY | IN6_IFF_ANYCAST);
if (ifa == NULL) {
/* XXX: freebsd does not have ifa_ifwithaf */
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == AF_INET6)
break;
}

View File

@ -1,5 +1,5 @@
/* $KAME: sctp6_usrreq.c,v 1.38 2005/08/24 08:08:56 suz Exp $ */
/* $NetBSD: sctp6_usrreq.c,v 1.5 2016/06/10 13:31:44 ozaki-r Exp $ */
/* $NetBSD: sctp6_usrreq.c,v 1.6 2016/07/07 09:32:03 ozaki-r Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@ -33,7 +33,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.5 2016/06/10 13:31:44 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: sctp6_usrreq.c,v 1.6 2016/07/07 09:32:03 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -1295,7 +1295,7 @@ static int
sctp6_purgeif(struct socket *so, struct ifnet *ifp)
{
struct ifaddr *ifa;
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
if (ifa->ifa_addr->sa_family == PF_INET6) {
sctp_delete_ip_address(ifa);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: xform_ipip.c,v 1.41 2016/07/04 04:35:09 knakahara Exp $ */
/* $NetBSD: xform_ipip.c,v 1.42 2016/07/07 09:32:03 ozaki-r 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.41 2016/07/04 04:35:09 knakahara Exp $");
__KERNEL_RCSID(0, "$NetBSD: xform_ipip.c,v 1.42 2016/07/07 09:32:03 ozaki-r Exp $");
/*
* IP-inside-IP processing
@ -335,7 +335,7 @@ _ipip_input(struct mbuf *m, int iphlen, struct ifnet *gifp)
ipip_allow != 2) {
int s = pserialize_read_enter();
IFNET_READER_FOREACH(ifp) {
IFADDR_FOREACH(ifa, ifp) {
IFADDR_READER_FOREACH(ifa, ifp) {
#ifdef INET
if (ipo) {
if (ifa->ifa_addr->sa_family !=