Skip to contentSkip to conversation

ct: direction should be integer, not bitmask

PATCH In review Florian Westphal 3 participants 3 messages Feb 17, 2014 – Feb 18, 2014 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 ct: direction should be integer, not bitmask

should always generate cmp op (its enum 0, 1 in kernel).

Note: 'original,reply' will no longer work after this patch.

---
 src/ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/ct.c +1 -1
index f893df9..79d4666 100644
@@ -61,7 +61,7 @@ static const struct datatype ct_dir_type = {
 	.desc		= "conntrack direction",
 	.byteorder	= BYTEORDER_INVALID,
 	.size		= BITS_PER_BYTE,
-	.basetype	= &bitmask_type,
+	.basetype	= &integer_type,
 	.sym_tbl	= &ct_dir_tbl,
 };
 
Signature · 1 line
1.8.1.5
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Florian Westphal

should always generate cmp op (its enum 0, 1 in kernel).

Note: 'original,reply' will no longer work after this patch.

This is also fixing the bytecode that is generated for:

nft add rule ip filter output ct direction reply counter

ip filter output 54 53
[ ct load direction => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x00000001 ) ^ 0x00000000 ] [ cmp neq reg 1 0x00000000 ]
[ counter pkts 0 bytes 0 ]

and the output:

ct direction & reply != original counter packets 0 bytes 0

which doesn't obviously work.

To this:

ip filter output 57 56
[ ct load direction => reg 1 ]
[ cmp eq reg 1 0x00000001 ]
[ counter pkts 0 bytes 0 ]

Feel free to push it. Thanks!

#2 lore raw
In reply to Florian Westphal
Quoted 3 lines · Florian Westphal

should always generate cmp op (its enum 0, 1 in kernel).

Note: 'original,reply' will no longer work after this patch.

I agree.

Quoted 26 lines
---
 src/ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/ct.c +1 -1
index f893df9..79d4666 100644
@@ -61,7 +61,7 @@ static const struct datatype ct_dir_type = {
 	.desc		= "conntrack direction",
 	.byteorder	= BYTEORDER_INVALID,
 	.size		= BITS_PER_BYTE,
-	.basetype	= &bitmask_type,
+	.basetype	= &integer_type,
 	.sym_tbl	= &ct_dir_tbl,
 };
 
Signature · 6 lines
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html