summaryrefslogtreecommitdiffstats
path: root/src/conntrack/snprintf_default.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2015-08-25 14:22:41 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2015-09-29 20:39:26 +0200
commitd3d2bee2d9ebd565e006f213c76cfa316b5e5ab1 (patch)
treeba853d38ef24d856cc24a1fd8365cc41749126c4 /src/conntrack/snprintf_default.c
parentca8fa0b9f03968d5077af162010d670631089b6a (diff)
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 <daniel@iogearbox.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/conntrack/snprintf_default.c')
-rw-r--r--src/conntrack/snprintf_default.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/conntrack/snprintf_default.c b/src/conntrack/snprintf_default.c
index 24e2f28..06466b1 100644
--- a/src/conntrack/snprintf_default.c
+++ b/src/conntrack/snprintf_default.c
@@ -171,6 +171,13 @@ int __snprintf_proto(char *buf,
return size;
}
+static int
+__snprintf_tuple_zone(char *buf, unsigned int len, const char *pfx,
+ const struct __nfct_tuple *tuple)
+{
+ return (snprintf(buf, len, "zone-%s=%u ", pfx, tuple->zone));
+}
+
static int __snprintf_status_assured(char *buf,
unsigned int len,
const struct nf_conntrack *ct)
@@ -396,6 +403,11 @@ int __snprintf_conntrack_default(char *buf,
ret = __snprintf_proto(buf+offset, len, &ct->head.orig);
BUFFER_SIZE(ret, size, len, offset);
+ if (test_bit(ATTR_ORIG_ZONE, ct->head.set)) {
+ ret = __snprintf_tuple_zone(buf+offset, len, "orig", &ct->head.orig);
+ 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_counters(buf+offset, len, ct, __DIR_ORIG);
@@ -414,6 +426,11 @@ int __snprintf_conntrack_default(char *buf,
ret = __snprintf_proto(buf+offset, len, &ct->repl);
BUFFER_SIZE(ret, size, len, offset);
+ if (test_bit(ATTR_REPL_ZONE, ct->head.set)) {
+ ret = __snprintf_tuple_zone(buf+offset, len, "reply", &ct->repl);
+ BUFFER_SIZE(ret, size, len, offset);
+ }
+
if (test_bit(ATTR_REPL_COUNTER_PACKETS, ct->head.set) &&
test_bit(ATTR_REPL_COUNTER_BYTES, ct->head.set)) {
ret = __snprintf_counters(buf+offset, len, ct, __DIR_REPL);