summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/if.c23
-rw-r--r--sys/net/if_bridge.c3
-rw-r--r--sys/net/if_ethersubr.c5
-rw-r--r--sys/net/if_gif.c6
-rw-r--r--sys/net/if_gif.h7
-rw-r--r--sys/net/vnet.h8
6 files changed, 47 insertions, 5 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index f551c60..87b0328 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -90,6 +90,12 @@
#include <security/mac/mac_framework.h>
+#ifndef VIMAGE
+#ifndef VIMAGE_GLOBALS
+struct vnet_net vnet_net_0;
+#endif
+#endif
+
SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers");
SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management");
@@ -161,6 +167,19 @@ static int filt_netdev(struct knote *kn, long hint);
static struct filterops netdev_filtops =
{ 1, NULL, filt_netdetach, filt_netdev };
+#ifndef VIMAGE_GLOBALS
+static struct vnet_symmap vnet_net_symmap[] = {
+ VNET_SYMMAP(net, ifnet),
+ VNET_SYMMAP(net, rt_tables),
+ VNET_SYMMAP(net, rtstat),
+ VNET_SYMMAP(net, rttrash),
+ VNET_SYMMAP_END
+};
+
+VNET_MOD_DECLARE(NET, net, vnet_net_iattach, vnet_net_idetach,
+ NONE, vnet_net_symmap)
+#endif
+
/*
* System initialization
*/
@@ -361,6 +380,10 @@ if_init(void *dummy __unused)
{
INIT_VNET_NET(curvnet);
+#ifndef VIMAGE_GLOBALS
+ vnet_mod_register(&vnet_net_modinfo);
+#endif
+
V_if_index = 0;
V_ifindex_table = NULL;
V_if_indexlim = 8;
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c
index 8f07e6c..6d7aed0 100644
--- a/sys/net/if_bridge.c
+++ b/sys/net/if_bridge.c
@@ -100,6 +100,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/rwlock.h>
#include <sys/vimage.h>
#include <net/bpf.h>
@@ -3041,7 +3042,7 @@ bridge_pfil(struct mbuf **mp, struct ifnet *bifp, struct ifnet *ifp, int dir)
}
if (IPFW_LOADED && pfil_ipfw != 0 && dir == PFIL_OUT && ifp != NULL) {
- INIT_VNET_IPFW(curvnet);
+ INIT_VNET_INET(curvnet);
error = -1;
args.rule = ip_dn_claim_rule(*mp);
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index d26609c..4524fdd 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -42,10 +42,12 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mbuf.h>
#include <sys/random.h>
+#include <sys/rwlock.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -71,6 +73,7 @@
#include <netinet/if_ether.h>
#include <netinet/ip_fw.h>
#include <netinet/ip_dummynet.h>
+#include <netinet/vinet.h>
#endif
#ifdef INET6
#include <netinet6/nd6.h>
@@ -426,7 +429,7 @@ int
ether_ipfw_chk(struct mbuf **m0, struct ifnet *dst,
struct ip_fw **rule, int shared)
{
- INIT_VNET_IPFW(dst->if_vnet);
+ INIT_VNET_INET(dst->if_vnet);
struct ether_header *eh;
struct ether_header save_eh;
struct mbuf *m;
diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c
index 57bfaab..be7fa9f 100644
--- a/sys/net/if_gif.c
+++ b/sys/net/if_gif.c
@@ -95,6 +95,12 @@
static struct mtx gif_mtx;
static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
+#ifndef VIMAGE
+#ifndef VIMAGE_GLOBALS
+struct vnet_gif vnet_gif_0;
+#endif
+#endif
+
#ifdef VIMAGE_GLOBALS
static LIST_HEAD(, gif_softc) gif_softc_list;
static int max_gif_nesting;
diff --git a/sys/net/if_gif.h b/sys/net/if_gif.h
index c2fcc8c..2ba7bd3 100644
--- a/sys/net/if_gif.h
+++ b/sys/net/if_gif.h
@@ -113,7 +113,7 @@ int gif_encapcheck(const struct mbuf *, int, int, void *);
/*
* Virtualization support
*/
-#ifdef VIMAGE
+
struct vnet_gif {
LIST_HEAD(, gif_softc) _gif_softc_list;
int _max_gif_nesting;
@@ -121,6 +121,11 @@ struct vnet_gif {
int _ip_gif_ttl;
int _ip6_gif_hlim;
};
+
+#ifndef VIMAGE
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_gif vnet_gif_0;
+#endif
#endif
#define INIT_VNET_GIF(vnet) \
diff --git a/sys/net/vnet.h b/sys/net/vnet.h
index 531d714..f09fc6e 100644
--- a/sys/net/vnet.h
+++ b/sys/net/vnet.h
@@ -37,9 +37,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
#include <sys/protosw.h>
-#include <sys/socket.h>
#include <net/if.h>
#include <net/if_var.h>
@@ -67,6 +65,12 @@ struct vnet_net {
int _ether_ipfw;
};
+#ifndef VIMAGE
+#ifndef VIMAGE_GLOBALS
+extern struct vnet_net vnet_net_0;
+#endif
+#endif
+
/*
* Symbol translation macros
*/
OpenPOWER on IntegriCloud