diff options
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/netgraph.h | 6 | ||||
-rw-r--r-- | sys/netgraph/ng_base.c | 15 | ||||
-rw-r--r-- | sys/netgraph/ng_bridge.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_eiface.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_iface.c | 2 | ||||
-rw-r--r-- | sys/netgraph/ng_ipfw.c | 2 |
6 files changed, 28 insertions, 1 deletions
diff --git a/sys/netgraph/netgraph.h b/sys/netgraph/netgraph.h index 0def641..4072f76 100644 --- a/sys/netgraph/netgraph.h +++ b/sys/netgraph/netgraph.h @@ -1205,6 +1205,12 @@ struct vnet_netgraph { struct unrhdr *_ng_wormhole_unit; }; +#ifndef VIMAGE +#ifndef VIMAGE_GLOBALS +extern struct vnet_netgraph vnet_netgraph_0; +#endif +#endif + /* Symbol translation macros */ #define V_nextID VNET_NETGRAPH(nextID) #define V_ng_ID_hash VNET_NETGRAPH(ng_ID_hash) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 24ed885..0406da1 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -72,6 +72,12 @@ MODULE_VERSION(netgraph, NG_ABI_VERSION); +#ifndef VIMAGE +#ifndef VIMAGE_GLOBALS +struct vnet_netgraph vnet_netgraph_0; +#endif +#endif + /* Mutex to protect topology events. */ static struct mtx ng_topo_mtx; @@ -167,7 +173,9 @@ static struct mtx ng_typelist_mtx; /* Hash related definitions */ /* XXX Don't need to initialise them because it's a LIST */ +#ifdef VIMAGE_GLOBALS static LIST_HEAD(, ng_node) ng_ID_hash[NG_ID_HASH_SIZE]; +#endif static struct mtx ng_idhash_mtx; /* Method to find a node.. used twice so do it here */ #define NG_IDHASH_FN(ID) ((ID) % (NG_ID_HASH_SIZE)) @@ -183,7 +191,9 @@ static struct mtx ng_idhash_mtx; } \ } while (0) +#ifdef VIMAGE_GLOBALS static LIST_HEAD(, ng_node) ng_name_hash[NG_NAME_HASH_SIZE]; +#endif static struct mtx ng_namehash_mtx; #define NG_NAMEHASH(NAME, HASH) \ do { \ @@ -348,7 +358,9 @@ ng_alloc_node(void) #define TRAP_ERROR() #endif -static ng_ID_t nextID = 1; +#ifdef VIMAGE_GLOBALS +static ng_ID_t nextID; +#endif #ifdef INVARIANTS #define CHECK_DATA_MBUF(m) do { \ @@ -3063,6 +3075,7 @@ ngb_mod_event(module_t mod, int event, void *data) switch (event) { case MOD_LOAD: /* Initialize everything. */ + V_nextID = 1; NG_WORKLIST_LOCK_INIT(); mtx_init(&ng_typelist_mtx, "netgraph types mutex", NULL, MTX_DEF); diff --git a/sys/netgraph/ng_bridge.c b/sys/netgraph/ng_bridge.c index c033a55..d998f1e 100644 --- a/sys/netgraph/ng_bridge.c +++ b/sys/netgraph/ng_bridge.c @@ -61,9 +61,11 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/malloc.h> #include <sys/mbuf.h> #include <sys/errno.h> +#include <sys/rwlock.h> #include <sys/syslog.h> #include <sys/socket.h> #include <sys/ctype.h> diff --git a/sys/netgraph/ng_eiface.c b/sys/netgraph/ng_eiface.c index 3d92e5f..542eaad 100644 --- a/sys/netgraph/ng_eiface.c +++ b/sys/netgraph/ng_eiface.c @@ -113,7 +113,9 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(eiface, &typestruct); +#ifdef VIMAGE_GLOBALS static struct unrhdr *ng_eiface_unit; +#endif /************************************************************************ INTERFACE STUFF diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 35fc1cc8..2295004 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -208,7 +208,9 @@ static struct ng_type typestruct = { }; NETGRAPH_INIT(iface, &typestruct); +#ifdef VIMAGE_GLOBALS static struct unrhdr *ng_iface_unit; +#endif /************************************************************************ HELPER STUFF diff --git a/sys/netgraph/ng_ipfw.c b/sys/netgraph/ng_ipfw.c index 91af215..cce623b 100644 --- a/sys/netgraph/ng_ipfw.c +++ b/sys/netgraph/ng_ipfw.c @@ -29,10 +29,12 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/lock.h> #include <sys/mbuf.h> #include <sys/malloc.h> #include <sys/ctype.h> #include <sys/errno.h> +#include <sys/rwlock.h> #include <sys/socket.h> #include <sys/syslog.h> |