View Single Post

  #7 (permalink)  
Old 01-07-2008
Pascal Hambourg
 
Posts: n/a
Default Re: Linux free port allocation algorithm

Hello,

kreide@gmail.com a écrit :
> There seems to have been a change in the Linux free port allocation
> algorithm somewhere between kernel 2.6.9 and 2.6.17.
>
> When a socket is allocated (with the bind() system call) with
> sin_port = 0 in 2.6.9 it seems that free ports are handed out
> sequentially, while 2.6.17 will hand them out in random order.


[cut description of application with broken behaviour]

> Does anyone know when the algorithm was changed?


2.6.11 :
[TCP]: Efficient port randomization

Provide port randomization for incoming connections using
variation of existing sequence number hash.

2.6.15 :
[TCP/DCCP]: Randomize port selection

This patch randomizes the port selected on bind() for connections
to help with possible security attacks. It should also be faster
in most cases because there is no need for a global lock.

> Is there a way to restore the old behavior in newer kernels?


I haven't found any sysctl which does that.
Reply With Quote