]> git.baikalelectronics.ru Git - kernel.git/commit
udp: ipv4: do not waste time in __udp4_lib_mcast_demux_lookup
authorEric Dumazet <edumazet@google.com>
Thu, 12 Jun 2014 23:13:06 +0000 (16:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 13 Jun 2014 22:39:24 +0000 (15:39 -0700)
commitdd4cd47e41206aa2eae1d6c9507830aa466cb8b4
tree4cc5ca8299a5a4bc1b7ec09baaea25864159cdb7
parentfc341758952f2dcfb1b78d79cd4322838e098f36
udp: ipv4: do not waste time in __udp4_lib_mcast_demux_lookup

Its too easy to add thousand of UDP sockets on a particular bucket,
and slow down an innocent multicast receiver.

Early demux is supposed to be an optimization, we should avoid spending
too much time in it.

It is interesting to note __udp4_lib_demux_lookup() only tries to
match first socket in the chain.

10 is the threshold we already have in __udp4_lib_lookup() to switch
to secondary hash.

Fixes: f6730a094d567 ("udp: ipv4: Add udp early demux")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: David Held <drheld@google.com>
Cc: Shawn Bohrer <sbohrer@rgmadvisors.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c