SO_REUSEADDR semantics and bind conflicts

2018-01-24 Thread Gilberto Bertin
I'm trying to understand the details of SO_REUSEADDR behaviour. I think I've found some inconsistencies in how bind conflicts are handled. In particular, TCP and UDP behaviour seems to differ. Let’s start with simplest TCP cases. Case 1: * Socket A: bound to 0.0.0.0 tcp/1234; SO_REUSEADDR absent

[net-next RFC 0/4] SO_BINDTOPREFIX

2016-03-29 Thread Gilberto Bertin
me prefix. Any questions/feedback appreciated. Thanks, Gilberto Gilberto Bertin (4): bindtoprefix: infrastructure bindtoprefix: TCP/IPv4 implementation bindtoprefix: TCP/IPv6 implementation bindtoprefix: UPD implementation include/net/sock.h| 20 +++ include/uapi/a

[net-next RFC 3/4] bindtoprefix: TCP/IPv6 implementation

2016-03-29 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv6/inet6_connection_sock.c | 17 - net/ipv6/inet6_hashtables.c | 6 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 36c3f01..c65023f

[net-next RFC 4/4] bindtoprefix: UPD implementation

2016-03-29 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/udp.c | 36 1 file changed, 36 insertions(+) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 95d2f19..31b9687 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -133,6 +133,23 @@ EXPORT_SYMBOL

[net-next RFC 1/4] bindtoprefix: infrastructure

2016-03-29 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- include/net/sock.h| 20 +++ include/uapi/asm-generic/socket.h | 1 + net/core/sock.c | 111 ++ 3 files changed, 132 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h

[net-next RFC 2/4] bindtoprefix: TCP/IPv4 implementation

2016-03-29 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/inet_connection_sock.c | 20 +++- net/ipv4/inet_hashtables.c | 9 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 6414891..162c252

[net-next RFC 2/4] bindtosubnet: TCP/IPv4 implementation

2016-03-19 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/inet_connection_sock.c | 20 +++- net/ipv4/inet_hashtables.c | 9 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 6414891..0a3777c

[net-next RFC 0/4] SO_BINDTOSUBNET

2016-03-19 Thread Gilberto Bertin
ses masked with the shortest of their prefix are equal. The bindtosubnet option can be combined with soreuseport so that two listener can bind on the same subnet. Any questions/feedback appreciated. Thanks, Gilberto Gilberto Bertin (4): bindtosubnet: infrastructure bindtosubnet: TCP/IPv4

[net-next RFC 3/4] bindtosubnet: TCP/IPv6 implementation

2016-03-19 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv6/inet6_connection_sock.c | 17 - net/ipv6/inet6_hashtables.c | 6 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 36c3f01..288bab6

[net-next RFC 1/4] bindtosubnet: infrastructure

2016-03-19 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- include/net/sock.h| 20 +++ include/uapi/asm-generic/socket.h | 1 + net/core/sock.c | 111 ++ 3 files changed, 132 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h

[net-next RFC 4/4] bindtosubnet: UPD implementation

2016-03-19 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/udp.c | 36 1 file changed, 36 insertions(+) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 95d2f19..1ecffa8 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -133,6 +133,23 @@ EXPORT_SYMBOL

Re: [net-next RFC 0/4] SO_BINDTOSUBNET

2016-03-11 Thread Gilberto Bertin
> On 7 Mar 2016, at 17:49, Tom Herbert wrote: > >> That said, do you believe it could be an option to maybe have both these >> options? I think that the ability to run BPF in the listening path is >> really interesting, but it's probably an overkill for the bind-to-subnet >> use case. >> > > M

Re: [net-next RFC 0/4] SO_BINDTOSUBNET

2016-03-07 Thread Gilberto Bertin
> On 24 Feb 2016, at 05:06, Tom Herbert wrote: > > On Tue, Feb 23, 2016 at 7:27 AM, Gilberto Bertin > wrote: >> This series introduces support for the SO_BINDTOSUBNET socket option, which >> allows a listener socket to bind to a subnet instead of * or a single >&

Re: [net-next RFC 0/4] SO_BINDTOSUBNET

2016-02-25 Thread Gilberto Bertin
> On 24 Feb 2016, at 05:06, Tom Herbert wrote: > > On Tue, Feb 23, 2016 at 7:27 AM, Gilberto Bertin > wrote: >> This series introduces support for the SO_BINDTOSUBNET socket option, which >> allows a listener socket to bind to a subnet instead of * or a single >&

[net-next RFC 4/4] bindtosubnet: UPD implementation

2016-02-23 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/udp.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index c438908..0e78fc4 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -132,6 +132,22 @@ EXPORT_SYMBOL

[net-next RFC 1/4] bindtosubnet: infrastructure

2016-02-23 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- include/net/sock.h| 20 +++ include/uapi/asm-generic/socket.h | 1 + net/core/sock.c | 111 ++ 3 files changed, 132 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h

[net-next RFC 3/4] bindtosubnet: TCP/IPv6 implementation

2016-02-23 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv6/inet6_connection_sock.c | 17 - net/ipv6/inet6_hashtables.c | 6 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index a7ca2cd..b781a13

[net-next RFC 0/4] SO_BINDTOSUBNET

2016-02-23 Thread Gilberto Bertin
equal. The bindtosubnet option can be combined with soreuseport so that two listener can bind on the same subnet. Any questions/feedback appreciated. Thanks, Gilberto Gilberto Bertin (4): bindtosubnet: infrastructure bindtosubnet: TCP/IPv4 implementation bindtosubnet: TCP/IPv6 impl

[net-next RFC 2/4] bindtosubnet: TCP/IPv4 implementation

2016-02-23 Thread Gilberto Bertin
Signed-off-by: Gilberto Bertin --- net/ipv4/inet_connection_sock.c | 20 +++- net/ipv4/inet_hashtables.c | 9 + 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 46b9c88..b182ec6

Re: [BUG] Any-IP IPv6 support broken

2015-11-02 Thread Gilberto Bertin
> On 29 Oct 2015, at 17:44, Maciej Żenczykowski wrote: > > What are you trying to do? I would like to have a "bind-to-subnet" semantic with IPv6. This is currently working with IPv4, and the setup is the follow: - setup a dummy network device configured with any-IP - add an any-IP route - bin

Re: [BUG] Any-IP IPv6 support broken

2015-10-29 Thread Gilberto Bertin
> On 29 Oct 2015, at 18:39, Hannes Frederic Sowa > wrote: > > Try the loopback interface: > > ip -6 route add local abcd:abcd:abcd:abcd::/64 dev *lo* > > Otherwise packets should end up in neighbor subsystem and you don't want > that, still. ;) > Thanks for the reply. I know it’s working o

[BUG] Any-IP IPv6 support broken

2015-10-29 Thread Gilberto Bertin
Hello, testing Any-IP on my machine, I noticed that it's not working with IPv6 addresses. Tests are performed on a 4.1 kernel. Steps to reproduce the bug: 1- make sure Any-IP is working with IPv4 addresses: # ip -4 route add local 4.4.4.0/24 dev eth0 with this command every packets with an IP i