summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2011-10-27 12:18:34 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-10 01:54:45 +0100
commit598e465087365db1fa36b67aa53d291e400ec5b1 (patch)
tree91a7867a4ad8a72e1f16ea422c2cf2b6b919d41d
parent931c0eff309d8c7277ebe6d670fd72d8fbe3c674 (diff)
conntrackd: generalize local handler actions
This patch prepares the introduction of actions with the expectation table. Mostly renamings. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--include/conntrackd.h46
-rw-r--r--src/main.c24
-rw-r--r--src/run.c4
-rw-r--r--src/stats-mode.c8
-rw-r--r--src/sync-mode.c16
5 files changed, 49 insertions, 49 deletions
diff --git a/include/conntrackd.h b/include/conntrackd.h
index b35c95d..697d3d7 100644
--- a/include/conntrackd.h
+++ b/include/conntrackd.h
@@ -14,29 +14,29 @@
#include <syslog.h>
/* UNIX facilities */
-#define FLUSH_MASTER 0 /* flush kernel conntrack table */
-#define RESYNC_MASTER 1 /* resync with kernel conntrack table */
-#define DUMP_INTERNAL 16 /* dump internal cache */
-#define DUMP_EXTERNAL 17 /* dump external cache */
-#define COMMIT 18 /* commit external cache */
-#define FLUSH_CACHE 19 /* flush cache */
-#define KILL 20 /* kill conntrackd */
-#define STATS 21 /* dump statistics */
-#define SEND_BULK 22 /* send a bulk */
-#define REQUEST_DUMP 23 /* request dump */
-#define DUMP_INT_XML 24 /* dump internal cache in XML */
-#define DUMP_EXT_XML 25 /* dump external cache in XML */
-#define RESET_TIMERS 26 /* reset kernel timers */
-#define DEBUG_INFO 27 /* unused */
-#define STATS_NETWORK 28 /* extended network stats */
-#define STATS_CACHE 29 /* extended cache stats */
-#define STATS_RUNTIME 30 /* extended runtime stats */
-#define STATS_LINK 31 /* dedicated link stats */
-#define STATS_RSQUEUE 32 /* resend queue stats */
-#define FLUSH_INT_CACHE 33 /* flush internal cache */
-#define FLUSH_EXT_CACHE 34 /* flush external cache */
-#define STATS_PROCESS 35 /* child process stats */
-#define STATS_QUEUE 36 /* queue stats */
+#define CT_FLUSH_MASTER 0 /* flush kernel conntrack table */
+#define CT_RESYNC_MASTER 1 /* resync with kernel ct table */
+#define CT_DUMP_INTERNAL 16 /* dump internal cache */
+#define CT_DUMP_EXTERNAL 17 /* dump external cache */
+#define CT_COMMIT 18 /* commit external cache */
+#define CT_FLUSH_CACHE 19 /* flush cache */
+#define KILL 20 /* kill conntrackd */
+#define STATS 21 /* dump statistics */
+#define SEND_BULK 22 /* send a bulk */
+#define REQUEST_DUMP 23 /* request dump */
+#define CT_DUMP_INT_XML 24 /* dump internal cache in XML */
+#define CT_DUMP_EXT_XML 25 /* dump external cache in XML */
+#define RESET_TIMERS 26 /* reset kernel timers */
+#define DEBUG_INFO 27 /* unused */
+#define STATS_NETWORK 28 /* extended network stats */
+#define STATS_CACHE 29 /* extended cache stats */
+#define STATS_RUNTIME 30 /* extended runtime stats */
+#define STATS_LINK 31 /* dedicated link stats */
+#define STATS_RSQUEUE 32 /* resend queue stats */
+#define CT_FLUSH_INT_CACHE 33 /* flush internal cache */
+#define CT_FLUSH_EXT_CACHE 34 /* flush external cache */
+#define STATS_PROCESS 35 /* child process stats */
+#define STATS_QUEUE 36 /* queue stats */
#define DEFAULT_CONFIGFILE "/etc/conntrackd/conntrackd.conf"
#define DEFAULT_LOCKFILE "/var/lock/conntrackd.lock"
diff --git a/src/main.c b/src/main.c
index 4ead2ea..ebfc8b9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -115,15 +115,15 @@ int main(int argc, char *argv[])
break;
case 'c':
set_operation_mode(&type, REQUEST, argv);
- action = COMMIT;
+ action = CT_COMMIT;
break;
case 'i':
set_operation_mode(&type, REQUEST, argv);
- action = DUMP_INTERNAL;
+ action = CT_DUMP_INTERNAL;
break;
case 'e':
set_operation_mode(&type, REQUEST, argv);
- action = DUMP_EXTERNAL;
+ action = CT_DUMP_EXTERNAL;
break;
case 'C':
if (++i < argc) {
@@ -142,18 +142,18 @@ int main(int argc, char *argv[])
break;
case 'F':
set_operation_mode(&type, REQUEST, argv);
- action = FLUSH_MASTER;
+ action = CT_FLUSH_MASTER;
break;
case 'f':
set_operation_mode(&type, REQUEST, argv);
if (i+1 < argc && argv[i+1][0] != '-') {
if (strncmp(argv[i+1], "internal",
strlen(argv[i+1])) == 0) {
- action = FLUSH_INT_CACHE;
+ action = CT_FLUSH_INT_CACHE;
i++;
} else if (strncmp(argv[i+1], "external",
strlen(argv[i+1])) == 0) {
- action = FLUSH_EXT_CACHE;
+ action = CT_FLUSH_EXT_CACHE;
i++;
} else {
fprintf(stderr, "ERROR: unknown "
@@ -164,12 +164,12 @@ int main(int argc, char *argv[])
}
} else {
/* default to general flushing */
- action = FLUSH_CACHE;
+ action = CT_FLUSH_CACHE;
}
break;
case 'R':
set_operation_mode(&type, REQUEST, argv);
- action = RESYNC_MASTER;
+ action = CT_RESYNC_MASTER;
break;
case 'B':
set_operation_mode(&type, REQUEST, argv);
@@ -243,10 +243,10 @@ int main(int argc, char *argv[])
action = REQUEST_DUMP;
break;
case 'x':
- if (action == DUMP_INTERNAL)
- action = DUMP_INT_XML;
- else if (action == DUMP_EXTERNAL)
- action = DUMP_EXT_XML;
+ if (action == CT_DUMP_INTERNAL)
+ action = CT_DUMP_INT_XML;
+ else if (action == CT_DUMP_EXTERNAL)
+ action = CT_DUMP_EXT_XML;
else {
show_usage(argv[0]);
fprintf(stderr, "Error: Invalid parameters\n");
diff --git a/src/run.c b/src/run.c
index f8d3fad..c21db2e 100644
--- a/src/run.c
+++ b/src/run.c
@@ -197,7 +197,7 @@ static int local_handler(int fd, void *data)
return LOCAL_RET_OK;
}
switch(type) {
- case FLUSH_MASTER:
+ case CT_FLUSH_MASTER:
STATE(stats).nl_kernel_table_flush++;
dlog(LOG_NOTICE, "flushing kernel conntrack table");
@@ -209,7 +209,7 @@ static int local_handler(int fd, void *data)
exit(EXIT_SUCCESS);
}
break;
- case RESYNC_MASTER:
+ case CT_RESYNC_MASTER:
if (STATE(mode)->internal->flags & INTERNAL_F_POPULATE) {
STATE(stats).nl_kernel_table_resync++;
dlog(LOG_NOTICE, "resync with master table");
diff --git a/src/stats-mode.c b/src/stats-mode.c
index c7a81e3..b768033 100644
--- a/src/stats-mode.c
+++ b/src/stats-mode.c
@@ -62,14 +62,14 @@ static int local_handler_stats(int fd, int type, void *data)
int ret = LOCAL_RET_OK;
switch(type) {
- case DUMP_INTERNAL:
+ case CT_DUMP_INTERNAL:
cache_dump(STATE_STATS(cache), fd, NFCT_O_PLAIN);
break;
- case DUMP_INT_XML:
+ case CT_DUMP_INT_XML:
cache_dump(STATE_STATS(cache), fd, NFCT_O_XML);
break;
- case FLUSH_CACHE:
- case FLUSH_INT_CACHE:
+ case CT_FLUSH_CACHE:
+ case CT_FLUSH_INT_CACHE:
dlog(LOG_NOTICE, "flushing caches");
cache_flush(STATE_STATS(cache));
break;
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 17533f8..7e6fa31 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -486,31 +486,31 @@ static int local_handler_sync(int fd, int type, void *data)
int ret = LOCAL_RET_OK;
switch(type) {
- case DUMP_INTERNAL:
+ case CT_DUMP_INTERNAL:
if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
STATE(mode)->internal->ct.dump(fd, NFCT_O_PLAIN);
exit(EXIT_SUCCESS);
}
break;
- case DUMP_EXTERNAL:
+ case CT_DUMP_EXTERNAL:
if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
STATE_SYNC(external)->ct.dump(fd, NFCT_O_PLAIN);
exit(EXIT_SUCCESS);
}
break;
- case DUMP_INT_XML:
+ case CT_DUMP_INT_XML:
if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
STATE(mode)->internal->ct.dump(fd, NFCT_O_XML);
exit(EXIT_SUCCESS);
}
break;
- case DUMP_EXT_XML:
+ case CT_DUMP_EXT_XML:
if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
STATE_SYNC(external)->ct.dump(fd, NFCT_O_XML);
exit(EXIT_SUCCESS);
}
break;
- case COMMIT:
+ case CT_COMMIT:
/* delete the reset alarm if any before committing */
del_alarm(&STATE_SYNC(reset_cache_alarm));
@@ -525,20 +525,20 @@ static int local_handler_sync(int fd, int type, void *data)
CONFIG(purge_timeout), 0);
}
break;
- case FLUSH_CACHE:
+ case CT_FLUSH_CACHE:
/* inmediate flush, remove pending flush scheduled if any */
del_alarm(&STATE_SYNC(reset_cache_alarm));
dlog(LOG_NOTICE, "flushing caches");
STATE(mode)->internal->ct.flush();
STATE_SYNC(external)->ct.flush();
break;
- case FLUSH_INT_CACHE:
+ case CT_FLUSH_INT_CACHE:
/* inmediate flush, remove pending flush scheduled if any */
del_alarm(&STATE_SYNC(reset_cache_alarm));
dlog(LOG_NOTICE, "flushing internal cache");
STATE(mode)->internal->ct.flush();
break;
- case FLUSH_EXT_CACHE:
+ case CT_FLUSH_EXT_CACHE:
dlog(LOG_NOTICE, "flushing external cache");
STATE_SYNC(external)->ct.flush();
break;