Subject: more fallout from {netns,netccitt} removal
To: None <current-users@netbsd.org>
From: Kurt Schreiner <ks@ub.uni-mainz.de>
List: current-users
Date: 08/26/2006 12:12:14
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

netstat(8) has similar problems to compile. A patch to make netstat
compilable (and runnable ;-) after /usr/include/{netns,netccitt} are no more
is attached.

Kurt

--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netstat.diff"

diff -uN ../old/Makefile ../new/Makefile
--- ../old/Makefile	2006-05-28 19:24:03.000000000 +0200
+++ ../new/Makefile	2006-08-26 11:58:04.000000000 +0200
@@ -5,7 +5,7 @@
 
 PROG=	netstat
 SRCS=	atalk.c bpf.c fast_ipsec.c if.c inet.c inet6.c ipsec.c iso.c \
-	main.c mbuf.c mroute.c mroute6.c ns.c show.c route.c tp_astring.c \
+	main.c mbuf.c mroute.c mroute6.c show.c route.c tp_astring.c \
 	unix.c
 .PATH:	${NETBSDSRCDIR}/sys/netiso
 BINGRP=	kmem
diff -uN ../old/if.c ../new/if.c
--- ../old/if.c	2006-05-28 19:24:04.000000000 +0200
+++ ../new/if.c	2006-08-26 12:01:03.000000000 +0200
@@ -48,8 +48,6 @@
 #include <net/if_types.h>
 #include <netinet/in.h>
 #include <netinet/in_var.h>
-#include <netns/ns.h>
-#include <netns/ns_if.h>
 #include <netiso/iso.h>
 #include <netiso/iso_var.h>
 #include <arpa/inet.h>
@@ -88,7 +86,6 @@
 #ifdef INET6
 		struct in6_ifaddr in6;
 #endif /* INET6 */
-		struct ns_ifaddr ns;
 		struct iso_ifaddr iso;
 	} ifaddr;
 	u_long ifaddraddr;
@@ -317,22 +314,6 @@
 				       atalk_print(sa,0x10));
 				printf("%-17.17s ", atalk_print(sa,0x0b));
 				break;
-			case AF_NS:
-				{
-				struct sockaddr_ns *sns =
-					(struct sockaddr_ns *)sa;
-				u_long net;
-				char netnum[10];
-
-				*(union ns_net *)&net = sns->sns_addr.x_net;
-				(void)snprintf(netnum, sizeof(netnum), "%xH",
-				    (u_int32_t)ntohl(net));
-				upHex(netnum);
-				printf("ns:%-10s ", netnum);
-				printf("%-17.17s ",
-				    ns_phost((struct sockaddr *)sns));
-				}
-				break;
 #endif
 			case AF_LINK:
 				printf("%-13.13s ", "<Link>");
diff -uN ../old/main.c ../new/main.c
--- ../old/main.c	2006-08-23 21:47:27.000000000 +0200
+++ ../new/main.c	2006-08-26 12:03:51.000000000 +0200
@@ -297,17 +297,6 @@
 	  0,		NULL,		0 }
 };
 
-struct protox nsprotox[] = {
-	{ N_IDP,	N_IDPSTAT,	1,	nsprotopr,
-	  idp_stats,	NULL,		0,	"idp" },
-	{ N_IDP,	N_SPPSTAT,	1,	nsprotopr,
-	  spp_stats,	NULL,		0,	"spp" },
-	{ -1,		N_NSERR,	1,	0,
-	  nserr_stats,	NULL,		0,	"ns_err" },
-	{ -1,		-1,		0,	0,
-	  0,		NULL,		0 }
-};
-
 struct protox isoprotox[] = {
 	{ ISO_TP,	N_TPSTAT,	1,	iso_protopr,
 	  tp_stats,	NULL,		0,	"tp" },
@@ -331,7 +320,7 @@
 				 pfkeyprotox,
 #endif
 #ifndef SMALL
-				 atalkprotox, nsprotox, isoprotox,
+				 atalkprotox, isoprotox,
 #endif
 				 NULL };
 
@@ -672,9 +661,6 @@
 	if (af == AF_APPLETALK || af == AF_UNSPEC)
 		for (tp = atalkprotox; tp->pr_name; tp++)
 			printproto(tp, tp->pr_name);
