From 598e465087365db1fa36b67aa53d291e400ec5b1 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 27 Oct 2011 12:18:34 +0200 Subject: conntrackd: generalize local handler actions This patch prepares the introduction of actions with the expectation table. Mostly renamings. Signed-off-by: Pablo Neira Ayuso --- src/main.c | 24 ++++++++++++------------ src/run.c | 4 ++-- src/stats-mode.c | 8 ++++---- src/sync-mode.c | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src') 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; -- cgit v1.2.3