aboutsummaryrefslogtreecommitdiffstats
path: root/src/pluto
diff options
context:
space:
mode:
Diffstat (limited to 'src/pluto')
-rw-r--r--src/pluto/log.c9
-rw-r--r--src/pluto/plutomain.c28
2 files changed, 32 insertions, 5 deletions
diff --git a/src/pluto/log.c b/src/pluto/log.c
index 293c99d58..15bab5d0a 100644
--- a/src/pluto/log.c
+++ b/src/pluto/log.c
@@ -87,10 +87,10 @@ u_int16_t cur_from_port; /* host order */
static void pluto_dbg(int level, char *fmt, ...)
{
int priority = LOG_INFO;
+ int debug_level;
char buffer[8192];
char *current = buffer, *next;
va_list args;
- int debug_level;
if (cur_debugging & DBG_PRIVATE)
{
@@ -115,7 +115,10 @@ static void pluto_dbg(int level, char *fmt, ...)
if (log_to_stderr)
{
- fprintf(stderr, "| ");
+ if (level > 1)
+ {
+ fprintf(stderr, "| ");
+ }
vfprintf(stderr, fmt, args);
fprintf(stderr, "\n");
}
@@ -132,7 +135,7 @@ static void pluto_dbg(int level, char *fmt, ...)
{
*(next++) = '\0';
}
- syslog(priority, "| %s\n", current);
+ syslog(priority, "%s%s\n", (level > 1)? "| ":"", current);
current = next;
}
}
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();