netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND] nft_flow_offload: Fix the peer route get from wrong daddr
@ 2019-01-09  2:40 wenxu
  2019-01-09 19:03 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: wenxu @ 2019-01-09  2:40 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel, netdev

From: wenxu <wenxu@ucloud.cn>

For nat example:
client 1.1.1.7 ---> 2.2.2.7 which dnat to 10.0.0.7 server

When syn_rcv pkt from server it get the peer(client->server) route
through daddr = ct->tuplehash[!dir].tuple.dst.u3.ip, the value 2.2.2.7
is not correct in this situation. it should be 10.0.0.7
ct->tuplehash[dir].tuple.src.u3.ip

Signed-off-by: wenxu <wenxu@ucloud.cn>
---
 net/netfilter/nft_flow_offload.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
index 974525e..ccdb8f5 100644
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
@@ -29,10 +29,10 @@ static int nft_flow_route(const struct nft_pktinfo *pkt,
 	memset(&fl, 0, sizeof(fl));
 	switch (nft_pf(pkt)) {
 	case NFPROTO_IPV4:
-		fl.u.ip4.daddr = ct->tuplehash[!dir].tuple.dst.u3.ip;
+		fl.u.ip4.daddr = ct->tuplehash[dir].tuple.src.u3.ip;
 		break;
 	case NFPROTO_IPV6:
-		fl.u.ip6.daddr = ct->tuplehash[!dir].tuple.dst.u3.in6;
+		fl.u.ip6.daddr = ct->tuplehash[dir].tuple.src.u3.in6;
 		break;
 	}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] nft_flow_offload: Fix the peer route get from wrong daddr
  2019-01-09  2:40 [PATCH RESEND] nft_flow_offload: Fix the peer route get from wrong daddr wenxu
@ 2019-01-09 19:03 ` Pablo Neira Ayuso
  2019-01-09 19:06   ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-01-09 19:03 UTC (permalink / raw)
  To: wenxu; +Cc: netfilter-devel, netdev

On Wed, Jan 09, 2019 at 10:40:11AM +0800, wenxu@ucloud.cn wrote:
> From: wenxu <wenxu@ucloud.cn>
> 
> For nat example:
> client 1.1.1.7 ---> 2.2.2.7 which dnat to 10.0.0.7 server
> 
> When syn_rcv pkt from server it get the peer(client->server) route
> through daddr = ct->tuplehash[!dir].tuple.dst.u3.ip, the value 2.2.2.7
> is not correct in this situation. it should be 10.0.0.7
> ct->tuplehash[dir].tuple.src.u3.ip

Patch is correct, applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] nft_flow_offload: Fix the peer route get from wrong daddr
  2019-01-09 19:03 ` Pablo Neira Ayuso
@ 2019-01-09 19:06   ` Pablo Neira Ayuso
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-01-09 19:06 UTC (permalink / raw)
  To: wenxu; +Cc: netfilter-devel, netdev

On Wed, Jan 09, 2019 at 08:03:58PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Jan 09, 2019 at 10:40:11AM +0800, wenxu@ucloud.cn wrote:
> > From: wenxu <wenxu@ucloud.cn>
> > 
> > For nat example:
> > client 1.1.1.7 ---> 2.2.2.7 which dnat to 10.0.0.7 server
> > 
> > When syn_rcv pkt from server it get the peer(client->server) route
> > through daddr = ct->tuplehash[!dir].tuple.dst.u3.ip, the value 2.2.2.7
> > is not correct in this situation. it should be 10.0.0.7
> > ct->tuplehash[dir].tuple.src.u3.ip
> 
> Patch is correct, applied, thanks.

BTW, let me rewrite patch title to:

        netfilter: nft_flow_offload: Fix reverse route lookup

I'll also slightly revisit the patch description before applying.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-09 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-09  2:40 [PATCH RESEND] nft_flow_offload: Fix the peer route get from wrong daddr wenxu
2019-01-09 19:03 ` Pablo Neira Ayuso
2019-01-09 19:06   ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).