Subject: Re: Internet-Draft on Port Randomisation

From: Andi Kleen <[email-masked]>
Date: Tue, 09 Sep 2008 16:28:30 +0200

Stephen Hemminger <[email-masked]> writes:

> Eugene Teo wrote:
>> Has anyone read this Internet-Draft?
>> http://www.gont.com.ar/drafts/port-randomization/draft-ietf-tsvwg-port-randomization-02.txt
>>
>> In this memo, there are descriptions of four different ephemeral port
>> randomisation algorithms (see page 17).
>>
>> Algo #1 and #2 are simple port randomisation algorithms. Algo #3 is
>> what we have in Linux. The memo suggested algorithm #4, double-hash
>> randomisation algorithm, which is an improvement to algo #3 (see page
>> 15).
>>
>> Does anyone have any thought about the improved algorithm? Is this
>> worth implementing,
> No the added lock overhead of a global next free port array is not
> worth it. 

[haven't read the draft] But you don't necessarily need a full global
lock for such a scheme. What works too is to access global state only
ever N accesses and pre-allocate a small range per CPU. While there's
still some global overhead then, it happens significantly less. My old
alternative ipid setup algorithm worked this way.

One drawback of such a scheme today: on RT kernels the per CPU state
tends to be become a problem.

-Andi
-- 
[email-masked]