All of lore.kernel.org
 help / color / mirror / Atom feed
* [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(&regs->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(&regs->data[priv->sreg_port]);
 	if (!tport)
 		tport = hp->dest;
 
-- 
2.24.1


^ permalink raw reply related	[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.