diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2013-10-19 21:48:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-19 19:45:34 -0400 |
commit | b50026b5ac8fe2932e6af0c54b21da0913c4c1c7 (patch) | |
tree | 20512abd4da03805b6ea2574c6ed536c46581d2f /net/ipv6/udp.c | |
parent | 65cd8033ff375b68037df61603ee68070dc48578 (diff) | |
download | op-kernel-dev-b50026b5ac8fe2932e6af0c54b21da0913c4c1c7.zip op-kernel-dev-b50026b5ac8fe2932e6af0c54b21da0913c4c1c7.tar.gz |
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/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index b496de1..324bd36 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -53,6 +53,18 @@ #include <trace/events/skb.h> #include "udp_impl.h" +static unsigned int udp6_ehashfn(struct net *net, + const struct in6_addr *laddr, + const u16 lport, + const struct in6_addr *faddr, + const __be16 fport) +{ + const u32 lhash = (__force u32)laddr->s6_addr32[3]; + const u32 fhash = __ipv6_addr_jhash(faddr, ipv6_hash_secret); + return __inet6_ehashfn(lhash, lport, fhash, fport, + inet_ehash_secret + net_hash_mix(net)); +} + int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2) { const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2); @@ -214,8 +226,8 @@ begin: badness = score; reuseport = sk->sk_reuseport; if (reuseport) { - hash = inet6_ehashfn(net, daddr, hnum, - saddr, sport); + hash = udp6_ehashfn(net, daddr, hnum, + saddr, sport); matches = 1; } else if (score == SCORE2_MAX) goto exact_match; @@ -295,8 +307,8 @@ begin: badness = score; reuseport = sk->sk_reuseport; if (reuseport) { - hash = inet6_ehashfn(net, daddr, hnum, - saddr, sport); + hash = udp6_ehashfn(net, daddr, hnum, + saddr, sport); matches = 1; } } else if (score == badness && reuseport) { |