Subject: kern/20559: netinet6/in6_pcb.c missing #include "opt_inet.h"
To: None <gnats-bugs@gnats.netbsd.org>
From: icmp <icmp@gateway.icmps.org>
List: netbsd-bugs
Date: 03/03/2003 08:58:28
>Number:         20559
>Category:       kern
>Synopsis:       netinet6/in6_pcb.c missing #include "opt_inet.h" 
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 03 05:59:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     icmp
>Release:        NetBSD 1.6_STABLE
>Organization:
icmps.org
>Environment:
System: NetBSD gateway.icmps.org 1.6_STABLE NetBSD 1.6_STABLE (GATEWAY) #1: Wed Jan 22 15:28:11 EST 2003 root@gateway.icmps.org:/usr/src/sys/arch/i386/compile/GATEWAY i386
Architecture: i386
Machine: i386
>Description:
	When binding a IPv4-mapped IPv6 IP bind() fails and sets errno to EADDRNOTAVAIL when the IPv4 IP is clearly available (::ffff:127.0.0.1, see http://65.243.82.153/test.c). Searching through the archives:
	http://mail-index.netbsd.org/current-users/2002/11/05/0006.html  
is related and I find that the problem is fixed in recent -current; however, my machine and others exhibit the same behavior as w/o #define INET as opt_inet.h provides, an entire block of code in in6_pcb.c is omitted and it forces a faulty EADDRNOTAVAIL to be returned.
>How-To-Repeat:
	cc test.c -o test  (see above)
	./test
	watch bind fail to bind ::ffff:127.0.0.1 w/ v6only=0
>Fix:

--- /root/in6_pcb.c     Mon Mar  3 08:54:23 2003
+++ in6_pcb.c   Mon Mar  3 08:54:35 2003
@@ -68,6 +68,7 @@
#include <sys/cdefs.h>
  __KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.46.6.2 2002/11/21 17:53:47 he Exp $");

+#include "opt_inet.h"
#include "opt_ipsec.h"

#include <sys/param.h>

(untested but I think it would fix it, anyone care to check? :)
>Release-Note:
>Audit-Trail:
>Unformatted:
 	missing #include "opt_inet.h" makes bind() erroneously return EADDRNOTAVAIL for IPv4-mapped IPv6 addresses