Skip to contentSkip to conversation

Fix commit 63d9950b08184e6531adceb65f64b429909cc101 (ipv6: Make v4-mapped bindings consistent with IPv4)

PATCH Bruno Prémont 3 participants 4 messages Aug 21, 2009 – Sep 3, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

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 <[email protected]>
---

net/ipv6/af_inet6.c +3 -1
index caa0278..45f9a2a 100644
@@ -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;
maintainer
#2 lore raw

From: Bruno Prémont <[email protected]>
Date: Sat, 22 Aug 2009 01:45:23 +0200

Quoted 6 lines

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:

...

Quoted 1 line

Signed-off-by Bruno Prémont <[email protected]>

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

#3 lore raw
Quoted 8 lines · On Sun, 23 August 2009 David Miller <[email protected]> wrote:

From: Bruno Prémont <[email protected]>
Date: Sat, 22 Aug 2009 01:45:23 +0200

Quoted 5 lines

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

Quoted 5 lines
Quoted 1 line

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

...

Quoted 1 line

Signed-off-by Bruno Prémont <[email protected]>

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

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

Bruno

#4 lore raw
Quoted 9 lines · Bruno Prémont
Quoted 8 lines · On Sun, 23 August 2009 David Miller <[email protected]> wrote:

From: Bruno Prémont <[email protected]>
Date: Sat, 22 Aug 2009 01:45:23 +0200

Quoted 5 lines

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

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

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

...

Quoted 1 line

Signed-off-by Bruno Prémont <[email protected]>

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