diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-06-16 20:11:50 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 20:11:50 -0400 |
commit | d6266281f8175e3ad68c28b20a609b278b47ade5 (patch) | |
tree | 16e8643eb5560d70daf1097c3a09df21b6d186c1 /net/ipv6/udp.c | |
parent | 942e7b102a4827fdb69a39c7f07c544542589ef9 (diff) |
udp: introduce a udp_hashfn function
Currently the chain to store a UDP socket is calculated with
simple (x & (UDP_HTABLE_SIZE - 1)). But taking net into account
would make this calculation a bit more complex, so moving it into
a function would help.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 09687f7a8564..6e4a822ba651 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -65,7 +65,7 @@ static struct sock *__udp6_lib_lookup(struct net *net, | |||
65 | int badness = -1; | 65 | int badness = -1; |
66 | 66 | ||
67 | read_lock(&udp_hash_lock); | 67 | read_lock(&udp_hash_lock); |
68 | sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { | 68 | sk_for_each(sk, node, &udptable[udp_hashfn(hnum)]) { |
69 | struct inet_sock *inet = inet_sk(sk); | 69 | struct inet_sock *inet = inet_sk(sk); |
70 | 70 | ||
71 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && | 71 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && |
@@ -361,7 +361,7 @@ static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr, | |||
361 | int dif; | 361 | int dif; |
362 | 362 | ||
363 | read_lock(&udp_hash_lock); | 363 | read_lock(&udp_hash_lock); |
364 | sk = sk_head(&udptable[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]); | 364 | sk = sk_head(&udptable[udp_hashfn(ntohs(uh->dest))]); |
365 | dif = inet6_iif(skb); | 365 | dif = inet6_iif(skb); |
366 | sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); | 366 | sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); |
367 | if (!sk) { | 367 | if (!sk) { |