[lkml]   [2001]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] tcp_v4_get_port() and ephemeral ports
Dan Kegel wrote:

> So far, I've found an implementation of getifaddrs() that makes it
> easy to retrieve the list of local IP addresses, and modified my
> benchmark to assign a different local ip address to each user;
> the users use bind() with that address and a zero port number,
> and expect the system to assign a port.
> It's tempting to patch tcp_v4_get_port() to check
> sk->rcv_saddr, and if it's nonzero, allow the
> same ephemeral port number to be reused on different interfaces.
> Can anyone comment on the wisdom of such a change?

Hi Dan,

It shouldn't break anything as far as I can see. However, patching the
kernel simply to accommodate a benchmark does not seem the right thing
to do. Since your client is already binding the source address, why not
simply bind the port as well? You can easily loop the whole 64K range if
you want. Or you could even pick a completely empty port range and bind
each client socket with the SO_REUSE flag (which is ok, since your
clients are using different source addresses). I don't see any reason to
modify the kernel for this, particularly as it wouldn't really help port
exhaustion in real-life situations.

Best Regards,

Mika Liljeberg
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:03    [W:0.040 / U:1.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site