Subject: Re: ports beeing reused too fast

From: Stephen Hemminger <[email-masked]>
Date: Thu, 14 May 2009 13:29:44 -0700

On Tue, 12 May 2009 18:52:25 +0300
Octavian Purdila <[email-masked]> wrote:

> 
> > I raised the issue to the original author of the proposed RFC and added
> > the issue to the ongoing review of the draft.
> >
> > There is a suggested workaround using a bitmap but it seems like it would
> > be expensive to implement:
> >       
> > http://ietfreport.isoc.org/all-ids/draft-ananth-tsvwg-timewait-00.txt
> 
> OK, I now understand how TW could be an issue here - I didn't realize that we 
> could have sockets in TW on the server side.
> 
> Since the workaround seems expensive, would it be acceptable to add a new 
> sysctl option to disable port randomization?
> 
> Thanks,
> tavi
> 

Patches welcome.  Also, it matters whether application does bind() first
or port is assigned as part of the accept. In the later case the starting
point is a hash of the 5 tuple and changes only every 5 minutes.  Linux
also reuses ports in time wait, so it will reuse sockets more aggressively
than other hosts; this existed before port randomization.

--