aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_hashtables.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r--include/net/inet_hashtables.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 735b926a3497..bb619d80f2e2 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -29,6 +29,7 @@
29#include <net/inet_sock.h> 29#include <net/inet_sock.h>
30#include <net/sock.h> 30#include <net/sock.h>
31#include <net/tcp_states.h> 31#include <net/tcp_states.h>
32#include <net/netns/hash.h>
32 33
33#include <asm/atomic.h> 34#include <asm/atomic.h>
34#include <asm/byteorder.h> 35#include <asm/byteorder.h>
@@ -201,23 +202,24 @@ extern struct inet_bind_bucket *
201extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 202extern void inet_bind_bucket_destroy(struct kmem_cache *cachep,
202 struct inet_bind_bucket *tb); 203 struct inet_bind_bucket *tb);
203 204
204static inline int inet_bhashfn(const __u16 lport, const int bhash_size) 205static inline int inet_bhashfn(struct net *net,
206 const __u16 lport, const int bhash_size)
205{ 207{
206 return lport & (bhash_size - 1); 208 return (lport + net_hash_mix(net)) & (bhash_size - 1);
207} 209}
208 210
209extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 211extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
210 const unsigned short snum); 212 const unsigned short snum);
211 213
212/* These can have wildcards, don't try too hard. */ 214/* These can have wildcards, don't try too hard. */
213static inline int inet_lhashfn(const unsigned short num) 215static inline int inet_lhashfn(struct net *net, const unsigned short num)
214{ 216{
215 return num & (INET_LHTABLE_SIZE - 1); 217 return (num + net_hash_mix(net)) & (INET_LHTABLE_SIZE - 1);
216} 218}
217 219
218static inline int inet_sk_listen_hashfn(const struct sock *sk) 220static inline int inet_sk_listen_hashfn(const struct sock *sk)
219{ 221{
220 return inet_lhashfn(inet_sk(sk)->num); 222 return inet_lhashfn(sock_net(sk), inet_sk(sk)->num);
221} 223}
222 224
223/* Caller must disable local BH processing. */ 225/* Caller must disable local BH processing. */