summaryrefslogtreecommitdiffstats
path: root/src/read_config_yy.y
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2015-11-13 11:59:35 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2015-11-17 11:22:23 +0100
commit77f9f09e5c2bf76d4b50850848e6db9f239f49c7 (patch)
treed011f3e68a486e273ac51c6678651470401713fa /src/read_config_yy.y
parent783b5b58611410e4eacb6ad9d8c729b674c5cc3e (diff)
conntrackd: add systemd support
This patch adds basic systemd support. The feature can be enabled/disabled at configure time: ./configure --disable-systemd Also, at runtime in conntrackd.conf General { Systemd on|off } (by default it's enabled both at runtime and at configure time) * tell systemd about conntrackd readiness: When conntrackd starts, it will send systemd the data "READY=1". At the point the data is sent, conntrackd is fully ready to work (configuration was OK, sockets OK, et all), so other actions depending on conntrackd can be safely chained in the machine boot process. * tell systemd about conntrackd shutting down: If the admin kills conntrackd with `conntrackd -k', the data "STOPPING=1" will be send to systemd so it learns about the daemon shutting down. Same for manual signals. * watchdog support: The admin can configure systemd to watch the conntrackd daemon and perform some actions if conntrackd dies: restart it, reboot the machine, etc... Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/read_config_yy.y')
-rw-r--r--src/read_config_yy.y19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/read_config_yy.y b/src/read_config_yy.y
index 73fabbf..58ad2d0 100644
--- a/src/read_config_yy.y
+++ b/src/read_config_yy.y
@@ -89,6 +89,7 @@ enum {
%token T_OPTIONS T_TCP_WINDOW_TRACKING T_EXPECT_SYNC
%token T_HELPER T_HELPER_QUEUE_NUM T_HELPER_QUEUE_LEN T_HELPER_POLICY
%token T_HELPER_EXPECT_TIMEOUT T_HELPER_EXPECT_MAX
+%token T_SYSTEMD
%token <string> T_IP T_PATH_VAL
%token <val> T_NUMBER
@@ -1122,8 +1123,15 @@ general_line: hashsize
| netlink_events_reliable
| nice
| scheduler
+ | systemd
;
+systemd: T_SYSTEMD T_ON { /* already enabled in init_config() */ };
+systemd: T_SYSTEMD T_OFF
+{
+ conf.systemd = 0;
+};
+
netlink_buffer_size: T_BUFFER_SIZE T_NUMBER
{
conf.netlink_buffer_size = $2;
@@ -1856,6 +1864,9 @@ init_config(char *filename)
CONFIG(stats).syslog_facility = -1;
CONFIG(netlink).subsys_id = -1;
+ /* enable systemd by default */
+ CONFIG(systemd) = 1;
+
/* Initialize list of user-space helpers */
INIT_LIST_HEAD(&CONFIG(cthelper).list);
@@ -1865,6 +1876,14 @@ init_config(char *filename)
yyparse();
fclose(fp);
+#ifndef BUILD_SYSTEMD
+ if (CONFIG(systemd) == 1) {
+ print_err(CTD_CFG_WARN, "systemd runtime support activated but"
+ " conntrackd was built without support"
+ " for it. Recompile conntrackd");
+ }
+#endif /* BUILD_SYSTEMD */
+
/* set to default is not specified */
if (strcmp(CONFIG(lockfile), "") == 0)
strncpy(CONFIG(lockfile), DEFAULT_LOCKFILE, FILENAME_MAXLEN);