diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-01-22 22:00:54 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-01-22 22:02:56 +0100 |
commit | 451dafe6f5e1add75793597ba9bd0e3fddf2d7f9 (patch) | |
tree | c7b98e060b716c54df8ac733232c7b7909da58d5 /src | |
parent | b5ca4272d185171971872a9a2ee677cd66c8386b (diff) | |
download | conntrack-tools-451dafe6f5e1add75793597ba9bd0e3fddf2d7f9.tar.gz conntrack-tools-451dafe6f5e1add75793597ba9bd0e3fddf2d7f9.zip |
conntrackd: support `-i exp -x' and `-e exp -x' options
This patch allows you to dump the internal and external expectation
cache in XML.
% conntrackd -i exp -x
<flow><layer3 protonum="2" protoname="ipv4"><expected><src>192.168.1.135</src><dst>130.89.148.12</dst></expected><mask><src>255.255.255.255</src><dst>255.255.255.255</dst></mask><master><src>192.168.1.135</src><dst>130.89.148.12</dst></master></layer3><layer4 protonum="6" protoname="tcp"><expected><sport>0</sport><dport>9082</dport></expected><mask><sport>0</sport><dport>65535</dport></mask><master><sport>50518</sport><dport>21</dport></master></layer4><meta><helper-name>ftp</helper-name></meta></flow>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/sync-mode.c | 12 |
2 files changed, 16 insertions, 0 deletions
@@ -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); |