From a93b5021ae85940803a890e1dc4a2ba3d6a6f37c Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Mon, 19 Feb 2018 10:57:18 +0100 Subject: extensions: prefer plain 'set' over 'set mark and' adding a test case for MARK --set-mark 0 fails with exp: nft add rule ip mangle OUTPUT counter meta mark set 0x0 res: nft add rule ip mangle OUTPUT counter meta mark set mark and 0x0 This translation isn't wrong, but unneccessarily complex, so change order to first check if mask bits are all ones. In that case we can simply use an immediate value without need for logical operators. Signed-off-by: Florian Westphal --- extensions/libxt_MARK.txlate | 3 +++ 1 file changed, 3 insertions(+) (limited to 'extensions/libxt_MARK.txlate') diff --git a/extensions/libxt_MARK.txlate b/extensions/libxt_MARK.txlate index ab5977e9..d3250ab6 100644 --- a/extensions/libxt_MARK.txlate +++ b/extensions/libxt_MARK.txlate @@ -1,3 +1,6 @@ +iptables-translate -t mangle -A OUTPUT -j MARK --set-mark 0 +nft add rule ip mangle OUTPUT counter meta mark set 0x0 + iptables-translate -t mangle -A OUTPUT -j MARK --set-mark 64 nft add rule ip mangle OUTPUT counter meta mark set 0x40 -- cgit v1.2.3