summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_socket.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-07-23 20:46:49 +0000
committerrwatson <rwatson@FreeBSD.org>2009-07-23 20:46:49 +0000
commitb3be1c6e3bd7d3b5cf946ddb04c1c5811644229b (patch)
tree0191b21173debdadfbf9f7565dfc5a8b9eefe94a /sys/netgraph/ng_socket.c
parentfc8defe5dd957eaee1f1c841d45804df5bbf20f5 (diff)
downloadFreeBSD-src-b3be1c6e3bd7d3b5cf946ddb04c1c5811644229b.zip
FreeBSD-src-b3be1c6e3bd7d3b5cf946ddb04c1c5811644229b.tar.gz
Introduce and use a sysinit-based initialization scheme for virtual
network stacks, VNET_SYSINIT: - Add VNET_SYSINIT and VNET_SYSUNINIT macros to declare events that will occur each time a network stack is instantiated and destroyed. In the !VIMAGE case, these are simply mapped into regular SYSINIT/SYSUNINIT. For the VIMAGE case, we instead use SYSINIT's to track their order and properties on registration, using them for each vnet when created/ destroyed, or immediately on module load for already-started vnets. - Remove vnet_modinfo mechanism that existed to serve this purpose previously, as well as its dependency scheme: we now just use the SYSINIT ordering scheme. - Implement VNET_DOMAIN_SET() to allow protocol domains to declare that they want init functions to be called for each virtual network stack rather than just once at boot, compiling down to DOMAIN_SET() in the non-VIMAGE case. - Walk all virtualized kernel subsystems and make use of these instead of modinfo or DOMAIN_SET() for init/uninit events. In some cases, convert modular components from using modevent to using sysinit (where appropriate). In some cases, do minor rejuggling of SYSINIT ordering to make room for or better manage events. Portions submitted by: jhb (VNET_SYSINIT), bz (cleanup) Discussed with: jhb, bz, julian, zec Reviewed by: bz Approved by: re (VIMAGE blanket)
Diffstat (limited to 'sys/netgraph/ng_socket.c')
-rw-r--r--sys/netgraph/ng_socket.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index 0d59979..af68c63 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -67,6 +67,9 @@
#ifdef NOTYET
#include <sys/vnode.h>
#endif
+
+#include <net/vnet.h>
+
#include <netgraph/ng_message.h>
#include <netgraph/netgraph.h>
#include <netgraph/ng_socketvar.h>
@@ -1112,17 +1115,12 @@ ngs_mod_event(module_t mod, int event, void *data)
switch (event) {
case MOD_LOAD:
- /* Register protocol domain. */
- net_add_domain(&ngdomain);
break;
case MOD_UNLOAD:
#ifdef NOTYET
/* Unregister protocol domain XXX can't do this yet.. */
- if ((error = net_rm_domain(&ngdomain)) != 0)
- break;
- else
#endif
- error = EBUSY;
+ error = EBUSY;
break;
default:
error = EOPNOTSUPP;
@@ -1131,6 +1129,8 @@ ngs_mod_event(module_t mod, int event, void *data)
return (error);
}
+VNET_DOMAIN_SET(ng);
+
SYSCTL_INT(_net_graph, OID_AUTO, family, CTLFLAG_RD, 0, AF_NETGRAPH, "");
SYSCTL_NODE(_net_graph, OID_AUTO, data, CTLFLAG_RW, 0, "DATA");
SYSCTL_INT(_net_graph_data, OID_AUTO, proto, CTLFLAG_RD, 0, NG_DATA, "");
OpenPOWER on IntegriCloud