alistair23-linux/include
Eric Dumazet 719f835853 udp: add rehash on connect()
commit 30fff923 introduced in linux-2.6.33 (udp: bind() optimisation)
added a secondary hash on UDP, hashed on (local addr, local port).

Problem is that following sequence :

fd = socket(...)
connect(fd, &remote, ...)

not only selects remote end point (address and port), but also sets
local address, while UDP stack stored in secondary hash table the socket
while its local address was INADDR_ANY (or ipv6 equivalent)

Sequence is :
 - autobind() : choose a random local port, insert socket in hash tables
              [while local address is INADDR_ANY]
 - connect() : set remote address and port, change local address to IP
              given by a route lookup.

When an incoming UDP frame comes, if more than 10 sockets are found in
primary hash table, we switch to secondary table, and fail to find
socket because its local address changed.

One solution to this problem is to rehash datagram socket if needed.

We add a new rehash(struct socket *) method in "struct proto", and
implement this method for UDP v4 & v6, using a common helper.

This rehashing only takes care of secondary hash table, since primary
hash (based on local port only) is not changed.

Reported-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Tested-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-09-08 21:45:01 -07:00
..
acpi
asm-generic
crypto
drm x86 platform driver: intelligent power sharing driver 2010-08-03 09:48:45 -04:00
keys
linux header: fix broken headers for user space 2010-08-22 21:15:39 -07:00
math-emu
media V4L/DVB: dib0700: break keytable into NEC and RC-5 variants 2010-08-02 16:43:49 -03:00
mtd
net udp: add rehash on connect() 2010-09-08 21:45:01 -07:00
pcmcia
rdma
rxrpc
scsi [SCSI] implement runtime Power Management 2010-07-28 09:07:50 -05:00
sound
trace [CPUFREQ] x86 cpufreq: Make trace_power_frequency cpufreq driver independent 2010-08-03 13:47:05 -04:00
video
xen
Kbuild