Rename global ifnet TAILQ

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
This commit is contained in:
kn 2022-09-08 10:22:05 +00:00
parent 238cd070b2
commit ccb45f8ea0
21 changed files with 61 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -195,7 +195,7 @@ diskconf(void)
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,

View File

@ -1,4 +1,4 @@
/* $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.
*
@ -84,7 +84,7 @@ diskconf(void)
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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -125,7 +125,7 @@ diskconf(void)
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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
@ -232,7 +232,7 @@ diskconf(void)
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,

View File

@ -1,4 +1,4 @@
/* $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>
@ -54,7 +54,7 @@ diskconf(void)
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)

View File

@ -1,4 +1,4 @@
/* $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.
@ -72,7 +72,7 @@ diskconf(void)
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)

View File

@ -873,7 +873,7 @@ kvp_get_ip_info(struct hv_kvp *kvp, const uint8_t *mac, uint8_t *family,
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;
}

View File

@ -1,4 +1,4 @@
/* $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>
@ -869,7 +869,7 @@ vmt_tclo_broadcastip(struct vmt_softc *sc)
/* 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 */
@ -1301,7 +1301,7 @@ vmt_xdr_nic_info(char *data)
}
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;

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -284,7 +284,7 @@ static struct if_idxmap if_idxmap = {
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)
@ -566,7 +566,7 @@ if_attachhead(struct ifnet *ifp)
{
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();
}
@ -576,7 +576,7 @@ if_attach(struct ifnet *ifp)
{
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();
}
@ -1014,7 +1014,7 @@ if_remove(struct ifnet *ifp)
{
/* 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. */
@ -1256,7 +1256,7 @@ if_clone_destroy(const char *name)
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;
}
@ -1422,7 +1422,7 @@ ifa_ifwithaddr(struct sockaddr *addr, u_int rtableid)
rdomain = rtable_l2(rtableid);
KERNEL_LOCK();
TAILQ_FOREACH(ifp, &ifnet, if_list) {
TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
if (ifp->if_rdomain != rdomain)
continue;
@ -1451,7 +1451,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr, u_int rdomain)
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) {
@ -1608,7 +1608,7 @@ if_downall(void)
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);
@ -1763,7 +1763,7 @@ if_unit(const char *name)
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);
@ -2615,7 +2615,7 @@ ifconf(caddr_t data)
/* 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))
@ -2635,7 +2635,7 @@ ifconf(caddr_t data)
}
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);
@ -3173,7 +3173,7 @@ ifa_print_all(void)
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];

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -205,7 +205,7 @@ loop_clone_destroy(struct ifnet *ifp)
/* 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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -314,7 +314,7 @@ int niq_enlist(struct niqueue *, struct mbuf_list *);
#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 *);

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -850,7 +850,7 @@ route_output(struct mbuf *m, struct socket *so)
*/
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();
@ -2027,7 +2027,7 @@ sysctl_iflist(int af, struct walkarg *w)
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 */
@ -2085,7 +2085,7 @@ sysctl_ifnames(struct walkarg *w)
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);

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -539,7 +539,7 @@ igmp_fasttimo(void)
NET_LOCK();
igmp_timers_are_running = 0;
TAILQ_FOREACH(ifp, &ifnet, if_list)
TAILQ_FOREACH(ifp, &ifnetlist, if_list)
igmp_checktimer(ifp);
NET_UNLOCK();

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -829,7 +829,7 @@ in_broadcast(struct in_addr in, u_int rtableid)
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)

View File

@ -1,4 +1,4 @@
/* $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.
@ -1004,7 +1004,7 @@ carp_send_ad_all(void)
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;

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -353,7 +353,7 @@ mrt_sysctl_vif(void *oldp, size_t *oldlenp)
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;
@ -560,7 +560,7 @@ ip_mrouter_done(struct socket *so)
} 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;
@ -607,7 +607,7 @@ set_api_config(struct socket *so, struct mbuf *m)
* - 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)
@ -1284,7 +1284,7 @@ if_lookupbyvif(vifi_t vifi, unsigned int rtableid)
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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -1344,7 +1344,7 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
}
/* 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

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -209,7 +209,7 @@ in6_get_ifid(struct ifnet *ifp0, struct in6_addr *in6)
}
/* 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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
@ -328,7 +328,7 @@ mrt6_sysctl_mif(void *oldp, size_t *oldlenp)
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;
@ -533,7 +533,7 @@ ip6_mrouter_done(struct socket *so)
} 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;
@ -1185,7 +1185,7 @@ mrt6_iflookupbymif(mifi_t mifi, unsigned int rtableid)
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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -345,7 +345,7 @@ mld6_fasttimeo(void)
NET_LOCK();
mld6_timers_are_running = 0;
TAILQ_FOREACH(ifp, &ifnet, if_list)
TAILQ_FOREACH(ifp, &ifnetlist, if_list)
mld6_checktimer(ifp);
NET_UNLOCK();

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*
@ -489,7 +489,7 @@ nd6_expire(void *unused)
KERNEL_LOCK();
NET_LOCK();
TAILQ_FOREACH(ifp, &ifnet, if_list) {
TAILQ_FOREACH(ifp, &ifnetlist, if_list) {
struct ifaddr *ifa, *nifa;
struct in6_ifaddr *ia6;
@ -1303,7 +1303,7 @@ nd6_slowtimo(void *ignored_arg)
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) {