[Devel] [PATCH rh7 16/19] ms/netfilter: conntrack: make netns address part of nat bysrc hash
Konstantin Khorenko
khorenko at virtuozzo.com
Fri May 22 11:10:53 MSK 2020
From: Florian Westphal <fw at strlen.de>
Will be needed soon when we place all in the same hash table.
Signed-off-by: Florian Westphal <fw at strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
https://jira.sw.ru/browse/PSBM-103515
(cherry picked from commit 464c38556e06723b4c77d36fecff140b8527bc59)
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
net/netfilter/nf_nat_core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/nf_nat_core.c b/net/netfilter/nf_nat_core.c
index 4ee3f288cd82f..4f292c7edd798 100644
--- a/net/netfilter/nf_nat_core.c
+++ b/net/netfilter/nf_nat_core.c
@@ -122,7 +122,7 @@ EXPORT_SYMBOL(nf_xfrm_me_harder);
/* We keep an extra hash for each conntrack, for fast searching. */
static inline unsigned int
-hash_by_src(const struct net *net, const struct nf_conntrack_tuple *tuple)
+hash_by_src(const struct net *n, const struct nf_conntrack_tuple *tuple)
{
unsigned int hash;
@@ -130,9 +130,9 @@ hash_by_src(const struct net *net, const struct nf_conntrack_tuple *tuple)
/* Original src, to ensure we map it consistently if poss. */
hash = jhash2((u32 *)&tuple->src, sizeof(tuple->src) / sizeof(u32),
- tuple->dst.protonum ^ nf_nat_hash_rnd);
+ tuple->dst.protonum ^ nf_nat_hash_rnd ^ net_hash_mix(n));
- return reciprocal_scale(hash, net->ct.nat_htable_size);
+ return reciprocal_scale(hash, n->ct.nat_htable_size);
}
/* Is this tuple already taken? (not by us) */
--
2.15.1
More information about the Devel
mailing list