aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_sock.h')
-rw-r--r--include/net/inet_sock.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 9fabe5b38912..643e26be058e 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -25,6 +25,7 @@
25#include <net/sock.h> 25#include <net/sock.h>
26#include <net/request_sock.h> 26#include <net/request_sock.h>
27#include <net/route.h> 27#include <net/route.h>
28#include <net/netns/hash.h>
28 29
29/** struct ip_options - IP Options 30/** struct ip_options - IP Options
30 * 31 *
@@ -171,13 +172,14 @@ extern int inet_sk_rebuild_header(struct sock *sk);
171extern u32 inet_ehash_secret; 172extern u32 inet_ehash_secret;
172extern void build_ehash_secret(void); 173extern void build_ehash_secret(void);
173 174
174static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport, 175static inline unsigned int inet_ehashfn(struct net *net,
176 const __be32 laddr, const __u16 lport,
175 const __be32 faddr, const __be16 fport) 177 const __be32 faddr, const __be16 fport)
176{ 178{
177 return jhash_3words((__force __u32) laddr, 179 return jhash_3words((__force __u32) laddr,
178 (__force __u32) faddr, 180 (__force __u32) faddr,
179 ((__u32) lport) << 16 | (__force __u32)fport, 181 ((__u32) lport) << 16 | (__force __u32)fport,
180 inet_ehash_secret); 182 inet_ehash_secret + net_hash_mix(net));
181} 183}
182 184
183static inline int inet_sk_ehashfn(const struct sock *sk) 185static inline int inet_sk_ehashfn(const struct sock *sk)
@@ -187,8 +189,9 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
187 const __u16 lport = inet->num; 189 const __u16 lport = inet->num;
188 const __be32 faddr = inet->daddr; 190 const __be32 faddr = inet->daddr;
189 const __be16 fport = inet->dport; 191 const __be16 fport = inet->dport;
192 struct net *net = sock_net(sk);
190 193
191 return inet_ehashfn(laddr, lport, faddr, fport); 194 return inet_ehashfn(net, laddr, lport, faddr, fport);
192} 195}
193 196
194 197