Make IKE and EES sockets configurable
authorAdrian-Ken Rueegsegger <ken@codelabs.ch>
Tue, 18 Dec 2012 16:15:58 +0000 (17:15 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 19 Mar 2013 14:23:50 +0000 (15:23 +0100)
The IKE and EES sockets are now read from strongswan.conf. They can be
specified like this:

charon-tkm {
ike_socket = /tmp/tkm.rpc.ike
ees_socket = /tmp/tkm.rpc.ees
}

The socket names given above are used by default if none are configured.

src/charon-tkm/src/tkm/tkm.c

index 47e1eb9..9cf54b0 100644 (file)
@@ -14,6 +14,8 @@
  * for more details.
  */
 
+#include <daemon.h>
+
 #include <tkm/client.h>
 #include <tkm/constants.h>
 
@@ -61,16 +63,25 @@ bool tkm_init()
 
        /* initialize TKM client library */
        tkmlib_init();
-
        ehandler_init();
 
-       if (ike_init(IKE_SOCKET) != TKM_OK)
+       const char * const ikesock = lib->settings->get_str(lib->settings,
+                                                                                                               "%s.ike_socket",
+                                                                                                               IKE_SOCKET,
+                                                                                                               charon->name);
+       if (ike_init(ikesock) != TKM_OK)
        {
                tkmlib_final();
                return FALSE;
        }
-
-       ees_server_init(EES_SOCKET);
+       DBG1(DBG_DMN, "connected to TKM via socket '%s'", ikesock);
+
+       const char * const eessock = lib->settings->get_str(lib->settings,
+                                                                                                               "%s.ees_socket",
+                                                                                                               EES_SOCKET,
+                                                                                                               charon->name);
+       ees_server_init(eessock);
+       DBG1(DBG_DMN, "serving EES requests on socket '%s'", eessock);
 
        if (ike_tkm_reset() != TKM_OK)
        {