diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2013-10-19 15:48:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-10-19 19:45:34 -0400 |
commit | 65cd8033ff375b68037df61603ee68070dc48578 (patch) | |
tree | 26b34f9ed023dda5a861001118a1ea1227ae252f /net/ipv4/udp.c | |
parent | 53481da372851a5506deb5247302f75459b472b4 (diff) |
ipv4: split inet_ehashfn to hash functions per compilation unit
This duplicates a bit of code but let's us easily introduce
separate secret keys later. The separate compilation units are
ipv4/inet_hashtabbles.o, ipv4/udp.o and rds/connection.o.
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/ipv4/udp.c')
-rw-r--r-- | net/ipv4/udp.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 9f27bb800607..b4437c7db6ce 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -407,6 +407,14 @@ static inline int compute_score2(struct sock *sk, struct net *net, | |||
407 | return score; | 407 | return score; |
408 | } | 408 | } |
409 | 409 | ||
410 | static unsigned int udp_ehashfn(struct net *net, const __be32 laddr, | ||
411 | const __u16 lport, const __be32 faddr, | ||
412 | const __be16 fport) | ||
413 | { | ||
414 | return __inet_ehashfn(laddr, lport, faddr, fport, | ||
415 | inet_ehash_secret + net_hash_mix(net)); | ||
416 | } | ||
417 | |||
410 | 418 | ||
411 | /* called with read_rcu_lock() */ | 419 | /* called with read_rcu_lock() */ |
412 | static struct sock *udp4_lib_lookup2(struct net *net, | 420 | static struct sock *udp4_lib_lookup2(struct net *net, |
@@ -430,8 +438,8 @@ begin: | |||
430 | badness = score; | 438 | badness = score; |
431 | reuseport = sk->sk_reuseport; | 439 | reuseport = sk->sk_reuseport; |
432 | if (reuseport) { | 440 | if (reuseport) { |
433 | hash = inet_ehashfn(net, daddr, hnum, | 441 | hash = udp_ehashfn(net, daddr, hnum, |
434 | saddr, sport); | 442 | saddr, sport); |
435 | matches = 1; | 443 | matches = 1; |
436 | } | 444 | } |
437 | } else if (score == badness && reuseport) { | 445 | } else if (score == badness && reuseport) { |
@@ -511,8 +519,8 @@ begin: | |||
511 | badness = score; | 519 | badness = score; |
512 | reuseport = sk->sk_reuseport; | 520 | reuseport = sk->sk_reuseport; |
513 | if (reuseport) { | 521 | if (reuseport) { |
514 | hash = inet_ehashfn(net, daddr, hnum, | 522 | hash = udp_ehashfn(net, daddr, hnum, |
515 | saddr, sport); | 523 | saddr, sport); |
516 | matches = 1; | 524 | matches = 1; |
517 | } | 525 | } |
518 | } else if (score == badness && reuseport) { | 526 | } else if (score == badness && reuseport) { |