netfilter: nft_tproxy: Fix port selector on Big Endian
Subsystems (2)
Phil Sutter
reviewerPATCH 1/1 netfilter: nft_tproxy: Fix port selector on Big Endian
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32 sreg_port, just like commit 10596608c4d62 ("netfilter:nf_tables: fix mismatch in big-endian system") describes.
--- net/netfilter/nft_tproxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nft_tproxy.c +2 -2
@@ -50,7 +50,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, taddr =nf_tproxy_laddr4 (skb, taddr, iph->daddr);if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport =nft_reg_load16 (®s->data[priv->sreg_port]);if (!tport) tport = hp->dest;
@@ -117,7 +117,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, taddr = *nf_tproxy_laddr6 (skb, &taddr, &iph->daddr);if (priv->sreg_port) - tport = regs->data[priv->sreg_port]; + tport =nft_reg_load16 (®s->data[priv->sreg_port]);if (!tport) tport = hp->dest;
Signature · 1 line
2.24.1
Quoted 3 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.
I was about to debug this today, thanks for debugging/fixing this.
Phil Sutter
reviewerHi,
Quoted 6 lines · Florian Westphal
Quoted 3 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.I was about to debug this today, thanks for debugging/fixing this.
With that BE machine at hand, I quickly gave nftables testsuite a try - results are a bit concerning: The mere fact that netlink debug output for these immediates differs between BE and LE indicates we don't seriously test on BE.
Cheers, Phil
Florian Westphal
maintainerQuoted 6 lines · Phil Sutter
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.
Quoted 6 lines
Quoted 1 line
I was about to debug this today, thanks for debugging/fixing this.
With that BE machine at hand, I quickly gave nftables testsuite a try - results are a bit concerning: The mere fact that netlink debug output for these immediates differs between BE and LE indicates we don't seriously test on BE.
Yes, I fear we will need to add extra .be test files with big-endian output.
Alternative is to unify debug output in libnftnl to always print in host byte order, but thats not going to be easy because we don't know if the immediate value is in network or host byte order.
Pablo Neira Ayuso
maintainerQuoted 14 lines · Florian Westphal
Quoted 6 lines · Phil Sutter
Quoted 5 lines · Florian Westphal
Quoted 3 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.Quoted 6 lines
Quoted 1 line
I was about to debug this today, thanks for debugging/fixing this.
With that BE machine at hand, I quickly gave nftables testsuite a try - results are a bit concerning: The mere fact that netlink debug output for these immediates differs between BE and LE indicates we don't seriously test on BE.
Quoted 6 lines
Yes, I fear we will need to add extra .be test files with big-endian output.
Alternative is to unify debug output in libnftnl to always print in host byte order, but thats not going to be easy because we don't know if the immediate value is in network or host byte order.
The byteorder information is available in libnftables, so we can probably move the print function there.
Quoted 8 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.Fixes 4ed8eb6570a49 ("netfilter: nf_tables: Add native tproxy support")Cc Máté Eckl <[email protected]>Signed-off-by Phil Sutter <[email protected]>---
Thanks for the fix! This was out of my sight.
Quoted 3 lines · Phil Sutter
On Big Endian architectures, u16 port value was extracted from the wrong parts of u32
sreg_port, just like commit10596608c4d62("netfilter:nf_tables: fix mismatch in big-endian system") describes.
Applied, thanks.