swanctl: Use a ./configure-able swanctl base directory

This commit is contained in:
Martin Willi 2014-02-19 11:09:59 +01:00
parent 991c9b5e77
commit 7c8a907895
4 changed files with 35 additions and 6 deletions

View File

@ -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])

View File

@ -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}\""

View File

@ -18,6 +18,7 @@
#include <errno.h>
#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;
}

29
src/swanctl/swanctl.h Normal file
View File

@ -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 <http://www.fsf.org/copyleft/gpl.txt>.
*
* 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_ @}*/