freebsd-skq/sys/netipsec
zec b39b54e6de Introduce vnet module registration / initialization framework with
dependency tracking and ordering enforcement.

With this change, per-vnet initialization functions introduced with
r190787 are no longer directly called from traditional initialization
functions (which cc in most cases inlined to pre-r190787 code), but are
instead registered via the vnet framework first, and are invoked only
after all prerequisite modules have been initialized.  In the long run,
this framework should allow us to both initialize and dismantle
multiple vnet instances in a correct order.

The problem this change aims to solve is how to replay the
initialization sequence of various network stack components, which
have been traditionally triggered via different mechanisms (SYSINIT,
protosw).  Note that this initialization sequence was and still can be
subtly different depending on whether certain pieces of code have been
statically compiled into the kernel, loaded as modules by boot
loader, or kldloaded at run time.

The approach is simple - we record the initialization sequence
established by the traditional mechanisms whenever vnet_mod_register()
is called for a particular vnet module.  The vnet_mod_register_multi()
variant allows a single initializer function to be registered multiple
times but with different arguments - currently this is only used in
kern/uipc_domain.c by net_add_domain() with different struct domain *
as arguments, which allows for protosw-registered initialization
routines to be invoked in a correct order by the new vnet
initialization framework.

For the purpose of identifying vnet modules, each vnet module has to
have a unique ID, which is statically assigned in sys/vimage.h.
Dynamic assignment of vnet module IDs is not supported yet.

A vnet module may specify a single prerequisite module at registration
time by filling in the vmi_dependson field of its vnet_modinfo struct
with the ID of the module it depends on.  Unless specified otherwise,
all vnet modules depend on VNET_MOD_NET (container for ifnet list head,
rt_tables etc.), which thus has to and will always be initialized
first.  The framework will panic if it detects any unresolved
dependencies before completing system initialization.  Detection of
unresolved dependencies for vnet modules registered after boot
(kldloaded modules) is not provided.

Note that the fact that each module can specify only a single
prerequisite may become problematic in the long run.  In particular,
INET6 depends on INET being already instantiated, due to TCP / UDP
structures residing in INET container.  IPSEC also depends on INET,
which will in turn additionally complicate making INET6-only kernel
configs a reality.

The entire registration framework can be compiled out by turning on the
VIMAGE_GLOBALS kernel config option.

Reviewed by:	bz
Approved by:	julian (mentor)
2009-04-11 05:58:58 +00:00
..
ah_var.h
ah.h
esp_var.h
esp.h
ipcomp_var.h
ipcomp.h
ipip_var.h Second round of putting global variables, which were virtualized 2008-12-13 19:13:03 +00:00
ipsec6.h Try to remove/assimilate as much of formerly IPv4/6 specific 2009-02-08 09:27:07 +00:00
ipsec_input.c Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
ipsec_mbuf.c Remove remain <= MHLEN restriction in m_makespace(), 2009-01-28 10:41:10 +00:00
ipsec_output.c Use NULL rather than 0 when comparing pointers. 2009-01-30 20:17:08 +00:00
ipsec.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
ipsec.h Try to remove/assimilate as much of formerly IPv4/6 specific 2009-02-08 09:27:07 +00:00
key_debug.c Shuffle the vimage.h includes or add where missing. 2009-02-27 13:22:26 +00:00
key_debug.h Commit step 1 of the vimage project, (network stack) 2008-08-17 23:27:27 +00:00
key_var.h First steps towards IPSec cleanup. 2006-03-25 13:38:52 +00:00
key.c First pass at separating per-vnet initializer functions 2009-04-06 22:29:41 +00:00
key.h
keydb.h First steps towards IPSec cleanup. 2006-03-25 13:38:52 +00:00
keysock.c For all files including net/vnet.h directly include opt_route.h and 2009-02-27 14:12:05 +00:00
keysock.h Unhide declarations of network stack virtualization structs from 2008-11-28 23:30:51 +00:00
vipsec.h Add size-guards evaluated at compile-time to the main struct vnet_* 2009-03-01 11:01:00 +00:00
xform_ah.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
xform_esp.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
xform_ipcomp.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
xform_ipip.c Introduce vnet module registration / initialization framework with 2009-04-11 05:58:58 +00:00
xform_tcp.c Add ';' missed with the SYSINIT changes. 2008-03-21 18:31:42 +00:00
xform.h Add sysctls to if_enc(4) to control whether the firewalls or 2007-11-28 22:33:53 +00:00