Naming the list like the struct itself makes for awful grepping.
Call the global variable "ifnetlist" from now on.
There used to be kvm(3) consumers in base picking up this symbol, but those
have long been converted to other interfaces.
A few potential ports users remain, same deal as sys/net/if_var.h r1.116
"Remove struct ifnet's unused if_switchport member": they get bumped.
Previous users pointed out by deraadt
OK bluhm
-/* $OpenBSD: autoconf.c,v 1.54 2022/09/02 20:06:55 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.55 2022/09/08 10:22:05 kn Exp $ */
/* $NetBSD: autoconf.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
if (bios_bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bios_bootmac->mac,
((struct arpcom *)ifp)->ac_enaddr,
-/* $OpenBSD: autoconf.c,v 1.13 2022/09/02 20:06:55 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.14 2022/09/08 10:22:06 kn Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
if (bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bootmac, ((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
-/* $OpenBSD: autoconf.c,v 1.11 2022/09/02 20:06:55 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.12 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: autoconf.c,v 1.2 2001/09/05 16:17:36 matt Exp $ */
/*
if (bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bootmac, ((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
-/* $OpenBSD: autoconf.c,v 1.107 2022/09/02 20:06:55 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.108 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */
/*-
if (bios_bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bios_bootmac->mac,
((struct arpcom *)ifp)->ac_enaddr,
-/* $OpenBSD: autoconf.c,v 1.8 2022/09/02 20:06:56 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.9 2022/09/08 10:22:06 kn Exp $ */
/*
* Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
if (bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bootmac, ((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
-/* $OpenBSD: autoconf.c,v 1.5 2022/09/02 20:06:56 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.6 2022/09/08 10:22:06 kn Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
if (bootmac) {
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_type == IFT_ETHER &&
memcmp(bootmac, ((struct arpcom *)ifp)->ac_enaddr,
ETHER_ADDR_LEN) == 0)
KERNEL_LOCK();
s = splnet();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (!memcmp(LLADDR(ifp->if_sadl), enaddr, ETHER_ADDR_LEN))
break;
}
-/* $OpenBSD: vmt.c,v 1.25 2022/01/09 05:42:58 jsg Exp $ */
+/* $OpenBSD: vmt.c,v 1.26 2022/09/08 10:22:06 kn Exp $ */
/*
* Copyright (c) 2007 David Crawshaw <david@zentus.com>
/* find first available ipv4 address */
guest_ip = NULL;
- TAILQ_FOREACH(iface, &ifnet, if_list) {
+ TAILQ_FOREACH(iface, &ifnetlist, if_list) {
struct ifaddr *iface_addr;
/* skip loopback */
}
nics = 0;
- TAILQ_FOREACH(iface, &ifnet, if_list) {
+ TAILQ_FOREACH(iface, &ifnetlist, if_list) {
nictotal = vmt_xdr_nic_entry(iface, data);
if (nictotal == 0)
continue;
-/* $OpenBSD: if.c,v 1.664 2022/09/02 13:12:31 mvs Exp $ */
+/* $OpenBSD: if.c,v 1.665 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
struct srp_gc if_ifp_gc = SRP_GC_INITIALIZER(if_ifp_dtor, NULL);
struct srp_gc if_map_gc = SRP_GC_INITIALIZER(if_map_dtor, NULL);
-struct ifnet_head ifnet = TAILQ_HEAD_INITIALIZER(ifnet);
+struct ifnet_head ifnetlist = TAILQ_HEAD_INITIALIZER(ifnetlist);
void
if_idxmap_init(unsigned int limit)
{
if_attach_common(ifp);
NET_LOCK();
- TAILQ_INSERT_HEAD(&ifnet, ifp, if_list);
+ TAILQ_INSERT_HEAD(&ifnetlist, ifp, if_list);
if_attachsetup(ifp);
NET_UNLOCK();
}
{
if_attach_common(ifp);
NET_LOCK();
- TAILQ_INSERT_TAIL(&ifnet, ifp, if_list);
+ TAILQ_INSERT_TAIL(&ifnetlist, ifp, if_list);
if_attachsetup(ifp);
NET_UNLOCK();
}
{
/* Remove the interface from the list of all interfaces. */
NET_LOCK();
- TAILQ_REMOVE(&ifnet, ifp, if_list);
+ TAILQ_REMOVE(&ifnetlist, ifp, if_list);
NET_UNLOCK();
/* Remove the interface from the interface index map. */
rw_enter_write(&if_cloners_lock);
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (strcmp(ifp->if_xname, name) == 0)
break;
}
rdomain = rtable_l2(rtableid);
KERNEL_LOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rdomain)
continue;
rdomain = rtable_l2(rdomain);
KERNEL_LOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rdomain)
continue;
if (ifp->if_flags & IFF_POINTOPOINT) {
struct ifnet *ifp;
NET_LOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if ((ifp->if_flags & IFF_UP) == 0)
continue;
if_down(ifp);
KERNEL_ASSERT_LOCKED();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (strcmp(ifp->if_xname, name) == 0) {
if_ref(ifp);
return (ifp);
/* If ifc->ifc_len is 0, fill it in with the needed size and return. */
if (space == 0) {
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
struct sockaddr *sa;
if (TAILQ_EMPTY(&ifp->if_addrlist))
}
ifrp = ifc->ifc_req;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (space < sizeof(ifr))
break;
bcopy(ifp->if_xname, ifr.ifr_name, IFNAMSIZ);
struct ifnet *ifp;
struct ifaddr *ifa;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
char addr[INET6_ADDRSTRLEN];
-/* $OpenBSD: if_loop.c,v 1.91 2020/07/22 02:16:01 dlg Exp $ */
+/* $OpenBSD: if_loop.c,v 1.92 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: if_loop.c,v 1.15 1996/05/07 02:40:33 thorpej Exp $ */
/*
/* if there is any other interface in this rdomain, deny */
NET_LOCK();
- TAILQ_FOREACH(p, &ifnet, if_list) {
+ TAILQ_FOREACH(p, &ifnetlist, if_list) {
if (p->if_rdomain != ifp->if_rdomain)
continue;
if (p->if_index == ifp->if_index)
-/* $OpenBSD: if_var.h,v 1.116 2022/08/30 18:23:58 kn Exp $ */
+/* $OpenBSD: if_var.h,v 1.117 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
/*
#define sysctl_niq(_n, _l, _op, _olp, _np, _nl, _niq) \
sysctl_mq((_n), (_l), (_op), (_olp), (_np), (_nl), &(_niq)->ni_q)
-extern struct ifnet_head ifnet;
+extern struct ifnet_head ifnetlist;
void if_start(struct ifnet *);
int if_enqueue(struct ifnet *, struct mbuf *);
-/* $OpenBSD: rtsock.c,v 1.354 2022/09/05 10:31:25 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.355 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
*/
if (rtm->rtm_priority == RTP_PROPOSAL_SOLICIT) {
NET_LOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
ifp->if_rtrequest(ifp, RTM_PROPOSAL, NULL);
}
NET_UNLOCK();
int len, error = 0;
bzero(&info, sizeof(info));
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
/* Copy the link-layer address first */
int error = 0;
/* XXX ignore tableid for now */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
w->w_needed += sizeof(ifn);
-/* $OpenBSD: igmp.c,v 1.81 2022/09/04 06:49:11 jsg Exp $ */
+/* $OpenBSD: igmp.c,v 1.82 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: igmp.c,v 1.15 1996/02/13 23:41:25 christos Exp $ */
/*
NET_LOCK();
igmp_timers_are_running = 0;
- TAILQ_FOREACH(ifp, &ifnet, if_list)
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list)
igmp_checktimer(ifp);
NET_UNLOCK();
-/* $OpenBSD: in.c,v 1.176 2022/08/29 07:51:45 bluhm Exp $ */
+/* $OpenBSD: in.c,v 1.177 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
rdomain = rtable_l2(rtableid);
#define ia (ifatoia(ifa))
- TAILQ_FOREACH(ifn, &ifnet, if_list) {
+ TAILQ_FOREACH(ifn, &ifnetlist, if_list) {
if (ifn->if_rdomain != rdomain)
continue;
if ((ifn->if_flags & IFF_BROADCAST) == 0)
-/* $OpenBSD: ip_carp.c,v 1.354 2021/03/10 10:21:48 jsg Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.355 2022/09/08 10:22:06 kn Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
if (carp_send_all_recur > 0)
return;
++carp_send_all_recur;
- TAILQ_FOREACH(ifp0, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp0, &ifnetlist, if_list) {
if (ifp0->if_type != IFT_ETHER)
continue;
-/* $OpenBSD: ip_mroute.c,v 1.136 2022/08/06 15:57:59 bluhm Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.137 2022/09/08 10:22:06 kn Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
given = *oldlenp;
needed = 0;
memset(&vinfo, 0, sizeof vinfo);
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if ((vifp = (struct vif *)ifp->if_mcast) == NULL)
continue;
} while (error == EAGAIN);
/* Unregister all interfaces in the domain. */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rtableid)
continue;
* - there are no vifs installed
* - the MFC table is empty
*/
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rtableid)
continue;
if (ifp->if_mcast == NULL)
struct vif *v;
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rtableid)
continue;
if ((v = (struct vif *)ifp->if_mcast) == NULL)
-/* $OpenBSD: in6.c,v 1.248 2022/08/29 07:51:45 bluhm Exp $ */
+/* $OpenBSD: in6.c,v 1.249 2022/09/08 10:22:06 kn Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
}
/* We search for all addresses on all interfaces from the beginning. */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rdomain)
continue;
#if NCARP > 0
-/* $OpenBSD: in6_ifattach.c,v 1.118 2021/03/15 17:28:45 florian Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.119 2022/09/08 10:22:07 kn Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
}
/* next, try to get it from some other hardware interface */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp == ifp0)
continue;
if (in6_get_hw_ifid(ifp, in6) == 0)
-/* $OpenBSD: ip6_mroute.c,v 1.134 2022/08/09 21:10:03 kn Exp $ */
+/* $OpenBSD: ip6_mroute.c,v 1.135 2022/09/08 10:22:07 kn Exp $ */
/* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */
/* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */
given = *oldlenp;
needed = 0;
memset(&minfo, 0, sizeof minfo);
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if ((mifp = (struct mif6 *)ifp->if_mcast6) == NULL)
continue;
} while (error == EAGAIN);
/* Unregister all interfaces in the domain. */
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rtableid)
continue;
struct mif6 *m6;
struct ifnet *ifp;
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rtableid)
continue;
if ((m6 = (struct mif6 *)ifp->if_mcast6) == NULL)
-/* $OpenBSD: mld6.c,v 1.60 2022/09/05 15:47:39 bluhm Exp $ */
+/* $OpenBSD: mld6.c,v 1.61 2022/09/08 10:22:07 kn Exp $ */
/* $KAME: mld6.c,v 1.26 2001/02/16 14:50:35 itojun Exp $ */
/*
NET_LOCK();
mld6_timers_are_running = 0;
- TAILQ_FOREACH(ifp, &ifnet, if_list)
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list)
mld6_checktimer(ifp);
NET_UNLOCK();
-/* $OpenBSD: nd6.c,v 1.246 2022/08/09 21:10:03 kn Exp $ */
+/* $OpenBSD: nd6.c,v 1.247 2022/09/08 10:22:07 kn Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
KERNEL_LOCK();
NET_LOCK();
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
struct ifaddr *ifa, *nifa;
struct in6_ifaddr *ia6;
timeout_add_sec(&nd6_slowtimo_ch, ND6_SLOWTIMER_INTERVAL);
- TAILQ_FOREACH(ifp, &ifnet, if_list) {
+ TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
nd6if = ND_IFINFO(ifp);
if (nd6if->basereachable && /* already initialized */
(nd6if->recalctm -= ND6_SLOWTIMER_INTERVAL) <= 0) {