netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] UDP : bind() checks are not complete
@ 2007-06-05 17:15 Eric Dumazet
  2007-06-05 20:02 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2007-06-05 17:15 UTC (permalink / raw)
  To: David Miller; +Cc: netdev@vger.kernel.org

David

I discovered one big problem with UDP binding in 2.6.22-rc4 :

Consider you have eth0 with addr 192.168.0.1

Consider one UDP socket was bound to 192.168.0.1:32769. It will be stored on a slot != 1

Another UDP socket is created and binded to (0.0.0.0:0)

__udp_lib_get_port() is called with snum=0 and ANY_ADDR

We try to find a hash chain with the lowest count of sockets.

If we find an empty chain (slot=1 result=32769 for example), we consider we finished our checks.

This not true since last udp lookups changes. 

If we allow the new socket to get port 32769, and source address of
outgoing message is set to 192.168.0.1, then answers 
(incoming messages to 192.168.0.1:32769) will go to first socket, because 

We really should check no socket is bound to XXX.XXX.XXX.XXX:32769. With current hashing, 
it means checking all slots in udptable[] :(

Our choices are :

1) Drop all thoses patches and re-think them for 2.6.23 eventually
2) Add the extra check for ANY_ADDR sockets and perform a full scan

What do you think ?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-05 23:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-05 17:15 [BUG] UDP : bind() checks are not complete Eric Dumazet
2007-06-05 20:02 ` David Miller
2007-06-05 20:22   ` Eric Dumazet
2007-06-05 20:37     ` David Miller
2007-06-05 23:00       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).