Subject: bin/33677: netstat broken w/o INET6 support
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <scotte@warped.com>
List: netbsd-bugs
Date: 06/09/2006 15:15:00
>Number:         33677
>Category:       bin
>Synopsis:       Building with MKINET6=no causes netstat to fail compiling
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 09 15:15:00 +0000 2006
>Originator:     Scott Ellis
>Release:        NetBSD 3.99.21
>Organization:
	
>Environment:
	
	
System: NetBSD intrepid 3.99.21 NetBSD 3.99.21 (INTREPID.AMD64) #1: Thu Jun 8 18:30:31 PDT 2006 scotte@intrepid:/misc/netbsd_src/src/obj.amd64/misc/netbsd_src/src/sys/arch/amd64/compile/INTREPID.AMD64 amd64
Architecture: x86_64
Machine: amd64
>Description:
	
Having MKINET6=no in /etc/mk.conf and attempting to build netstat (using 
build.sh) causes a failure because netstat/show.c references netname6 which 
cannot exist.  Protecting all netname6 references with #ifdef INET6 allows 
the build to proceed
>How-To-Repeat:
	
Put MKINET6=no in /etc/mk.conf , and execure a 'release' build using build.sh
>Fix:
	
The following changes solve the problem for me.

--- /usr/src/usr.bin/netstat/show.c	2006-06-09 08:06:45.000000000 -0700
+++ /tmp/show_new.c	2006-06-08 16:35:39.000000000 -0700
@@ -518,6 +518,7 @@
 	return (line);
 }
 
+#ifdef INET6
 char *
 netname6(struct sockaddr_in6 *sa6, struct sockaddr_in6 *mask)
 {
@@ -609,6 +610,7 @@
 	snprintf(line, sizeof(line), "%s/%d", hbuf, masklen);
 	return (line);
 }
+#endif
 
 /*
  * Return the name of the network whose address is given.
@@ -622,9 +624,11 @@
 	case AF_INET:
 		return netname4(((struct sockaddr_in *)sa)->sin_addr.s_addr,
 		    ((struct sockaddr_in *)mask)->sin_addr.s_addr);
+#ifdef INET6
 	case AF_INET6:
 		return netname6((struct sockaddr_in6 *)sa,
 		    (struct sockaddr_in6 *)mask);
+#endif
 	case AF_LINK:
 		return (link_print(sa));
 	default:

>Unformatted: