[PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread Eric Dumazet
From: Eric Dumazet eduma...@google.com When an application needs to force a source IP on an active TCP socket it has to use bind(IP, port=x). As most applications do not want to deal with already used ports, x is often set to 0, meaning the kernel is in charge to find an available port. But

Re: [PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread Maciej Żenczykowski
Hmm, I certainly like this. So IMHO this is indeed much better than a sysctl to select a magic port to ignore during a bind call (previous internal patchset), although it does use up one more bit per socket (and one more syscall per connect). --- Thinking about this some more, I think it might

Re: [PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread Neal Cardwell
On Sat, Jun 6, 2015 at 11:53 AM, Eric Dumazet eric.duma...@gmail.com wrote: From: Eric Dumazet eduma...@google.com ... This patch adds a new SOL_IP socket option, asking kernel to ignore the 0 port provided by application in bind(IP, port=0) and only remember the given IP address. ... This

Re: [PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread Eric Dumazet
On Sat, 2015-06-06 at 22:30 -0400, Neal Cardwell wrote: I like this a lot. This addresses a very serious gap in the sockets API, and should be very useful. The comment mentions that this is available for IPv6. From skimming the change I would have expected inet6_bind() would need a change

Re: [PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread Eric Dumazet
On Sat, 2015-06-06 at 18:38 +0200, Maciej Żenczykowski wrote: Hmm, I certainly like this. So IMHO this is indeed much better than a sysctl to select a magic port to ignore during a bind call (previous internal patchset), although it does use up one more bit per socket (and one more syscall

Re: [PATCH net-next] inet: add IP_BIND_ADDRESS_NO_PORT to overcome bind(0) limitations

2015-06-06 Thread David Miller
Please do not top-post. -- To unsubscribe from this list: send the line unsubscribe netdev in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html