* [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
@ 2019-12-17 23:59 Phil Sutter
2019-12-18 0:03 ` Florian Westphal
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Phil Sutter @ 2019-12-17 23:59 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel, Máté Eckl
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.
Fixes: 4ed8eb6570a49 ("netfilter: nf_tables: Add native tproxy support")
Cc: Máté Eckl <ecklm94@gmail.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
net/netfilter/nft_tproxy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nft_tproxy.c b/net/netfilter/nft_tproxy.c
index f92a82c738808..95980154ef02c 100644
--- a/net/netfilter/nft_tproxy.c
+++ b/net/netfilter/nft_tproxy.c
@@ -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;
--
2.24.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-17 23:59 [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian Phil Sutter
@ 2019-12-18 0:03 ` Florian Westphal
2019-12-18 0:24 ` Phil Sutter
2019-12-19 12:47 ` Máté Eckl
2019-12-20 1:11 ` Pablo Neira Ayuso
2 siblings, 1 reply; 7+ messages in thread
From: Florian Westphal @ 2019-12-18 0:03 UTC (permalink / raw)
To: Phil Sutter; +Cc: Pablo Neira Ayuso, netfilter-devel, Máté Eckl
Phil Sutter <phil@nwl.cc> wrote:
> 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.
I was about to debug this today, thanks for debugging/fixing this.
Acked-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-18 0:03 ` Florian Westphal
@ 2019-12-18 0:24 ` Phil Sutter
2019-12-18 0:36 ` Florian Westphal
0 siblings, 1 reply; 7+ messages in thread
From: Phil Sutter @ 2019-12-18 0:24 UTC (permalink / raw)
To: Florian Westphal; +Cc: Pablo Neira Ayuso, netfilter-devel, Máté Eckl
Hi,
On Wed, Dec 18, 2019 at 01:03:15AM +0100, Florian Westphal wrote:
> Phil Sutter <phil@nwl.cc> wrote:
> > 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.
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-18 0:24 ` Phil Sutter
@ 2019-12-18 0:36 ` Florian Westphal
2019-12-18 14:12 ` Pablo Neira Ayuso
0 siblings, 1 reply; 7+ messages in thread
From: Florian Westphal @ 2019-12-18 0:36 UTC (permalink / raw)
To: Phil Sutter, Florian Westphal, Pablo Neira Ayuso, netfilter-devel,
Máté Eckl
Phil Sutter <phil@nwl.cc> wrote:
> On Wed, Dec 18, 2019 at 01:03:15AM +0100, Florian Westphal wrote:
> > Phil Sutter <phil@nwl.cc> wrote:
> > > 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.
> >
> > 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-18 0:36 ` Florian Westphal
@ 2019-12-18 14:12 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2019-12-18 14:12 UTC (permalink / raw)
To: Florian Westphal; +Cc: Phil Sutter, netfilter-devel, Máté Eckl
On Wed, Dec 18, 2019 at 01:36:25AM +0100, Florian Westphal wrote:
> Phil Sutter <phil@nwl.cc> wrote:
> > On Wed, Dec 18, 2019 at 01:03:15AM +0100, Florian Westphal wrote:
> > > Phil Sutter <phil@nwl.cc> wrote:
> > > > 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.
> > >
> > > 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.
The byteorder information is available in libnftables, so we can
probably move the print function there.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-17 23:59 [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian Phil Sutter
2019-12-18 0:03 ` Florian Westphal
@ 2019-12-19 12:47 ` Máté Eckl
2019-12-20 1:11 ` Pablo Neira Ayuso
2 siblings, 0 replies; 7+ messages in thread
From: Máté Eckl @ 2019-12-19 12:47 UTC (permalink / raw)
To: Phil Sutter; +Cc: Pablo Neira Ayuso, netfilter-devel
On Wed, Dec 18, 2019 at 12:59:29AM +0100, Phil Sutter wrote:
> 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.
>
> Fixes: 4ed8eb6570a49 ("netfilter: nf_tables: Add native tproxy support")
> Cc: Máté Eckl <ecklm94@gmail.com>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
Acked-by: Máté Eckl <ecklm94@gmail.com>
Thanks for the fix! This was out of my sight.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian
2019-12-17 23:59 [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian Phil Sutter
2019-12-18 0:03 ` Florian Westphal
2019-12-19 12:47 ` Máté Eckl
@ 2019-12-20 1:11 ` Pablo Neira Ayuso
2 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2019-12-20 1:11 UTC (permalink / raw)
To: Phil Sutter; +Cc: netfilter-devel, Máté Eckl
On Wed, Dec 18, 2019 at 12:59:29AM +0100, Phil Sutter wrote:
> 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.
Applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-12-20 1:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-17 23:59 [nf PATCH] netfilter: nft_tproxy: Fix port selector on Big Endian Phil Sutter
2019-12-18 0:03 ` Florian Westphal
2019-12-18 0:24 ` Phil Sutter
2019-12-18 0:36 ` Florian Westphal
2019-12-18 14:12 ` Pablo Neira Ayuso
2019-12-19 12:47 ` Máté Eckl
2019-12-20 1:11 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.