aboutsummaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2021-12-04 17:49:36 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2021-12-06 17:32:31 +0000
commit7e0bba4d8083b6fac71180681b51aee9ed5fb664 (patch)
tree874f7225b324faffc7fff75006b29b258c7d166b /sys/net/if.c
parentd74b7baeb0d419fce46994075b6ccf944a0fae9a (diff)
downloadsrc-7e0bba4d8083b6fac71180681b51aee9ed5fb664.tar.gz
src-7e0bba4d8083b6fac71180681b51aee9ed5fb664.zip
Diffstat (limited to 'sys/net/if.c')
-rw-r--r--sys/net/if.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 87c3e4af4380..6543cee5ef5a 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -84,6 +84,7 @@
#include <net/if_types.h>
#include <net/if_var.h>
#include <net/if_media.h>
+#include <net/if_mib.h>
#include <net/if_vlan_var.h>
#include <net/radix.h>
#include <net/route.h>
@@ -305,19 +306,25 @@ extern void nd6_setmtu(struct ifnet *);
VNET_DEFINE(struct hhook_head *, ipsec_hhh_in[HHOOK_IPSEC_COUNT]);
VNET_DEFINE(struct hhook_head *, ipsec_hhh_out[HHOOK_IPSEC_COUNT]);
-VNET_DEFINE(int, if_index);
int ifqmaxlen = IFQ_MAXLEN;
VNET_DEFINE(struct ifnethead, ifnet); /* depend on static init XXX */
VNET_DEFINE(struct ifgrouphead, ifg_head);
-VNET_DEFINE_STATIC(int, if_indexlim) = 8;
-
/* Table of ifnet by index. */
-VNET_DEFINE_STATIC(struct ifnet **, ifindex_table);
-
+VNET_DEFINE_STATIC(int, if_index);
+#define V_if_index VNET(if_index)
+VNET_DEFINE_STATIC(int, if_indexlim) = 8;
#define V_if_indexlim VNET(if_indexlim)
+VNET_DEFINE_STATIC(struct ifnet **, ifindex_table);
#define V_ifindex_table VNET(ifindex_table)
+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");
+
/*
* The global network interface list (V_ifnet) and related state (such as
* if_index, if_indexlim, and ifindex_table) are protected by an sxlock.