summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/conntrackd.h2
-rw-r--r--src/main.c4
-rw-r--r--src/sync-mode.c12
3 files changed, 18 insertions, 0 deletions
diff --git a/include/conntrackd.h b/include/conntrackd.h
index 8baa088..9359dfa 100644
--- a/include/conntrackd.h
+++ b/include/conntrackd.h
@@ -47,6 +47,8 @@
#define ALL_RESYNC_MASTER 44 /* resync w/all kernel tables */
#define ALL_FLUSH_CACHE 45 /* flush all caches */
#define ALL_COMMIT 46 /* commit all tables */
+#define EXP_DUMP_INT_XML 47 /* dump internal cache in XML */
+#define EXP_DUMP_EXT_XML 48 /* dump external cache in XML */
#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 342ed45..0850a29 100644
--- a/src/main.c
+++ b/src/main.c
@@ -290,6 +290,10 @@ int main(int argc, char *argv[])
action = CT_DUMP_INT_XML;
else if (action == CT_DUMP_EXTERNAL)
action = CT_DUMP_EXT_XML;
+ else if (action == EXP_DUMP_INTERNAL)
+ action = EXP_DUMP_INT_XML;
+ else if (action == EXP_DUMP_EXTERNAL)
+ action = EXP_DUMP_EXT_XML;
else {
show_usage(argv[0]);
fprintf(stderr, "Error: Invalid parameters\n");
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 2505631..10fdb9e 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -706,6 +706,18 @@ static int local_handler_sync(int fd, int type, void *data)
}
local_commit(fd);
break;
+ case EXP_DUMP_INT_XML:
+ if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
+ STATE(mode)->internal->exp.dump(fd, NFCT_O_XML);
+ exit(EXIT_SUCCESS);
+ }
+ break;
+ case EXP_DUMP_EXT_XML:
+ if (fork_process_new(CTD_PROC_ANY, 0, NULL, NULL) == 0) {
+ STATE_SYNC(external)->exp.dump(fd, NFCT_O_XML);
+ exit(EXIT_SUCCESS);
+ }
+ break;
default:
if (STATE_SYNC(sync)->local)
ret = STATE_SYNC(sync)->local(fd, type, data);