swanctl: Read default socket from swanctl.socket option
authorTobias Brunner <tobias@strongswan.org>
Thu, 29 Jun 2017 08:09:47 +0000 (10:09 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 27 Jul 2017 11:22:57 +0000 (13:22 +0200)
Also read from swanctl.plugins.vici.socket so we get
libstrongswan.plugins.vici.socket if it is defined.

Fixes #2372.

conf/options/swanctl.opt
src/swanctl/command.c

index f78b4bc..f2a8a0f 100644 (file)
@@ -1,2 +1,5 @@
 swanctl.load =
-       Plugins to load in swanctl.
\ No newline at end of file
+       Plugins to load in swanctl.
+
+swanctl.socket = unix://${piddir}/charon.vici
+       VICI socket to connect to by default.
index fd9bc00..7f65d2b 100644 (file)
@@ -315,6 +315,10 @@ int command_dispatch(int c, char *v[])
 {
        int op, i;
 
+       uri = lib->settings->get_str(lib->settings, "%s.socket",
+                       lib->settings->get_str(lib->settings, "%s.plugins.vici.socket",
+                                                                  NULL, lib->ns), lib->ns);
+
        options = options_create();
        atexit(cleanup);
        active = help_idx = registered;