Thread (105 messages) 105 messages, 13 authors, 2008-11-24

Re: [PATCH 3/3] Convert the UDP hash lock to RCU

From: Eric Dumazet <hidden>
Date: 2008-10-08 13:56:06
Also in: lkml

David Miller a écrit :
From: Stephen Hemminger <redacted>
Date: Tue, 7 Oct 2008 16:07:29 +0200
quoted
The idea of keeping chains short is the problem. That code should
just be pulled because it doesn't help that much, and also creates
bias on the port randomization.
I have that patch from Vitaly Mayatskikh which does exactly this.

I keep looking at it, but I can't bring myself to apply it since
I'm not completely convinced.
Vitaly patch might be appropriate if only few UDP ports are opened.

We could zap the code to search short chains and extend Vitaly's
idea with following patch :

[PATCH] udp: Improve port randomization

Current UDP port allocation is suboptimal.
We select the shortest chain to chose a port (out of 512)
that will hash in this shortest chain.

First, it can lead to give not so ramdom ports and ease
give attackers more opportunities to break the system.

Second, it can consume a lot of CPU to scan all table
in order to find the shortest chain.

Third, in some pathological cases we can fail to find
a free port even if they are plenty of them.

This patch zap the search for a short chain and only
use one random seed. Problem of getting long chains
should be addressed in another way, since we can
obtain long chains with non random ports.

Based on a report and patch from Vitaly Mayatskikh

Signed-off-by: Eric Dumazet <redacted>

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help