diff --git a/configure.ac b/configure.ac index 336057a92..6c056cff7 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ ARG_WITH_SUBST([ipseclibdir], [${libdir%/}/ipsec], [set installation path ARG_WITH_SUBST([plugindir], [${ipseclibdir%/}/plugins], [set the installation path of plugins]) ARG_WITH_SUBST([imcvdir], [${ipseclibdir%/}/imcvs], [set the installation path of IMC and IMV dynamic librariers]) ARG_WITH_SUBST([nm-ca-dir], [/usr/share/ca-certificates], [directory the NM backend uses to look up trusted root certificates]) +ARG_WITH_SUBST([swanctldir], [${sysconfdir}/swanctl], [base directory for swanctl configuration files and credentials]) ARG_WITH_SUBST([linux-headers], [\${top_srcdir}/src/include], [set directory of linux header files to use]) ARG_WITH_SUBST([routing-table], [220], [set routing table to use for IPsec routes]) ARG_WITH_SUBST([routing-table-prio], [220], [set priority for IPsec routing table]) diff --git a/src/swanctl/Makefile.am b/src/swanctl/Makefile.am index 58995cdda..c6b71c8b2 100644 --- a/src/swanctl/Makefile.am +++ b/src/swanctl/Makefile.am @@ -1,7 +1,5 @@ sbin_PROGRAMS = swanctl -conffile = `dirname $(strongswan_conf)`/strongswan.d/swanctl.conf - swanctl_SOURCES = \ command.c command.h \ commands/initiate.c \ @@ -11,7 +9,7 @@ swanctl_SOURCES = \ commands/list_sas.c \ commands/list_pols.c \ commands/load_conns.c \ - swanctl.c + swanctl.c swanctl.h swanctl_LDADD = \ $(top_builddir)/src/libcharon/plugins/vici/libvici.la \ @@ -22,5 +20,5 @@ swanctl.o : $(top_builddir)/config.status AM_CPPFLAGS = \ -I$(top_srcdir)/src/libstrongswan \ -I$(top_srcdir)/src/libcharon/plugins/vici \ - -DCONF_FILE=\""${conffile}\"" \ + -DSWANCTLDIR=\""${swanctldir}\"" \ -DPLUGINS=\""${s_plugins}\"" diff --git a/src/swanctl/commands/load_conns.c b/src/swanctl/commands/load_conns.c index 7fcf87f87..2c9884dc0 100644 --- a/src/swanctl/commands/load_conns.c +++ b/src/swanctl/commands/load_conns.c @@ -18,6 +18,7 @@ #include #include "command.h" +#include "swanctl.h" /** * Check if we should handle a key as a list of comma separated values @@ -262,10 +263,10 @@ static int load_conns(vici_conn_t *conn) break; } - cfg = settings_create(CONF_FILE); + cfg = settings_create(SWANCTL_CONF); if (!cfg) { - fprintf(stderr, "parsing '%s' failed\n", CONF_FILE); + fprintf(stderr, "parsing '%s' failed\n", SWANCTL_CONF); return EINVAL; } diff --git a/src/swanctl/swanctl.h b/src/swanctl/swanctl.h new file mode 100644 index 000000000..8497f230b --- /dev/null +++ b/src/swanctl/swanctl.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2014 Martin Willi + * Copyright (C) 2014 revosec AG + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. See . + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +/** + * @defgroup swanctl swanctl + * @{ @ingroup swanctl + */ + +#ifndef SWANCTL_H_ +#define SWANCTL_H_ + +/** + * Configuration file for connections, etc. + */ +#define SWANCTL_CONF SWANCTLDIR "/swanctl.conf" + +#endif /** SWANCTL_H_ @}*/