]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
extensions: TPROXY: Fix for translation being non-terminal
authorPhil Sutter <phil@nwl.cc>
Fri, 13 Sep 2024 14:57:48 +0000 (16:57 +0200)
committerFlorian Westphal <fw@strlen.de>
Sun, 15 Sep 2024 15:17:34 +0000 (17:17 +0200)
nftables users have to explicitly add a verdict: xt_TPROXY's
tproxy_tg4() returns NF_ACCEPT if a socket was found and assigned,
NF_DROP otherwise.

Fixes: a62fe15abcc99 ("extensions: xt_TPROXY: add txlate support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
extensions/libxt_TPROXY.c
extensions/libxt_TPROXY.txlate

index ffc9da1383b8ca1cda82b70165063f71b7e2aa95..5bdefee0e33a44dd0668978aa996823fd02e85fe 100644 (file)
@@ -178,6 +178,8 @@ static int tproxy_tg_xlate(struct xt_xlate *xl,
                xt_xlate_add(xl, "meta mark set meta mark & 0x%x xor 0x%x",
                             ~mask, info->mark_value);
 
+       /* unlike TPROXY target, tproxy statement is non-terminal */
+       xt_xlate_add(xl, "accept");
        return 1;
 }
 
index 239bbe0dc8f9f9ea62a7c5805b6630daca30107d..f000baab50e037d4b15f2217c101f08522eb32f2 100644 (file)
@@ -1,20 +1,20 @@
 iptables-translate -t mangle -A PREROUTING -p tcp -j TPROXY --on-port 12345 --on-ip 10.0.0.1 --tproxy-mark 0x23/0xff
-nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to 10.0.0.1:12345 meta mark set meta mark & 0xffffff00 xor 0x23'
+nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to 10.0.0.1:12345 meta mark set meta mark & 0xffffff00 xor 0x23 accept'
 
 iptables-translate -t mangle -A PREROUTING -p udp -j TPROXY --on-port 12345 --on-ip 10.0.0.1 --tproxy-mark 0x23
-nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1:12345 meta mark set 0x23'
+nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1:12345 meta mark set 0x23 accept'
 
 iptables-translate -t mangle -A PREROUTING -p udp -j TPROXY --on-port 12345 --on-ip 10.0.0.1
-nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1:12345'
+nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1:12345 accept'
 
 iptables-translate -t mangle -A PREROUTING -p udp -j TPROXY --on-ip 10.0.0.1 --on-port 0
-nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1'
+nft 'add rule ip mangle PREROUTING ip protocol udp counter tproxy to 10.0.0.1 accept'
 
 iptables-translate -t mangle -A PREROUTING -p tcp -j TPROXY --on-port 12345
-nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to :12345'
+nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to :12345 accept'
 
 iptables-translate -t mangle -A PREROUTING -p tcp -j TPROXY --on-port 0
-nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to :0'
+nft 'add rule ip mangle PREROUTING ip protocol tcp counter tproxy to :0 accept'
 
 ip6tables-translate -t mangle -A PREROUTING -p tcp -j TPROXY --on-port 12345 --on-ip dead::beef --tproxy-mark 0x23/0xffff
-nft 'add rule ip6 mangle PREROUTING meta l4proto tcp counter tproxy to [dead::beef]:12345 meta mark set meta mark & 0xffff0000 xor 0x23'
+nft 'add rule ip6 mangle PREROUTING meta l4proto tcp counter tproxy to [dead::beef]:12345 meta mark set meta mark & 0xffff0000 xor 0x23 accept'