-	if (af == AF_NS || af == AF_UNSPEC)
-		for (tp = nsprotox; tp->pr_name; tp++)
-			printproto(tp, tp->pr_name);
 	if (af == AF_ISO || af == AF_UNSPEC)
 		for (tp = isoprotox; tp->pr_name; tp++)
 			printproto(tp, tp->pr_name);
diff -uN ../old/route.c ../new/route.c
--- ../old/route.c	2006-05-28 19:24:04.000000000 +0200
+++ ../new/route.c	2006-08-26 12:02:16.000000000 +0200
@@ -54,8 +54,6 @@
 #include <netatalk/at.h>
 #include <netiso/iso.h>
 
-#include <netns/ns.h>
-
 #include <sys/sysctl.h>
 
 #include <arpa/inet.h>
@@ -88,7 +86,6 @@
 	struct	sockaddr_iso u_iso;
 	struct	sockaddr_at u_at;
 	struct	sockaddr_dl u_dl;
-	struct	sockaddr_ns u_ns;
 	u_short	u_data[128];
 	int u_dummy;		/* force word-alignment */
 } pt_u;
@@ -350,96 +347,3 @@
 		plural(rtstat.rts_wildcard));
 }
 
-short ns_nullh[] = {0,0,0};
-short ns_bh[] = {-1,-1,-1};
-
-char *
-ns_print(sa)
-	struct sockaddr *sa;
-{
-	struct sockaddr_ns *sns = (struct sockaddr_ns*)sa;
-	struct ns_addr work;
-	union {
-		union	ns_net net_e;
-		u_long	long_e;
-	} net;
-	u_short port;
-	static char mybuf[50], cport[10], chost[25];
-	char *host = "";
-	char *p;
-	u_char *q;
-
-	work = sns->sns_addr;
-	port = ntohs(work.x_port);
-	work.x_port = 0;
-	net.net_e  = work.x_net;
-	if (ns_nullhost(work) && net.long_e == 0) {
-		if (port ) {
-			(void)snprintf(mybuf, sizeof mybuf, "*.%xH", port);
-			upHex(mybuf);
-		} else
-			(void)snprintf(mybuf, sizeof mybuf, "*.*");
-		return (mybuf);
-	}
-
-	if (memcmp(ns_bh, work.x_host.c_host, 6) == 0) {
-		host = "any";
-	} else if (memcmp(ns_nullh, work.x_host.c_host, 6) == 0) {
-		host = "*";
-	} else {
-		q = work.x_host.c_host;
-		(void)snprintf(chost, sizeof chost, "%02x%02x%02x%02x%02x%02xH",
-			q[0], q[1], q[2], q[3], q[4], q[5]);
-		for (p = chost; *p == '0' && p < chost + 12; p++)
-			continue;
-		host = p;
-	}
-	if (port)
-		(void)snprintf(cport, sizeof cport, ".%xH", htons(port));
-	else
-		*cport = 0;
-
-	(void)snprintf(mybuf, sizeof mybuf, "%xH.%s%s", (int)ntohl(net.long_e),
-	    host, cport);
-	upHex(mybuf);
-	return (mybuf);
-}
-
-char *
-ns_phost(sa)
-	struct sockaddr *sa;
-{
-	struct sockaddr_ns *sns = (struct sockaddr_ns *)sa;
-	struct sockaddr_ns work;
-	static union ns_net ns_zeronet;
-	char *p;
-
-	work = *sns;
-	work.sns_addr.x_port = 0;
-	work.sns_addr.x_net = ns_zeronet;
-
-	p = ns_print((struct sockaddr *)&work);
-	if (strncmp("0H.", p, 3) == 0)
-		p += 3;
-	return (p);
-}
-
-void
-upHex(p0)
-	char *p0;
-{
-	char *p = p0;
-
-	for (; *p; p++)
-		switch (*p) {
-		case 'a':
-		case 'b':
-		case 'c':
-		case 'd':
-		case 'e':
-		case 'f':
-			*p += ('A' - 'a');
-		}
-}
-
-

--HcAYCG3uE/tztfnV--