linux/net/ipv6
Bruno Prémont ca6982b858 ipv6: Fix commit 63d9950b08 (ipv6: Make v4-mapped bindings consistent with IPv4)
Commit 63d9950b08
  (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>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-08-23 19:06:28 -07:00
..
netfilter Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-06-11 16:00:49 +02:00
addrconf_core.c
addrconf.c IPv6: preferred lifetime of address not getting updated 2009-07-03 19:10:13 -07:00
addrlabel.c net: replace %p6 with %pI6 2008-10-29 12:52:50 -07:00
af_inet6.c ipv6: Fix commit 63d9950b08 (ipv6: Make v4-mapped bindings consistent with IPv4) 2009-08-23 19:06:28 -07:00
ah6.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
anycast.c net: replace %#p6 format specifier with %pi6 2008-10-29 12:50:24 -07:00
datagram.c netns xfrm: lookup in netns 2008-11-25 17:35:18 -08:00
esp6.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
exthdrs_core.c
exthdrs.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
fib6_rules.c net: Remove unused parameter from fill method in fib_rules_ops. 2009-05-20 17:26:23 -07:00
icmp.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
inet6_connection_sock.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
inet6_hashtables.c ipv6: don't use tw net when accounting for recycled tw 2009-02-26 03:35:13 -08:00
ip6_fib.c ipv6: Fix fib6_dump_table walker leak 2009-01-13 22:17:51 -08:00
ip6_flowlabel.c ipv6: Disallow rediculious flowlabel option sizes. 2009-02-06 00:49:55 -08:00
ip6_input.c inet: Call skb_orphan before tproxy activates 2009-06-26 19:22:37 -07:00
ip6_output.c net: ip_push_pending_frames() fix 2009-07-11 20:26:21 -07:00
ip6_tunnel.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
ip6mr.c PIM-SM: namespace changes 2009-06-14 03:16:13 -07:00
ipcomp6.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
ipv6_sockglue.c ipv6:remove useless check 2009-04-14 02:21:41 -07:00
Kconfig trivial: Kconfig: .ko is normally not included in module names 2009-06-12 18:01:50 +02:00
Makefile [IPV6] MROUTE: Support multicast forwarding. 2008-04-05 22:33:38 +09:00
mcast.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
mip6.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
ndisc.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
netfilter.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
proc.c snmp: add missing counters for RFC 4293 2009-04-27 02:45:02 -07:00
protocol.c net: remove CVS keywords 2008-06-11 21:00:38 -07:00
raw.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
reassembly.c ipv6: Use frag list abstraction interfaces. 2009-06-09 00:20:05 -07:00
route.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
sit.c sit: fix regression: do not release skb->dst before xmit 2009-07-11 20:30:52 -07:00
syncookies.c syncookies: remove last_synq_overflow from struct tcp_sock 2009-04-20 02:25:26 -07:00
sysctl_net_ipv6.c remove lots of double-semicolons 2009-01-08 08:31:14 -08:00
tcp_ipv6.c tcp: Use correct peer adr when copying MD5 keys 2009-07-20 07:49:08 -07:00
tunnel6.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
udp_impl.h ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
udp.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
udplite.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
xfrm6_input.c netns xfrm: per-netns MIBs 2008-11-25 17:59:52 -08:00
xfrm6_mode_beet.c ipsec: Interfamily IPSec BEET, ipv4-inner ipv6-outer 2008-08-06 02:40:25 -07:00
xfrm6_mode_ro.c
xfrm6_mode_transport.c
xfrm6_mode_tunnel.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
xfrm6_output.c net: skb->dst accessors 2009-06-03 02:51:04 -07:00
xfrm6_policy.c xfrm6: fix the proto and ports decode of sctp protocol 2009-07-03 19:10:10 -07:00
xfrm6_state.c ipv6: fix sparse warning: Using plain integer as NULL pointer 2009-02-21 23:37:10 -08:00
xfrm6_tunnel.c ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00