summaryrefslogtreecommitdiff
path: root/src/read_config_yy.y
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-03 15:51:48 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-03 15:51:48 +0000
commitc41a0d3efc957505e72067e99a873ce66be0834a (patch)
tree31202265c1acd117df130ef0e9b466a005e8cabe /src/read_config_yy.y
parentd6978c9faadf9552bcb522d56d40c8aefa2e503e (diff)
downloadconntrack-tools-c41a0d3efc957505e72067e99a873ce66be0834a.tar.gz
conntrack-tools-c41a0d3efc957505e72067e99a873ce66be0834a.zip
o add support for connection logging to the statistics mode via Logfile
o minor irrelevant fixes for uncommon error paths and fix several typos o use LOG_INFO for connection logging, use LOG_NOTICE for other information o minor error handling updates
Diffstat (limited to 'src/read_config_yy.y')
-rw-r--r--src/read_config_yy.y70
1 files changed, 67 insertions, 3 deletions
diff --git a/src/read_config_yy.y b/src/read_config_yy.y
index 92806f8..ebb1c73 100644
--- a/src/read_config_yy.y
+++ b/src/read_config_yy.y
@@ -123,6 +123,11 @@ syslog_facility : T_SYSLOG T_STRING
"ignoring.\n", $2);
return;
}
+
+ if (conf.stats.syslog_facility != -1 &&
+ conf.syslog_facility != conf.stats.syslog_facility)
+ fprintf(stderr, "WARNING: Conflicting Syslog facility "
+ "values, defaulting to General.\n");
};
lock : T_LOCK T_PATH_VAL
@@ -549,16 +554,74 @@ family : T_FAMILY T_STRING
conf.family = AF_INET;
};
-stats: T_SYNC '{' stats_list '}';
+stats: T_STATS '{' stats_list '}';
stats_list:
| stats_list stat_line
;
-stat_line:
- |
+stat_line: stat_logfile_bool
+ | stat_logfile_path
+ | stat_syslog_bool
+ | stat_syslog_facility
;
+stat_logfile_bool : T_LOG T_ON
+{
+ strncpy(conf.stats.logfile, DEFAULT_STATS_LOGFILE, FILENAME_MAXLEN);
+};
+
+stat_logfile_bool : T_LOG T_OFF
+{
+};
+
+stat_logfile_path : T_LOG T_PATH_VAL
+{
+ strncpy(conf.stats.logfile, $2, FILENAME_MAXLEN);
+};
+
+stat_syslog_bool : T_SYSLOG T_ON
+{
+ conf.stats.syslog_facility = DEFAULT_SYSLOG_FACILITY;
+};
+
+stat_syslog_bool : T_SYSLOG T_OFF
+{
+ conf.stats.syslog_facility = -1;
+}
+
+stat_syslog_facility : T_SYSLOG T_STRING
+{
+ if (!strcmp($2, "daemon"))
+ conf.stats.syslog_facility = LOG_DAEMON;
+ else if (!strcmp($2, "local0"))
+ conf.stats.syslog_facility = LOG_LOCAL0;
+ else if (!strcmp($2, "local1"))
+ conf.stats.syslog_facility = LOG_LOCAL1;
+ else if (!strcmp($2, "local2"))
+ conf.stats.syslog_facility = LOG_LOCAL2;
+ else if (!strcmp($2, "local3"))
+ conf.stats.syslog_facility = LOG_LOCAL3;
+ else if (!strcmp($2, "local4"))
+ conf.stats.syslog_facility = LOG_LOCAL4;
+ else if (!strcmp($2, "local5"))
+ conf.stats.syslog_facility = LOG_LOCAL5;
+ else if (!strcmp($2, "local6"))
+ conf.stats.syslog_facility = LOG_LOCAL6;
+ else if (!strcmp($2, "local7"))
+ conf.stats.syslog_facility = LOG_LOCAL7;
+ else {
+ fprintf(stderr, "'%s' is not a known syslog facility, "
+ "ignoring.\n", $2);
+ return;
+ }
+
+ if (conf.syslog_facility != -1 &&
+ conf.stats.syslog_facility != conf.syslog_facility)
+ fprintf(stderr, "WARNING: Conflicting Syslog facility "
+ "values, defaulting to General.\n");
+};
+
%%
int
@@ -580,6 +643,7 @@ init_config(char *filename)
/* Zero may be a valid facility */
CONFIG(syslog_facility) = -1;
+ CONFIG(stats).syslog_facility = -1;
yyrestart(fp);
yyparse();