Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_mib.c
Show First 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | |||||
* Perhaps someday we will make addresses accessible via this interface | * Perhaps someday we will make addresses accessible via this interface | ||||
* as well (then there will be four such...). The reason that the | * as well (then there will be four such...). The reason that the | ||||
* index comes before the last element in the name is because it | * index comes before the last element in the name is because it | ||||
* seems more orthogonal that way, particularly with the possibility | * seems more orthogonal that way, particularly with the possibility | ||||
* of other per-interface data living down here as well (e.g., integrated | * of other per-interface data living down here as well (e.g., integrated | ||||
* services stuff). | * services stuff). | ||||
*/ | */ | ||||
SYSCTL_DECL(_net_link_generic); | |||||
static SYSCTL_NODE(_net_link_generic, IFMIB_SYSTEM, system, | |||||
CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | |||||
"Variables global to all interfaces"); | |||||
SYSCTL_INT(_net_link_generic_system, IFMIB_IFCOUNT, ifcount, | |||||
CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(if_index), 0, | |||||
"Number of configured interfaces"); | |||||
static int | static int | ||||
sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ | sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ | ||||
{ | { | ||||
int *name = (int *)arg1; | int *name = (int *)arg1; | ||||
int error; | int error; | ||||
u_int namelen = arg2; | u_int namelen = arg2; | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct ifmibdata ifmd; | struct ifmibdata ifmd; | ||||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Lines | case IFDATA_DRIVERNAME: | ||||
free(dbuf, M_TEMP); | free(dbuf, M_TEMP); | ||||
goto out; | goto out; | ||||
} | } | ||||
out: | out: | ||||
if_rele(ifp); | if_rele(ifp); | ||||
return error; | return error; | ||||
} | } | ||||
SYSCTL_DECL(_net_link_generic); | |||||
static SYSCTL_NODE(_net_link_generic, IFMIB_IFDATA, ifdata, | static SYSCTL_NODE(_net_link_generic, IFMIB_IFDATA, ifdata, | ||||
CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ifdata, | CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ifdata, | ||||
"Interface table"); | "Interface table"); |