Module Name:    src
Committed By:   joerg
Date:           Fri Aug 20 15:01:11 UTC 2010

Modified Files:
        src/sys/netinet6: in6_pcb.c

Log Message:
Consider a mapped IPv4 address of 0.0.0.0 as unspecified. This allows
using mapped IPv4 address with connect without preceding bind.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/netinet6/in6_pcb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.110 src/sys/netinet6/in6_pcb.c:1.111
--- src/sys/netinet6/in6_pcb.c:1.110	Tue May 26 00:17:56 2009
+++ src/sys/netinet6/in6_pcb.c	Fri Aug 20 15:01:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_pcb.c,v 1.110 2009/05/26 00:17:56 pooka Exp $	*/
+/*	$NetBSD: in6_pcb.c,v 1.111 2010/08/20 15:01:11 joerg Exp $	*/
 /*	$KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.110 2009/05/26 00:17:56 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.111 2010/08/20 15:01:11 joerg Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -367,7 +367,9 @@
 	 * If we already have a local port or a local address it means we're
 	 * bounded.
 	 */
-	if (in6p->in6p_lport || !IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr))
+	if (in6p->in6p_lport || !(IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_laddr) ||
+	    (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr) &&
+	      in6p->in6p_laddr.s6_addr32[3] == 0))) {
 		return (EINVAL);
 
 	if (nam != NULL) {

Reply via email to