netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4)
       [not found] <20090822011541.7b95dbcc@neptune.home>
@ 2009-08-21 23:45 ` Bruno Prémont
  2009-08-24  2:07   ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Prémont @ 2009-08-21 23:45 UTC (permalink / raw)
  To: Vlad Yasevich, David S. Miller; +Cc: netdev

Commit 63d9950b08184e6531adceb65f64b429909cc101
  (ipv6: Make v4-mapped bindings consistent with IPv4)
changes behavior of inet6_bind() for v4-mapped addresses so it should
behave the same way as inet_bind().

During this change setting of err to -EADDRNOTAVAIL got lost:

af_inet.c:469 inet_bind()
	err = -EADDRNOTAVAIL;
	if (!sysctl_ip_nonlocal_bind &&
	    !(inet->freebind || inet->transparent) &&
	    addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
	    chk_addr_ret != RTN_LOCAL &&
	    chk_addr_ret != RTN_MULTICAST &&
	    chk_addr_ret != RTN_BROADCAST)
		goto out;


af_inet6.c:463 inet6_bind()
	if (addr_type == IPV6_ADDR_MAPPED) {
		int chk_addr_ret;

		/* Binding to v4-mapped address on a v6-only socket                         
		 * makes no sense                                                           
		 */
		if (np->ipv6only) {
			err = -EINVAL;
			goto out; 
		}

		/* Reproduce AF_INET checks to make the bindings consitant */               
		v4addr = addr->sin6_addr.s6_addr32[3];                                      
		chk_addr_ret = inet_addr_type(net, v4addr);                                 
		if (!sysctl_ip_nonlocal_bind &&                                             
		    !(inet->freebind || inet->transparent) &&                               
		    v4addr != htonl(INADDR_ANY) &&
		    chk_addr_ret != RTN_LOCAL &&                                            
		    chk_addr_ret != RTN_MULTICAST &&                                        
		    chk_addr_ret != RTN_BROADCAST)
			goto out;
	} else {


Signed-off-by Bruno Prémont <bonbons@linux-vserver.org>
---
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index caa0278..45f9a2a 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -306,8 +306,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 		    v4addr != htonl(INADDR_ANY) &&
 		    chk_addr_ret != RTN_LOCAL &&
 		    chk_addr_ret != RTN_MULTICAST &&
-		    chk_addr_ret != RTN_BROADCAST)
+		    chk_addr_ret != RTN_BROADCAST) {
+			err = -EADDRNOTAVAIL;
 			goto out;
+		}
 	} else {
 		if (addr_type != IPV6_ADDR_ANY) {
 			struct net_device *dev = NULL;


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

* Re: [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4)
  2009-08-21 23:45 ` [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4) Bruno Prémont
@ 2009-08-24  2:07   ` David Miller
  2009-08-25 20:20     ` Bruno Prémont
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2009-08-24  2:07 UTC (permalink / raw)
  To: bonbons; +Cc: vladislav.yasevich, netdev

From: Bruno Prémont <bonbons@linux-vserver.org>
Date: Sat, 22 Aug 2009 01:45:23 +0200

> Commit 63d9950b08184e6531adceb65f64b429909cc101
>   (ipv6: Make v4-mapped bindings consistent with IPv4)
> changes behavior of inet6_bind() for v4-mapped addresses so it should
> behave the same way as inet_bind().
> 
> During this change setting of err to -EADDRNOTAVAIL got lost:
 ...
> Signed-off-by Bruno Prémont <bonbons@linux-vserver.org>

Thanks for finding and fixing this bug, applied, thanks!

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

* Re: [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4)
  2009-08-24  2:07   ` David Miller
@ 2009-08-25 20:20     ` Bruno Prémont
  2009-09-03 22:25       ` [stable] " Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Bruno Prémont @ 2009-08-25 20:20 UTC (permalink / raw)
  To: stable; +Cc: David Miller, vladislav.yasevich, netdev

On Sun, 23 August 2009 David Miller <davem@davemloft.net> wrote:
> From: Bruno Prémont <bonbons@linux-vserver.org>
> Date: Sat, 22 Aug 2009 01:45:23 +0200
> 
> > Commit 63d9950b08184e6531adceb65f64b429909cc101
> >   (ipv6: Make v4-mapped bindings consistent with IPv4)
> > changes behavior of inet6_bind() for v4-mapped addresses so it
> > should behave the same way as inet_bind().
> > 
> > During this change setting of err to -EADDRNOTAVAIL got lost:
>  ...
> > Signed-off-by Bruno Prémont <bonbons@linux-vserver.org>
> 
> Thanks for finding and fixing this bug, applied, thanks!

Please consider queueing this for 2.6.30.x stable, upstream commit is
ca6982b858e1d08010c1d29d8e8255b2ac2ad70a

Bruno

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

* Re: [stable] [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4)
  2009-08-25 20:20     ` Bruno Prémont
@ 2009-09-03 22:25       ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2009-09-03 22:25 UTC (permalink / raw)
  To: Bruno Prémont; +Cc: stable, vladislav.yasevich, netdev, David Miller

On Tue, Aug 25, 2009 at 10:20:42PM +0200, Bruno Prémont wrote:
> On Sun, 23 August 2009 David Miller <davem@davemloft.net> wrote:
> > From: Bruno Prémont <bonbons@linux-vserver.org>
> > Date: Sat, 22 Aug 2009 01:45:23 +0200
> > 
> > > Commit 63d9950b08184e6531adceb65f64b429909cc101
> > >   (ipv6: Make v4-mapped bindings consistent with IPv4)
> > > changes behavior of inet6_bind() for v4-mapped addresses so it
> > > should behave the same way as inet_bind().
> > > 
> > > During this change setting of err to -EADDRNOTAVAIL got lost:
> >  ...
> > > Signed-off-by Bruno Prémont <bonbons@linux-vserver.org>
> > 
> > Thanks for finding and fixing this bug, applied, thanks!
> 
> Please consider queueing this for 2.6.30.x stable, upstream commit is
> ca6982b858e1d08010c1d29d8e8255b2ac2ad70a

Now queued up.

thanks,

greg k-h

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

end of thread, other threads:[~2009-09-03 22:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20090822011541.7b95dbcc@neptune.home>
2009-08-21 23:45 ` [Patch] Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4) Bruno Prémont
2009-08-24  2:07   ` David Miller
2009-08-25 20:20     ` Bruno Prémont
2009-09-03 22:25       ` [stable] " Greg KH

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).