aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/inet6_hashtables.c
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-10-19 15:48:52 -0400
committerDavid S. Miller <davem@davemloft.net>2013-10-19 19:45:34 -0400
commitb50026b5ac8fe2932e6af0c54b21da0913c4c1c7 (patch)
tree20512abd4da03805b6ea2574c6ed536c46581d2f /net/ipv6/inet6_hashtables.c
parent65cd8033ff375b68037df61603ee68070dc48578 (diff)
ipv6: split inet6_ehashfn to hash functions per compilation unit
This patch splits the inet6_ehashfn into separate ones in ipv6/inet6_hashtables.o and ipv6/udp.o to ease the introduction of seperate secrets keys later. Cc: Eric Dumazet <edumazet@google.com> Cc: "David S. Miller" <davem@davemloft.net> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/inet6_hashtables.c')
-rw-r--r--net/ipv6/inet6_hashtables.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c
index 842d833dfc18..fa7dd3856c55 100644
--- a/net/ipv6/inet6_hashtables.c
+++ b/net/ipv6/inet6_hashtables.c
@@ -23,6 +23,30 @@
23#include <net/secure_seq.h> 23#include <net/secure_seq.h>
24#include <net/ip.h> 24#include <net/ip.h>
25 25
26static unsigned int inet6_ehashfn(struct net *net,
27 const struct in6_addr *laddr,
28 const u16 lport,
29 const struct in6_addr *faddr,
30 const __be16 fport)
31{
32 const u32 lhash = (__force u32)laddr->s6_addr32[3];
33 const u32 fhash = __ipv6_addr_jhash(faddr, ipv6_hash_secret);
34 return __inet6_ehashfn(lhash, lport, fhash, fport,
35 inet_ehash_secret + net_hash_mix(net));
36}
37
38static int inet6_sk_ehashfn(const struct sock *sk)
39{
40 const struct inet_sock *inet = inet_sk(sk);
41 const struct in6_addr *laddr = &sk->sk_v6_rcv_saddr;
42 const struct in6_addr *faddr = &sk->sk_v6_daddr;
43 const __u16 lport = inet->inet_num;
44 const __be16 fport = inet->inet_dport;
45 struct net *net = sock_net(sk);
46
47 return inet6_ehashfn(net, laddr, lport, faddr, fport);
48}
49
26int __inet6_hash(struct sock *sk, struct inet_timewait_sock *tw) 50int __inet6_hash(struct sock *sk, struct inet_timewait_sock *tw)
27{ 51{
28 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo; 52 struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;