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/parse_mnl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/conntrack/parse_mnl.c') diff --git a/src/conntrack/parse_mnl.c b/src/conntrack/parse_mnl.c index 2582cd7..56a575e 100644 --- a/src/conntrack/parse_mnl.c +++ b/src/conntrack/parse_mnl.c @@ -254,7 +254,12 @@ static int nfct_parse_tuple_attr_cb(const struct nlattr *attr, void *data) if (mnl_attr_validate(attr, MNL_TYPE_NESTED) < 0) return MNL_CB_ERROR; break; + case CTA_TUPLE_ZONE: + if (mnl_attr_validate(attr, MNL_TYPE_U16) < 0) + return MNL_CB_ERROR; + break; } + tb[type] = attr; return MNL_CB_OK; } @@ -278,6 +283,18 @@ nfct_parse_tuple(const struct nlattr *attr, struct __nfct_tuple *tuple, return -1; } + if (tb[CTA_TUPLE_ZONE]) { + tuple->zone = ntohs(mnl_attr_get_u16(tb[CTA_TUPLE_ZONE])); + switch(dir) { + case __DIR_ORIG: + set_bit(ATTR_ORIG_ZONE, set); + break; + case __DIR_REPL: + set_bit(ATTR_REPL_ZONE, set); + break; + } + } + return 0; } -- cgit v1.2.3