netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: honour non local bind
@ 2014-10-09 15:04 michele.dionisio
  2014-10-09 15:04 ` [PATCH] ipv6: make ipv6 bind honour non local bind as IPV4 michele.dionisio
  2014-10-09 17:07 ` [PATCH] ipv6: honour non local bind Lukas Tribus
  0 siblings, 2 replies; 4+ messages in thread
From: michele.dionisio @ 2014-10-09 15:04 UTC (permalink / raw)
  To: netdev, yoshfuji; +Cc: Michele Dionisio

From: Michele Dionisio <michele.dionisio@gmail.com>


Hi all,

I see that net.ipv4.ip_nonlocal_bind = 1 does not works on ipv6 if you try to bind on not local ip.
An easy test to see the issue using python is:

set  net.ipv4.ip_nonlocal_bind = 1 and in python shell try to execute

import socket
s = socket.socket(family=socket.AF_INET6)
s.bind(('2a01:84a0:1001:A001:0000:0:0015:8', 1234))

you receive an error. In ipv4 it works.

The patch attached solve the issue

Michele Dionisio (1):
  ipv6: make ipv6 bind honour non local bind as IPV4

 net/ipv6/af_inet6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.1.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ipv6: make ipv6 bind honour non local bind as IPV4
  2014-10-09 15:04 [PATCH] ipv6: honour non local bind michele.dionisio
@ 2014-10-09 15:04 ` michele.dionisio
  2014-10-09 17:07 ` [PATCH] ipv6: honour non local bind Lukas Tribus
  1 sibling, 0 replies; 4+ messages in thread
From: michele.dionisio @ 2014-10-09 15:04 UTC (permalink / raw)
  To: netdev, yoshfuji; +Cc: Michele Dionisio

From: Michele Dionisio <michele.dionisio@gmail.com>

---
 net/ipv6/af_inet6.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 2daa3a1..e8ca2e6 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -342,7 +342,8 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 			 */
 			v4addr = LOOPBACK4_IPV6;
 			if (!(addr_type & IPV6_ADDR_MULTICAST))	{
-				if (!(inet->freebind || inet->transparent) &&
+				if (!sysctl_ip_nonlocal_bind &&
+				    !(inet->freebind || inet->transparent) &&
 				    !ipv6_chk_addr(net, &addr->sin6_addr,
 						   dev, 0)) {
 					err = -EADDRNOTAVAIL;
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] ipv6: honour non local bind
  2014-10-09 15:04 [PATCH] ipv6: honour non local bind michele.dionisio
  2014-10-09 15:04 ` [PATCH] ipv6: make ipv6 bind honour non local bind as IPV4 michele.dionisio
@ 2014-10-09 17:07 ` Lukas Tribus
  2014-10-10  7:23   ` Michele Dionisio
  1 sibling, 1 reply; 4+ messages in thread
From: Lukas Tribus @ 2014-10-09 17:07 UTC (permalink / raw)
  To: michele.dionisio@gmail.com, netdev@vger.kernel.org,
	yoshfuji@linux-ipv6.org

Hi Michele,


> I see that net.ipv4.ip_nonlocal_bind = 1 does not works on ipv6 if
> you try to bind on not local ip.
> An easy test to see the issue using python is:
>
> set net.ipv4.ip_nonlocal_bind = 1 and in python shell try to execute
>
> import socket
> s = socket.socket(family=socket.AF_INET6)
> s.bind(('2a01:84a0:1001:A001:0000:0:0015:8', 1234))
>
> you receive an error. In ipv4 it works.
>
> The patch attached solve the issue


This has been proposed in the past and refused:
http://marc.info/?t=132369669000005&r=1&w=2

You will have to set the available socket options from the application.



Regards,

Lukas


 		 	   		  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ipv6: honour non local bind
  2014-10-09 17:07 ` [PATCH] ipv6: honour non local bind Lukas Tribus
@ 2014-10-10  7:23   ` Michele Dionisio
  0 siblings, 0 replies; 4+ messages in thread
From: Michele Dionisio @ 2014-10-10  7:23 UTC (permalink / raw)
  To: Lukas Tribus; +Cc: netdev@vger.kernel.org, yoshfuji@linux-ipv6.org

I have tested the socket option and it is perfectly working but a lot
of software does not use it and the option is linux specific.

Now I have read the previous patch and all the email related. I see
the reason to reject the previous patch, but this one does not add any
new parameter that has to be mantained. It can be usefull to use the
ipv4 parameter also because it is already used if ipv6 is
IPV6_ADDR_MAPPED

regards,

and many thank's for you time to answer me.

2014-10-09 19:07 GMT+02:00 Lukas Tribus <luky-37@hotmail.com>:
> Hi Michele,
>
>
>> I see that net.ipv4.ip_nonlocal_bind = 1 does not works on ipv6 if
>> you try to bind on not local ip.
>> An easy test to see the issue using python is:
>>
>> set net.ipv4.ip_nonlocal_bind = 1 and in python shell try to execute
>>
>> import socket
>> s = socket.socket(family=socket.AF_INET6)
>> s.bind(('2a01:84a0:1001:A001:0000:0:0015:8', 1234))
>>
>> you receive an error. In ipv4 it works.
>>
>> The patch attached solve the issue
>
>
> This has been proposed in the past and refused:
> http://marc.info/?t=132369669000005&r=1&w=2
>
> You will have to set the available socket options from the application.
>
>
>
> Regards,
>
> Lukas
>
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-10  7:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 15:04 [PATCH] ipv6: honour non local bind michele.dionisio
2014-10-09 15:04 ` [PATCH] ipv6: make ipv6 bind honour non local bind as IPV4 michele.dionisio
2014-10-09 17:07 ` [PATCH] ipv6: honour non local bind Lukas Tribus
2014-10-10  7:23   ` Michele Dionisio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).