HomeFreeBSD

ifnet: make if_index global

Description

ifnet: make if_index global

Now that ifindex is static to if.c we can unvirtualize it. For lifetime
of an ifnet its index never changes. To avoid leaking foreign interfaces
the net.link.generic.system.ifcount sysctl and the ifnet_byindex() KPI
filter their returned value on curvnet. Since if_vmove() no longer
changes the if_index, inline ifindex_alloc() and ifindex_free() into
if_alloc() and if_free() respectively.

API wise the only change is that now minimum interface index can be
greater than 1. The holes in interface indexes were always allowed.

Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33672

Details

Provenance
glebiusAuthored on Jan 27 2022, 5:58 AM
Reviewer
kp
Differential Revision
D33672: ifnet: make if_index global
Parents
rG929ff66ad337: tests/sys/net/routing: remove bandaid against old epair(4) panic
Branches
Unknown
Tags
Unknown
Reverted By
rGd461deeaa4a4: VNET: Revert "ifnet: make if_index global"