streams: Named systemd sockets are only supported since systemd v227
authorTobias Brunner <tobias@strongswan.org>
Thu, 12 Oct 2017 16:40:15 +0000 (18:40 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 13 Oct 2017 08:17:37 +0000 (10:17 +0200)
configure.ac
src/libstrongswan/networking/streams/stream_service_systemd.c

index a3d349d..2d9ab05 100644 (file)
@@ -1002,6 +1002,10 @@ if test x$systemd = xtrue; then
                 AC_SUBST(systemd_journal_CFLAGS)
                 AC_SUBST(systemd_journal_LIBS)]
        )
+       saved_LIBS=$LIBS
+       LIBS="$systemd_LIBS $systemd_daemon_LIBS"
+       AC_CHECK_FUNCS(sd_listen_fds_with_names)
+       LIBS=$saved_LIBS
 fi
 
 if test x$tss_trousers = xtrue; then
index 64b9283..5c6b3f6 100644 (file)
  */
 stream_service_t *stream_service_create_systemd(char *uri, int backlog)
 {
+#ifndef HAVE_SD_LISTEN_FDS_WITH_NAMES
+       DBG1(DBG_NET, "unable to open stream URI '%s': named systemd sockets not "
+                "supported", uri);
+       return NULL;
+#else
        int i, num_fds, fd;
        char **fdmap;
 
@@ -62,4 +67,5 @@ stream_service_t *stream_service_create_systemd(char *uri, int backlog)
                return NULL;
        }
        return stream_service_create_from_fd(fd);
+#endif
 }