Skip to content

Commit

Permalink
udp: add struct net argument to udp_hashfn
Browse files Browse the repository at this point in the history
Every caller already has this one. The new argument is currently 
unused, but this will be fixed shortly.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jun 17, 2008
1 parent e316349 commit 19c7578
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/linux/udp.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)

#define UDP_HTABLE_SIZE 128

static inline int udp_hashfn(const unsigned num)
static inline int udp_hashfn(struct net *net, const unsigned num)
{
return num & (UDP_HTABLE_SIZE - 1);
}
Expand Down
12 changes: 6 additions & 6 deletions net/ipv4/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static inline int __udp_lib_lport_inuse(struct net *net, __u16 num,
struct sock *sk;
struct hlist_node *node;

sk_for_each(sk, node, &udptable[udp_hashfn(num)])
sk_for_each(sk, node, &udptable[udp_hashfn(net, num)])
if (net_eq(sock_net(sk), net) && sk->sk_hash == num)
return 1;
return 0;
Expand Down Expand Up @@ -174,7 +174,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
for (i = 0; i < UDP_HTABLE_SIZE; i++) {
int size = 0;

head = &udptable[udp_hashfn(rover)];
head = &udptable[udp_hashfn(net, rover)];
if (hlist_empty(head))
goto gotit;

Expand Down Expand Up @@ -211,7 +211,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
gotit:
snum = rover;
} else {
head = &udptable[udp_hashfn(snum)];
head = &udptable[udp_hashfn(net, snum)];

sk_for_each(sk2, node, head)
if (sk2->sk_hash == snum &&
Expand All @@ -227,7 +227,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
inet_sk(sk)->num = snum;
sk->sk_hash = snum;
if (sk_unhashed(sk)) {
head = &udptable[udp_hashfn(snum)];
head = &udptable[udp_hashfn(net, snum)];
sk_add_node(sk, head);
sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
}
Expand Down Expand Up @@ -264,7 +264,7 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
int badness = -1;

read_lock(&udp_hash_lock);
sk_for_each(sk, node, &udptable[udp_hashfn(hnum)]) {
sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) {
struct inet_sock *inet = inet_sk(sk);

if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
Expand Down Expand Up @@ -1068,7 +1068,7 @@ static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
int dif;

read_lock(&udp_hash_lock);
sk = sk_head(&udptable[udp_hashfn(ntohs(uh->dest))]);
sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
dif = skb->dev->ifindex;
sk = udp_v4_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
if (sk) {
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static struct sock *__udp6_lib_lookup(struct net *net,
int badness = -1;

read_lock(&udp_hash_lock);
sk_for_each(sk, node, &udptable[udp_hashfn(hnum)]) {
sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) {
struct inet_sock *inet = inet_sk(sk);

if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
Expand Down Expand Up @@ -362,7 +362,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
int dif;

read_lock(&udp_hash_lock);
sk = sk_head(&udptable[udp_hashfn(ntohs(uh->dest))]);
sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]);
dif = inet6_iif(skb);
sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif);
if (!sk) {
Expand Down

0 comments on commit 19c7578

Please sign in to comment.