Subject: pkg/18007: net/wget assumes IPv6 defines and functions are available
To: None <gnats-bugs@gnats.netbsd.org>
From: None <grant@netbsd.org>
List: netbsd-bugs
Date: 08/22/2002 01:58:52
>Number:         18007
>Category:       pkg
>Synopsis:       net/wget assumes IPv6 defines and functions are available
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 20 22:59:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     grant beattie
>Release:        -current pkgsrc
>Organization:
>Environment:
System: SunOS sphinx 5.7 Generic_106541-21 sun4u sparc SUNW,Ultra-60
Architecture: sparc
Machine: sun4u
>Description:
net/wget applies the KAME IPv6 patch without checking whether the host
is IPv6 enabled. The KAME patch uses defines and functions which are not
always present, and this causes the build to fail on Solaris 7:

gcc -I. -I.  -I/opt/net/tmp/pkgbuild/net/wget/work.SunOS-5.7-sparc/.buildlink/include    -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/usr/pkg/etc/wgetrc\" -DLOCALEDIR=\"/usr/pkg/lib/locale\" -I/opt/net/tmp/pkgbuild/net/wget/work.SunOS-5.7-sparc/.buildlink/include -O2 -c ftp-basic.c
ftp-basic.c: In function `ftp_eprt':
ftp-basic.c:408: `AF_INET6' undeclared (first use in this function)
ftp-basic.c:408: (Each undeclared identifier is reported only once
ftp-basic.c:408: for each function it appears in.)

Compiling without the KAME patch works, but patch-ad fails to apply.

>How-To-Repeat:
Attempt to build net/wget on a non-IPv6 capable host.

>Fix:
Only apply the KAME patch on IPv6 capable platforms (and fix patch-ad),
or create a new patch-af to fix what KAME messes up:

$NetBSD$

--- src/ftp-basic.c.orig	Wed Aug 21 15:30:59 2002
+++ src/ftp-basic.c	Wed Aug 21 15:46:01 2002
@@ -384,8 +384,7 @@
 #ifndef INET6
   if (((struct sockaddr *)&ss)->sa_family != AF_INET)
     return HOSTERR;
-  if (!inet_ntop(AF_INET, &((struct sockaddr_in *)&ss)->sin_addr, hbuf,
-      sizeof(hbuf)))
+  if (!inet_ntoa((struct sockaddr_in *)&ss)->sin_addr)
     return HOSTERR;
 #else
   if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
@@ -405,9 +404,11 @@
   case AF_INET:
     af = 1;
     break;
+#ifdef INET6
   case AF_INET6:
     af = 2;
     break;
+#endif
   default:
     af = 0;	/*XXX*/
     break;
@@ -461,8 +462,7 @@
 #ifndef INET6
   if (((struct sockaddr *)&ss)->sa_family != AF_INET)
     return HOSTERR;
-  if (!inet_ntop(AF_INET, &((struct sockaddr_in *)&ss)->sin_addr, hbuf,
-      hlen))
+  if (!inet_ntoa((struct sockaddr_in *)&ss)->sin_addr)
     return HOSTERR;
 #else
   if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, hlen, NULL, 0,

>Release-Note:
>Audit-Trail:
>Unformatted: