freebsd-dev/sys/net
Marko Zec d461deeaa4 VNET: Revert "ifnet: make if_index global"
This reverts commit 91f44749c6.

Devirtualization of V_if_index and V_ifindex_table was rushed into
the tree lacking proper context, discussion, and declaration of intent,
so I'm backing it out as harmful to VNET on the following grounds:

1) The change repurposed the decades-old and stable if_index KBI for
new, unclear goals which were omitted from the commit note.

2) The change opened up a new resource exhaustion vector where any vnet
could starve the system of ifnet indices, including vnet0.

3) To circumvent the newly introduced problem of separating ifnets
belonging to different vnets from the globalized ifindex_table, the
author introduced sysctl_ifcount() which does a linear traversal over
the (potentially huge) global ifnet list just to return a simple upper
bound on existing ifnet indices.

4) The change effectively led to nonuniform ifnet index allocation
among vnets.

5) The commit note clearly stated that the patch changed the implicit
if_index ABI contract where ifnet indices were assumed to be starting
from one.  The commit note also included a correct observation that
holes in interface indices were always allowed, but failed to declare
that the userland-observable ifindex tables could now include huge
empty spans even under modest operating conditions.

6) The author had an earlier proposal in the works which did not
affect per-vnet ifnet lists (D33265) but which he abandoned without
providing the rationale behind his decision to do so, at the expense
of sacrificing the vnet isolation contract and if_index ABI / KBI.

Furthermore, the author agreed to back out his changes himself and
to follow up with a proposal for a less intrusive alternative, but
later silently declined to act.  Therefore, I decided to resolve the
status-quo by backing this out myself.  This in no way precludes a
future proposal aiming to mitigate ifnet-removal related system
crashes or panics to be accepted, provided it would not unnecessarily
compromise the goal of as strict as possible isolation between vnets.

Obtained from: github.com/glebius/FreeBSD/commits/backout-ifindex
2022-05-03 19:27:57 +02:00
..
altq altq: mark callouts as mpsafe 2021-09-04 17:26:10 +02:00
route net/route: Use __diagused for variables only used in KASSERT(). 2022-04-13 16:08:19 -07:00
bpf_buffer.c
bpf_buffer.h
bpf_filter.c
bpf_jitter.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
bpf_jitter.h
bpf_zerocopy.c
bpf_zerocopy.h
bpf.c bpf: Fix the write filter for detached descriptors 2021-10-26 10:00:39 -04:00
bpf.h bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf 2021-07-26 23:13:31 +02:00
bpfdesc.h bpf: Add an ioctl to set the VLAN Priority on packets sent by bpf 2021-07-26 23:13:31 +02:00
bridgestp.c bridgestp: validate timer values in config BPDU 2021-04-19 12:09:18 +02:00
bridgestp.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
debugnet_inet.c debugnet: Fix false-positive assertions for dp_state 2021-07-28 16:34:14 -07:00
debugnet_int.h
debugnet.c debugnet: Include some required headers 2021-09-14 11:02:45 -04:00
debugnet.h
dlt.h net(4): Fix a typo in a source code comment 2022-04-02 14:57:06 +02:00
ethernet.h net(3): Fix a typo in a source code comment 2022-04-02 10:53:40 +02:00
firewire.h
ieee8023ad_lacp.c lacp: short timeout erroneously declares link-flapping 2022-04-27 12:41:30 -07:00
ieee8023ad_lacp.h lacp: short timeout erroneously declares link-flapping 2022-04-27 12:41:30 -07:00
ieee_oui.h Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights 2021-08-08 10:42:24 -04:00
if_arp.h
if_bridge.c bridge: Don't share broadcast packets 2022-02-21 19:03:44 +01:00
if_bridgevar.h net: make if_bridgevar.h self-contained 2021-12-17 12:38:35 +01:00
if_clone.c if_clone: correctly destroy a clone from a different vnet 2022-01-24 21:07:16 -08:00
if_clone.h if_vmove: improve restoration in cloner's ifgroup membership 2022-01-24 21:06:59 -08:00
if_dead.c Add a switch structure for send tags. 2021-09-14 11:43:41 -07:00
if_disc.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
if_dl.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
if_edsc.c if_edsc: generate an arbitrary MAC address 2020-03-02 02:45:57 +00:00
if_enc.c Consistently include opt_ipsec.h for consumers of <netipsec/ipsec.h>. 2020-05-29 19:22:40 +00:00
if_enc.h
if_epair.c if_epair: build fix 2022-03-17 06:43:47 +01:00
if_ethersubr.c ether_resolve_addr: eh is only used for INET or INET6. 2022-04-13 16:08:21 -07:00
if_fwsubr.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
if_gif.c if_gif: fix vnet shutdown panic 2021-11-08 12:00:00 +01:00
if_gif.h gif_transmit() must always be called in the network epoch. 2020-01-15 06:18:32 +00:00
if_gre.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
if_gre.h
if_infiniband.c infiniband_resolve_addr: ih is only used for INET or INET6. 2022-04-13 16:08:21 -07:00
if_ipsec.c Use network epoch to protect local IPv4 addresses hash. 2021-10-22 14:40:53 -07:00
if_ipsec.h
if_lagg.c lagg: fix unused-but-set-variable 2021-11-19 22:01:27 +01:00
if_lagg.h Fix for IPoIB over lagg(4). 2020-12-29 17:35:06 +01:00
if_llatbl.c net: Fix memory leaks in lltable_calc_llheader() error paths 2022-04-08 11:47:25 -04:00
if_llatbl.h routing: Add unified level-based logging support for the routing subsystem. 2021-12-29 21:30:18 +00:00
if_llc.h
if_loop.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
if_me.c Use network epoch to protect local IPv4 addresses hash. 2021-10-22 14:40:53 -07:00
if_media.c if_media.c SIOCGMEDIAX handler: improve loop 2020-11-03 14:33:04 +00:00
if_media.h if_media: definitions for 40GE LM4 ethernet media type 2020-09-16 14:45:16 +00:00
if_mib.c ifnet: make V_if_index static to if.c 2021-12-06 09:32:31 -08:00
if_mib.h
if_pflog.h pflog: align header to 4 bytes, not 8 2022-02-01 18:17:44 +01:00
if_pfsync.h pf: make if_pfsync.h self-contained 2021-12-17 12:38:35 +01:00
if_stf.c if_stf: KASAN fix 2021-11-30 17:35:15 +01:00
if_stf.h if_stf: make if_stf.h self-contained 2021-12-17 12:38:34 +01:00
if_tap.h
if_tun.h
if_tuntap.c routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549). 2021-08-22 22:56:08 +00:00
if_types.h net(3): Fix a typo in a source code comment 2022-04-02 09:41:10 +02:00
if_var.h Revert "mbuf: do not restore dying interfaces" 2022-05-03 19:11:40 +02:00
if_vlan_var.h vlan: deduplicate bpf_setpcp() and pf_ieee8021q_setpcp() 2021-07-26 23:13:31 +02:00
if_vlan.c vlan: ifa is only used under #ifdef INET. 2022-04-13 16:08:21 -07:00
if_vxlan.c udp: allow udp_tun_func_t() to indicate it did not eat the packet 2022-04-12 10:04:59 +02:00
if_vxlan.h if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS. 2020-09-18 02:37:57 +00:00
if.c VNET: Revert "ifnet: make if_index global" 2022-05-03 19:27:57 +02:00
if.h Use thunks for compat ioctls using struct ifgroupreq. 2021-05-05 13:59:00 -07:00
ifdi_if.m iflib: add support for admin completion queues 2021-03-03 00:40:47 +01:00
iflib_clone.c Create wrapper for Giant taken for newbus 2021-12-09 17:04:45 -07:00
iflib_private.h
iflib.c iflib: Use empty inline functions for prefetch*() on non-x86. 2022-04-08 17:25:14 -07:00
iflib.h iflib: Allow drivers to determine which queue to TX on 2022-01-24 18:22:02 -08:00
ifq.h Make net/ifq.h C++ friendly 2020-11-20 14:45:45 +00:00
infiniband.h Factor out generic IP over infiniband, IPoIB, definitions and code 2020-10-22 09:09:53 +00:00
mp_ring.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
mp_ring.h
mppc.h
mppcc.c kernel: provide panicky version of __unreachable 2020-05-13 18:07:37 +00:00
mppcd.c
netisr_internal.h
netisr.c Revert "netisr: serialize/restore m_pkthdr.rcvif when queueing mbufs" 2022-05-03 19:11:39 +02:00
netisr.h
netmap_legacy.h netmap: add kernel support for the "offsets" feature 2021-03-29 16:29:01 +00:00
netmap_user.h netmap: fix refcount bug in netmap allocator 2022-03-06 16:39:16 +00:00
netmap_virt.h netmap: add kernel support for the "offsets" feature 2021-03-29 16:29:01 +00:00
netmap.h netmap: several typo fixes 2021-04-02 07:01:20 +00:00
paravirt.h
pfil.c net: whack "set but not used" warnings in net/pfil.c 2021-11-14 17:19:58 +00:00
pfil.h
pfkeyv2.h Add SADB_SAFLAGS_ESN flag 2020-10-16 11:22:29 +00:00
pfvar.h pf: Add per-rule timestamps for rule and eth_rule 2022-04-22 19:53:20 +02:00
ppp_defs.h
radix.c routing: Fix crashes with dpdk_lpm[46] algo. 2021-08-17 20:46:22 +00:00
radix.h routing: Fix crashes with dpdk_lpm[46] algo. 2021-08-17 20:46:22 +00:00
raw_cb.c Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
raw_cb.h protocols: init with standard SYSINIT(9) or VNET_SYSINIT 2022-01-03 10:15:21 -08:00
raw_usrreq.c protocols: init with standard SYSINIT(9) or VNET_SYSINIT 2022-01-03 10:15:21 -08:00
rndis.h Hyper-V: hn: Enable vSwitch RSC support in hn netvsc driver 2021-03-12 04:35:16 +00:00
route.c routing: fix source address selection rules for IPv4 over IPv6. 2021-09-07 21:41:05 +00:00
route.h net(3): Fix a typo in a source code comment 2022-04-02 09:24:48 +02:00
rss_config.c Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816" 2021-12-02 14:45:04 -08:00
rss_config.h
rtsock.c sysctl_dumpentry: move error to inner scope 2022-04-04 22:30:50 -06:00
sff8436.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
sff8472.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
slcompress.c net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
slcompress.h net: clean up empty lines in .c and .h files 2020-09-01 21:19:14 +00:00
toeplitz.c
toeplitz.h
vnet.c Widen ifnet_detach_sxlock coverage 2021-02-11 16:12:29 +01:00
vnet.h vnet: add CURVNET_ASSERT_SET for !VIMAGE 2022-02-19 21:00:00 +00:00