Skip to content

Commit

Permalink
netfilter: conntrack: make netns address part of nat bysrc hash
Browse files Browse the repository at this point in the history
Will be needed soon when we place all in the same hash table.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed May 9, 2016
1 parent bbe848e commit 464c385
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/netfilter/nf_nat_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ 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;

get_random_once(&nf_nat_hash_rnd, sizeof(nf_nat_hash_rnd));

/* 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) */
Expand Down

0 comments on commit 464c385

Please sign in to comment.