diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-04-21 18:48:58 +0000 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-04-21 18:48:58 +0000 |
commit | 6e9fe153fc485c1bf22180fb4189d160c511f2c8 (patch) | |
tree | 596dfd04041c1d6119162a43329644d7b2ef6785 /src/pluto/plutomain.c | |
parent | b757ebc2a7829644cf632c67db0e78650ea1dcdd (diff) | |
download | strongswan-4.3.0.tar.bz2 strongswan-4.3.0.tar.xz |
added plugin load mechanism to pluto and scepclient and improved debug output4.3.0
Diffstat (limited to 'src/pluto/plutomain.c')
-rw-r--r-- | src/pluto/plutomain.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/pluto/plutomain.c b/src/pluto/plutomain.c index d40f8b457..ed7e195d7 100644 --- a/src/pluto/plutomain.c +++ b/src/pluto/plutomain.c @@ -40,6 +40,8 @@ #include <freeswan.h> #include <library.h> +#include <debug.h> +#include <utils/enumerator.h> #include <pfkeyv2.h> #include <pfkey.h> @@ -223,6 +225,24 @@ bool pkcs11_proxy = FALSE; */ static const char *pkcs11_init_args = NULL; +/** + * Log loaded plugins + */ +static void print_plugins() +{ + char buf[BUF_LEN], *plugin; + int len = 0; + enumerator_t *enumerator; + + enumerator = lib->plugins->create_plugin_enumerator(lib->plugins); + while (len < BUF_LEN && enumerator->enumerate(enumerator, &plugin)) + { + len += snprintf(&buf[len], BUF_LEN-len, "%s ", plugin); + } + enumerator->destroy(enumerator); + DBG1("loaded plugins: %s", buf); +} + int main(int argc, char **argv) { bool fork_desired = TRUE; @@ -609,6 +629,11 @@ int main(int argc, char **argv) , ipsec_version_code() , compile_time_interop_options); + /* load plugins, further infrastructure may need it */ + lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, + lib->settings->get_str(lib->settings, "pluto.load", "")); + print_plugins(); + init_nat_traversal(nat_traversal, keep_alive, force_keepalive, nat_t_spf); init_virtual_ip(virtual_private); scx_init(pkcs11_module_path, pkcs11_init_args); /* load and initialize PKCS #11 module */ @@ -690,8 +715,7 @@ int main(int argc, char **argv) * 1 general discomfort * 10 lock file exists */ -void -exit_pluto(int status) +void exit_pluto(int status) { reset_globals(); /* needed because we may be called in odd state */ free_preshared_secrets(); |