From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 4/7] netfilter: nft_flow_offload: Fix reverse route lookup
Date: Mon, 14 Jan 2019 22:29:37 +0100 [thread overview]
Message-ID: <20190114212940.5704-5-pablo@netfilter.org> (raw)
In-Reply-To: <20190114212940.5704-1-pablo@netfilter.org>
From: wenxu <wenxu@ucloud.cn>
Using the following example:
client 1.1.1.7 ---> 2.2.2.7 which dnat to 10.0.0.7 server
The first reply packet (ie. syn+ack) uses an incorrect destination
address for the reverse route lookup since it uses:
daddr = ct->tuplehash[!dir].tuple.dst.u3.ip;
which is 2.2.2.7 in the scenario that is described above, while this
should be:
daddr = ct->tuplehash[dir].tuple.src.u3.ip;
that is 10.0.0.7.
Signed-off-by: wenxu <wenxu@ucloud.cn>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
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 974525eb92df..ccdb8f5ababb 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;
}
--
2.11.0
next prev parent reply other threads:[~2019-01-14 21:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-14 21:29 [PATCH 0/7] Netfilter fixes for net Pablo Neira Ayuso
2019-01-14 21:29 ` [PATCH 1/7] netfilter: nf_tables: Fix for endless loop when dumping ruleset Pablo Neira Ayuso
2019-01-14 21:29 ` [PATCH 2/7] netfilter: nf_tables: fix leaking object reference count Pablo Neira Ayuso
2019-01-14 21:29 ` [PATCH 3/7] netfilter: nf_tables: selective rule dump needs table to be specified Pablo Neira Ayuso
2019-01-14 21:29 ` Pablo Neira Ayuso [this message]
2019-01-14 21:29 ` [PATCH 5/7] netfilter: ebtables: account ebt_table_info to kmemcg Pablo Neira Ayuso
2019-01-14 21:29 ` [PATCH 6/7] netfilter: nft_flow_offload: fix interaction with vrf slave device Pablo Neira Ayuso
2019-01-14 21:29 ` [PATCH 7/7] netfilter: nft_flow_offload: fix checking method of conntrack helper Pablo Neira Ayuso
2019-01-15 21:32 ` [PATCH 0/7] Netfilter fixes for net David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190114212940.5704-5-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).