- Move IFNET_*() macros under #ifdef _KERNEL.
- Replace TAILQ_FOREACH on ifnet with IFNET_FOREACH().
This commit is contained in:
parent
25bb3b0e82
commit
f7741dab17
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: altq_subr.c,v 1.28 2009/01/04 18:41:36 pooka Exp $ */
|
||||
/* $NetBSD: altq_subr.c,v 1.29 2014/05/17 20:44:24 rmind Exp $ */
|
||||
/* $KAME: altq_subr.c,v 1.24 2005/04/13 03:44:25 suz Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.28 2009/01/04 18:41:36 pooka Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: altq_subr.c,v 1.29 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_altq.h"
|
||||
|
@ -356,7 +356,7 @@ tbr_timeout(void *arg)
|
|||
|
||||
active = 0;
|
||||
s = splnet();
|
||||
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list)) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
if (!TBR_IS_ENABLED(&ifp->if_snd))
|
||||
continue;
|
||||
active++;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vmt.c,v 1.8 2013/03/16 01:26:53 jmmv Exp $ */
|
||||
/* $NetBSD: vmt.c,v 1.9 2014/05/17 20:44:24 rmind Exp $ */
|
||||
/* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -806,7 +806,7 @@ vmt_tclo_tick(void *xarg)
|
|||
|
||||
/* find first available ipv4 address */
|
||||
guest_ip = NULL;
|
||||
TAILQ_FOREACH(iface, &ifnet, if_list) {
|
||||
IFNET_FOREACH(iface) {
|
||||
struct ifaddr *iface_addr;
|
||||
|
||||
/* skip loopback */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pf_if.c,v 1.24 2013/07/01 08:32:48 skrll Exp $ */
|
||||
/* $NetBSD: pf_if.c,v 1.25 2014/05/17 20:44:24 rmind 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.24 2013/07/01 08:32:48 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: pf_if.c,v 1.25 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_inet.h"
|
||||
|
@ -100,10 +100,6 @@ RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare);
|
|||
void
|
||||
pfi_initialize(void)
|
||||
{
|
||||
#ifdef __NetBSD__
|
||||
int i;
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
if (pfi_all != NULL) /* already initialized */
|
||||
return;
|
||||
|
||||
|
@ -122,14 +118,10 @@ pfi_initialize(void)
|
|||
panic("pfi_kif_get for pfi_all failed");
|
||||
|
||||
#ifdef __NetBSD__
|
||||
for (i = 0; i < if_indexlim; i++) {
|
||||
struct ifnet *ifp = ifindex2ifnet[i];
|
||||
|
||||
if (ifp != NULL) {
|
||||
pfi_init_groups(ifp);
|
||||
|
||||
pfi_attach_ifnet(ifp);
|
||||
}
|
||||
ifnet_t *ifp;
|
||||
IFNET_FOREACH(ifp) {
|
||||
pfi_init_groups(ifp);
|
||||
pfi_attach_ifnet(ifp);
|
||||
}
|
||||
|
||||
pfil_add_hook(pfil_ifnet_wrapper, NULL, PFIL_IFNET, if_pfil);
|
||||
|
@ -147,12 +139,10 @@ pfi_destroy(void)
|
|||
pfil_remove_hook(pfil_ifaddr_wrapper, NULL, PFIL_IFADDR, if_pfil);
|
||||
pfil_remove_hook(pfil_ifnet_wrapper, NULL, PFIL_IFNET, if_pfil);
|
||||
|
||||
for (i = 0; i < if_indexlim; i++) {
|
||||
struct ifnet *ifp = ifindex2ifnet[i];
|
||||
|
||||
if (ifp != NULL) {
|
||||
ifnet_t *ifp;
|
||||
IFNET_FOREACH(ifp) {
|
||||
if ((ifp = if_byindex(i)) != NULL) {
|
||||
pfi_detach_ifnet(ifp);
|
||||
|
||||
pfi_destroy_groups(ifp);
|
||||
}
|
||||
}
|
||||
|
|
20
sys/net/if.h
20
sys/net/if.h
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if.h,v 1.163 2014/04/26 11:16:22 pooka Exp $ */
|
||||
/* $NetBSD: if.h,v 1.164 2014/05/17 20:44:24 rmind Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -845,15 +845,6 @@ do { \
|
|||
MALLOC_DECLARE(M_IFADDR);
|
||||
MALLOC_DECLARE(M_IFMADDR);
|
||||
|
||||
#define IFNET_FIRST() TAILQ_FIRST(&ifnet)
|
||||
#define IFNET_NEXT(__ifp) TAILQ_NEXT((__ifp), if_list)
|
||||
#define IFNET_FOREACH(__ifp) TAILQ_FOREACH(__ifp, &ifnet, if_list)
|
||||
#define IFADDR_FIRST(__ifp) TAILQ_FIRST(&(__ifp)->if_addrlist)
|
||||
#define IFADDR_NEXT(__ifa) TAILQ_NEXT((__ifa), ifa_list)
|
||||
#define IFADDR_FOREACH(__ifa, __ifp) TAILQ_FOREACH(__ifa, \
|
||||
&(__ifp)->if_addrlist, ifa_list)
|
||||
#define IFADDR_EMPTY(__ifp) TAILQ_EMPTY(&(__ifp)->if_addrlist)
|
||||
|
||||
extern struct ifnet_head ifnet;
|
||||
extern struct ifnet **ifindex2ifnet;
|
||||
extern struct ifnet *lo0ifp;
|
||||
|
@ -954,6 +945,15 @@ __END_DECLS
|
|||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define IFNET_FIRST() TAILQ_FIRST(&ifnet)
|
||||
#define IFNET_NEXT(__ifp) TAILQ_NEXT((__ifp), if_list)
|
||||
#define IFNET_FOREACH(__ifp) TAILQ_FOREACH(__ifp, &ifnet, if_list)
|
||||
#define IFADDR_FIRST(__ifp) TAILQ_FIRST(&(__ifp)->if_addrlist)
|
||||
#define IFADDR_NEXT(__ifa) TAILQ_NEXT((__ifa), ifa_list)
|
||||
#define IFADDR_FOREACH(__ifa, __ifp) TAILQ_FOREACH(__ifa, \
|
||||
&(__ifp)->if_addrlist, ifa_list)
|
||||
#define IFADDR_EMPTY(__ifp) TAILQ_EMPTY(&(__ifp)->if_addrlist)
|
||||
|
||||
ifnet_t * if_byindex(u_int);
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ip_carp.c,v 1.54 2014/05/13 19:36:16 bouyer Exp $ */
|
||||
/* $NetBSD: ip_carp.c,v 1.55 2014/05/17 20:44:24 rmind Exp $ */
|
||||
/* $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@
|
|||
#include "opt_mbuftrace.h"
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.54 2014/05/13 19:36:16 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.55 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
|
@ -923,7 +923,7 @@ carp_send_ad_all(void)
|
|||
struct carp_if *cif;
|
||||
struct carp_softc *vh;
|
||||
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
if (ifp->if_carp == NULL || ifp->if_type == IFT_CARP)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6.c,v 1.169 2014/01/15 10:52:11 roy Exp $ */
|
||||
/* $NetBSD: in6.c,v 1.170 2014/05/17 20:44:24 rmind 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.169 2014/01/15 10:52:11 roy Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.170 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -2274,7 +2274,7 @@ in6_setmaxmtu(void)
|
|||
unsigned long maxmtu = 0;
|
||||
struct ifnet *ifp;
|
||||
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
/* this function can be called during ifnet initialization */
|
||||
if (!ifp->if_afdata[AF_INET6])
|
||||
continue;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: in6_ifattach.c,v 1.89 2013/10/25 15:44:39 martin Exp $ */
|
||||
/* $NetBSD: in6_ifattach.c,v 1.90 2014/05/17 20:44:24 rmind 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.89 2013/10/25 15:44:39 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.90 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -473,7 +473,7 @@ get_ifid(struct ifnet *ifp0, struct ifnet *altifp,
|
|||
}
|
||||
|
||||
/* next, try to get it from some other hardware interface */
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
if (ifp == ifp0)
|
||||
continue;
|
||||
if (in6_get_hw_ifid(ifp, in6) != 0)
|
||||
|
@ -962,7 +962,7 @@ in6_tmpaddrtimer(void *ignored_arg)
|
|||
ip6_temp_regen_advance) * hz, in6_tmpaddrtimer, NULL);
|
||||
|
||||
memset(nullbuf, 0, sizeof(nullbuf));
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
ndi = ND_IFINFO(ifp);
|
||||
if (memcmp(ndi->randomid, nullbuf, sizeof(nullbuf)) != 0) {
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nd6.c,v 1.148 2014/03/20 13:34:35 roy Exp $ */
|
||||
/* $NetBSD: nd6.c,v 1.149 2014/05/17 20:44:24 rmind 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.148 2014/03/20 13:34:35 roy Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.149 2014/05/17 20:44:24 rmind Exp $");
|
||||
|
||||
#include "opt_ipsec.h"
|
||||
|
||||
|
@ -2047,7 +2047,7 @@ nd6_slowtimo(void *ignored_arg)
|
|||
KERNEL_LOCK(1, NULL);
|
||||
callout_reset(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
|
||||
nd6_slowtimo, NULL);
|
||||
TAILQ_FOREACH(ifp, &ifnet, if_list) {
|
||||
IFNET_FOREACH(ifp) {
|
||||
nd6if = ND_IFINFO(ifp);
|
||||
if (nd6if->basereachable && /* already initialized */
|
||||
(nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {
|
||||
|
|
Loading…
Reference in New Issue