mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 23:41:29 +00:00
Add support to have on demand socket activation of iodine
This commit is contained in:
parent
59dbaf2b50
commit
27fb4c75cd
|
@ -59,6 +59,10 @@
|
||||||
#include "fw_query.h"
|
#include "fw_query.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SYSTEMD
|
||||||
|
# include <systemd/sd-daemon.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
WORD req_version = MAKEWORD(2, 2);
|
WORD req_version = MAKEWORD(2, 2);
|
||||||
WSADATA wsa_data;
|
WSADATA wsa_data;
|
||||||
|
@ -2246,6 +2250,9 @@ main(int argc, char **argv)
|
||||||
char *netsize;
|
char *netsize;
|
||||||
int ns_get_externalip;
|
int ns_get_externalip;
|
||||||
int retval;
|
int retval;
|
||||||
|
#ifdef HAVE_SYSTEMD
|
||||||
|
int nb_fds;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WINDOWS32
|
#ifndef WINDOWS32
|
||||||
pw = NULL;
|
pw = NULL;
|
||||||
|
@ -2487,10 +2494,23 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
free((void*) other_ip);
|
free((void*) other_ip);
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SYSTEMD
|
||||||
|
nb_fds = sd_listen_fds(0);
|
||||||
|
if (nb_fds > 1) {
|
||||||
|
retval = 1;
|
||||||
|
warnx("Too many file descriptors received!\n");
|
||||||
|
goto cleanup1;
|
||||||
|
} else if (nb_fds == 1) {
|
||||||
|
dnsd_fd = SD_LISTEN_FDS_START;
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
if ((dnsd_fd = open_dns(port, listen_ip)) == -1) {
|
if ((dnsd_fd = open_dns(port, listen_ip)) == -1) {
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_SYSTEMD
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (bind_enable) {
|
if (bind_enable) {
|
||||||
if ((bind_fd = open_dns(0, INADDR_ANY)) == -1) {
|
if ((bind_fd = open_dns(0, INADDR_ANY)) == -1) {
|
||||||
retval = 1;
|
retval = 1;
|
||||||
|
|
10
src/osflags
10
src/osflags
|
@ -17,7 +17,10 @@ link)
|
||||||
echo '-lws2_32 -liphlpapi';
|
echo '-lws2_32 -liphlpapi';
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
[ -e /usr/include/selinux/selinux.h ] && echo '-lselinux';
|
FLAGS="";
|
||||||
|
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -lselinux";
|
||||||
|
[ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -lsystemd-daemon";
|
||||||
|
echo $FLAGS;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
@ -30,7 +33,10 @@ cflags)
|
||||||
echo '-Dsocklen_t=int';
|
echo '-Dsocklen_t=int';
|
||||||
;;
|
;;
|
||||||
Linux)
|
Linux)
|
||||||
[ -e /usr/include/selinux/selinux.h ] && echo '-DHAVE_SETCON';
|
FLAGS="";
|
||||||
|
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON";
|
||||||
|
[ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -DHAVE_SYSTEMD";
|
||||||
|
echo $FLAGS;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue