From 806f790eae8212dbdbc3f61e6debdf4e29dfa9bf Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 14 Apr 2009 10:36:11 +0200 Subject: snprintf: fix missing protocol state support in XML output This patch adds the missing bits to display the protocol state in the XML output. Signed-off-by: Pablo Neira Ayuso --- src/conntrack/snprintf_xml.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/conntrack') diff --git a/src/conntrack/snprintf_xml.c b/src/conntrack/snprintf_xml.c index 928fc0b..08840a9 100644 --- a/src/conntrack/snprintf_xml.c +++ b/src/conntrack/snprintf_xml.c @@ -40,9 +40,7 @@ * * * - * - * ESTABLISHED - * + * ESTABLISHED * 100 * 1 * 0 @@ -290,7 +288,10 @@ int __snprintf_conntrack_xml(char *buf, ret = __snprintf_tuple_xml(buf+offset, len, ct, __DIR_REPL); BUFFER_SIZE(ret, size, len, offset); - if (test_bit(ATTR_TIMEOUT, ct->set) || + if (test_bit(ATTR_TCP_STATE, ct->set) || + test_bit(ATTR_SCTP_STATE, ct->set) || + test_bit(ATTR_DCCP_STATE, ct->set) || + test_bit(ATTR_TIMEOUT, ct->set) || test_bit(ATTR_MARK, ct->set) || test_bit(ATTR_USE, ct->set) || test_bit(ATTR_STATUS, ct->set)) { @@ -299,6 +300,24 @@ int __snprintf_conntrack_xml(char *buf, BUFFER_SIZE(ret, size, len, offset); } + if (test_bit(ATTR_TCP_STATE, ct->set)) { + ret = snprintf(buf+offset, len, "%s", + states[ct->protoinfo.tcp.state]); + BUFFER_SIZE(ret, size, len, offset); + } + + if (test_bit(ATTR_SCTP_STATE, ct->set)) { + ret = snprintf(buf+offset, len, "%s", + states[ct->protoinfo.sctp.state]); + BUFFER_SIZE(ret, size, len, offset); + } + + if (test_bit(ATTR_DCCP_STATE, ct->set)) { + ret = snprintf(buf+offset, len, "%s", + states[ct->protoinfo.dccp.state]); + BUFFER_SIZE(ret, size, len, offset); + } + if (test_bit(ATTR_TIMEOUT, ct->set)) { ret = snprintf(buf+offset, len, "%u", ct->timeout); @@ -338,7 +357,10 @@ int __snprintf_conntrack_xml(char *buf, BUFFER_SIZE(ret, size, len, offset); } - if (test_bit(ATTR_TIMEOUT, ct->set) || + if (test_bit(ATTR_TCP_STATE, ct->set) || + test_bit(ATTR_SCTP_STATE, ct->set) || + test_bit(ATTR_DCCP_STATE, ct->set) || + test_bit(ATTR_TIMEOUT, ct->set) || test_bit(ATTR_MARK, ct->set) || test_bit(ATTR_USE, ct->set) || test_bit(ATTR_STATUS, ct->set)) { -- cgit v1.2.3