summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-05-05 04:23:34 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-05-05 04:23:34 +0200
commit56c72080acac36c153f3510cbb503b33a3c61dba (patch)
treea7824b4b96a388f2376436fe40595b07c7be7abd
parent1c71bf873aec6e352741a1652cfe5813ded8d94f (diff)
downloadfastd-56c72080acac36c153f3510cbb503b33a3c61dba.tar
fastd-56c72080acac36c153f3510cbb503b33a3c61dba.zip
Make systemd support optional again
-rw-r--r--cmake/config.cmake5
-rw-r--r--src/fastd.c8
-rw-r--r--src/fastd_config.h.in2
3 files changed, 9 insertions, 6 deletions
diff --git a/cmake/config.cmake b/cmake/config.cmake
index 765f608..7a27577 100644
--- a/cmake/config.cmake
+++ b/cmake/config.cmake
@@ -11,7 +11,6 @@ set(USE_FREEBIND ${LINUX})
set(USE_PMTU ${LINUX})
set(USE_PKTINFO ${LINUX})
set(USE_PACKET_MARK ${LINUX})
-set(USE_SYSTEMD ${LINUX})
if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
set(USE_MULTIAF_BIND FALSE)
@@ -24,6 +23,10 @@ set(WITH_CAPABILITIES ${LINUX} CACHE BOOL "Include support for POSIX capabilitie
set(ENABLE_LIBSODIUM FALSE CACHE BOOL "Use libsodium instead of NaCl")
set(ENABLE_OPENSSL FALSE CACHE BOOL "Enable crypto implementations using OpenSSL")
+if(LINUX)
+ set(ENABLE_SYSTEMD TRUE CACHE BOOL "Enable systemd support")
+endif(LINUX)
+
set(WITH_CMDLINE_USER TRUE CACHE BOOL "Include support for setting user/group related options on the command line")
set(WITH_CMDLINE_LOGGING TRUE CACHE BOOL "Include support for setting logging related options on the command line")
set(WITH_CMDLINE_OPERATION TRUE CACHE BOOL "Include support for setting options related to the VPN operation (like mode, interface, encryption method) on the command line")
diff --git a/src/fastd.c b/src/fastd.c
index 2ca9dd4..0d487bd 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -52,7 +52,7 @@
#include <openssl/err.h>
#endif
-#ifdef USE_SYSTEMD
+#ifdef ENABLE_SYSTEMD
#include <sys/un.h>
#endif
@@ -480,7 +480,7 @@ static int daemonize(void) {
}
}
-#ifdef USE_SYSTEMD
+#ifdef ENABLE_SYSTEMD
static void notify_systemd(const char *notify_socket) {
int fd;
struct sockaddr_un sa = {};
@@ -515,7 +515,7 @@ int main(int argc, char *argv[]) {
memset(&ctx, 0, sizeof(ctx));
int status_fd = -1;
-#ifdef USE_SYSTEMD
+#ifdef ENABLE_SYSTEMD
char *notify_socket = getenv("NOTIFY_SOCKET");
if (notify_socket) {
@@ -599,7 +599,7 @@ int main(int argc, char *argv[]) {
write_pid(getpid());
-#ifdef USE_SYSTEMD
+#ifdef ENABLE_SYSTEMD
if (notify_socket) {
notify_systemd(notify_socket);
free(notify_socket);
diff --git a/src/fastd_config.h.in b/src/fastd_config.h.in
index 8a3255f..2aace56 100644
--- a/src/fastd_config.h.in
+++ b/src/fastd_config.h.in
@@ -38,7 +38,6 @@
#cmakedefine USE_PKTINFO
#cmakedefine USE_PACKET_MARK
#cmakedefine USE_MULTIAF_BIND
-#cmakedefine USE_SYSTEMD
#cmakedefine WITH_CAPABILITIES
@@ -51,5 +50,6 @@
#cmakedefine HAVE_LIBSODIUM
#cmakedefine ENABLE_OPENSSL
+#cmakedefine ENABLE_SYSTEMD
#define MAX_CONFIG_DEPTH @MAX_CONFIG_DEPTH_NUM@