From 2a87a024e1f77407e332086a4fa664e048280195 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 25 Jan 2013 16:04:36 +0100 Subject: xtables: nft: add protocol and flags for xtables over nf_tables Add protocol and flags for the compatibility layer. Signed-off-by: Pablo Neira Ayuso --- iptables/nft.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'iptables/nft.c') diff --git a/iptables/nft.c b/iptables/nft.c index f42e4377..c3d5d610 100644 --- a/iptables/nft.c +++ b/iptables/nft.c @@ -800,6 +800,13 @@ static void add_addr(struct nft_rule *r, int offset, add_cmp_ptr(r, op, data, len); } +static void add_compat(struct nft_rule *r, uint32_t proto, bool inv) +{ + nft_rule_attr_set_u32(r, NFT_RULE_ATTR_COMPAT_PROTO, proto); + nft_rule_attr_set_u32(r, NFT_RULE_ATTR_COMPAT_FLAGS, + inv ? NFT_RULE_COMPAT_F_INV : 0); +} + static void add_proto(struct nft_rule *r, int offset, size_t len, uint32_t proto, int invflags) { @@ -813,6 +820,7 @@ static void add_proto(struct nft_rule *r, int offset, size_t len, op = NFT_CMP_EQ; add_cmp_u32(r, proto, op); + add_compat(r, proto, invflags & XT_INV_PROTO); } int -- cgit v1.2.3