From d3d2bee2d9ebd565e006f213c76cfa316b5e5ab1 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Tue, 25 Aug 2015 14:22:41 +0200 Subject: conntrack: add zone attribute to tuple This patch adds the front-end to the recent ctnetlink interface changes that add the zone attribute into the tuple. Signed-off-by: Daniel Borkmann Signed-off-by: Pablo Neira Ayuso --- src/conntrack/snprintf_xml.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/conntrack/snprintf_xml.c') diff --git a/src/conntrack/snprintf_xml.c b/src/conntrack/snprintf_xml.c index bf52362..c3a836a 100644 --- a/src/conntrack/snprintf_xml.c +++ b/src/conntrack/snprintf_xml.c @@ -284,7 +284,7 @@ __snprintf_localtime_xml(char *buf, unsigned int len, const struct tm *tm) static int __snprintf_tuple_xml(char *buf, unsigned int len, const struct nf_conntrack *ct, - unsigned int dir) + unsigned int dir, bool zone_incl) { int ret; unsigned int size = 0, offset = 0; @@ -330,6 +330,11 @@ static int __snprintf_tuple_xml(char *buf, ret = snprintf(buf+offset, len, ""); BUFFER_SIZE(ret, size, len, offset); + if (zone_incl) { + ret = snprintf(buf+offset, len, "%u", tuple->zone); + BUFFER_SIZE(ret, size, len, offset); + } + if (test_bit(ATTR_ORIG_COUNTER_PACKETS, ct->head.set) && test_bit(ATTR_ORIG_COUNTER_BYTES, ct->head.set)) { ret = snprintf(buf+offset, len, ""); @@ -398,10 +403,12 @@ int __snprintf_conntrack_xml(char *buf, BUFFER_SIZE(ret, size, len, offset); - ret = __snprintf_tuple_xml(buf+offset, len, ct, __DIR_ORIG); + ret = __snprintf_tuple_xml(buf+offset, len, ct, __DIR_ORIG, + test_bit(ATTR_ORIG_ZONE, ct->head.set)); BUFFER_SIZE(ret, size, len, offset); - ret = __snprintf_tuple_xml(buf+offset, len, ct, __DIR_REPL); + ret = __snprintf_tuple_xml(buf+offset, len, ct, __DIR_REPL, + test_bit(ATTR_REPL_ZONE, ct->head.set)); BUFFER_SIZE(ret, size, len, offset); if (test_bit(ATTR_TCP_STATE, ct->head.set) || -- cgit v1.2.3