Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351582
b: refs/heads/master
c: 72289b9
h: refs/heads/master
v: v3
  • Loading branch information
Tom Herbert authored and David S. Miller committed Jan 23, 2013
1 parent 64e28d2 commit 86b2373
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5ba24953e9707387cce87b07f0d5fbdd03c5c11b
refs/heads/master: 72289b96c943757220ccc681fe2e22b46e21aced
30 changes: 27 additions & 3 deletions trunk/net/ipv6/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include <net/tcp_states.h>
#include <net/ip6_checksum.h>
#include <net/xfrm.h>
#include <net/inet6_hashtables.h>

#include <linux/proc_fs.h>
#include <linux/seq_file.h>
Expand Down Expand Up @@ -203,7 +204,8 @@ static struct sock *udp6_lib_lookup2(struct net *net,
{
struct sock *sk, *result;
struct hlist_nulls_node *node;
int score, badness;
int score, badness, matches = 0, reuseport = 0;
u32 hash = 0;

begin:
result = NULL;
Expand All @@ -214,8 +216,18 @@ static struct sock *udp6_lib_lookup2(struct net *net,
if (score > badness) {
result = sk;
badness = score;
if (score == SCORE2_MAX)
reuseport = sk->sk_reuseport;
if (reuseport) {
hash = inet6_ehashfn(net, daddr, hnum,
saddr, sport);
matches = 1;
} else if (score == SCORE2_MAX)
goto exact_match;
} else if (score == badness && reuseport) {
matches++;
if (((u64)hash * matches) >> 32 == 0)
result = sk;
hash = next_pseudo_random32(hash);
}
}
/*
Expand Down Expand Up @@ -249,7 +261,8 @@ struct sock *__udp6_lib_lookup(struct net *net,
unsigned short hnum = ntohs(dport);
unsigned int hash2, slot2, slot = udp_hashfn(net, hnum, udptable->mask);
struct udp_hslot *hslot2, *hslot = &udptable->hash[slot];
int score, badness;
int score, badness, matches = 0, reuseport = 0;
u32 hash = 0;

rcu_read_lock();
if (hslot->count > 10) {
Expand Down Expand Up @@ -284,6 +297,17 @@ struct sock *__udp6_lib_lookup(struct net *net,
if (score > badness) {
result = sk;
badness = score;
reuseport = sk->sk_reuseport;
if (reuseport) {
hash = inet6_ehashfn(net, daddr, hnum,
saddr, sport);
matches = 1;
}
} else if (score == badness && reuseport) {
matches++;
if (((u64)hash * matches) >> 32 == 0)
result = sk;
hash = next_pseudo_random32(hash);
}
}
/*
Expand Down

0 comments on commit 86b2373

Please sign in to comment.