diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-08-25 02:09:41 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:31 -0400 |
commit | 32c1da70810017a98aa6c431a5494a302b6b9a30 (patch) | |
tree | 8583fe356829dd0265c673798262453d4bc36869 /net/ipv4/udplite.c | |
parent | 356f89e12e301376f26795643f3b5931c81c9cd5 (diff) |
[UDP]: Randomize port selection.
This patch causes UDP port allocation to be randomized like TCP.
The earlier code would always choose same port (ie first empty list).
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udplite.c')
-rw-r--r-- | net/ipv4/udplite.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/net/ipv4/udplite.c b/net/ipv4/udplite.c index f34fd686a8f1..94977205abb4 100644 --- a/net/ipv4/udplite.c +++ b/net/ipv4/udplite.c | |||
@@ -16,12 +16,11 @@ | |||
16 | DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics) __read_mostly; | 16 | DEFINE_SNMP_STAT(struct udp_mib, udplite_statistics) __read_mostly; |
17 | 17 | ||
18 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 18 | struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
19 | static int udplite_port_rover; | ||
20 | 19 | ||
21 | int udplite_get_port(struct sock *sk, unsigned short p, | 20 | int udplite_get_port(struct sock *sk, unsigned short p, |
22 | int (*c)(const struct sock *, const struct sock *)) | 21 | int (*c)(const struct sock *, const struct sock *)) |
23 | { | 22 | { |
24 | return __udp_lib_get_port(sk, p, udplite_hash, &udplite_port_rover, c); | 23 | return __udp_lib_get_port(sk, p, udplite_hash, c); |
25 | } | 24 | } |
26 | 25 | ||
27 | static int udplite_v4_get_port(struct sock *sk, unsigned short snum) | 26 | static int udplite_v4_get_port(struct sock *sk, unsigned short snum) |