Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Nov 1995 13:57:54 +0800 (WST)
From:      Peter Wemm <peter@jhome.DIALix.COM>
To:        current@freebsd.org
Subject:   netstat has been broken for a long time..
Message-ID:  <Pine.BSF.3.91.951115134900.4722A-100000@jhome.DIALix.COM>

next in thread | raw e-mail | index | archive | help
Hi all...

I thought netstat was deliberately leaving off the unix^H^H^H^Hlocal 
domain sockets unless a switch was specified.  I couldn't find which 
option it was from the man page, so I looked at the source.

To my (not so) great suprise, I discovered netstat was accidently 
broken...   it's nlist()ing the kernel looking for "_unixsw" which was 
replaced with "_localsw" and netstat not updated.

The only problem is that I've grown used to netstat without the unix 
domain sockets at the bottom.  I'm reluctant to fix it for that reason.

....However....  Perhaps it would be an acceptable compromise to fix 
inetd so that it does not display AF_UNIX sockets unless specifically 
requested with "netstat -f unix".  Best of both worlds?  

What's the verdict?  Is the complete (long) version better? The short 
one?  is "-f unix" an acceptable compromise? (-f is an existing switch).

So, the combined patch would become:
Index: main.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v
retrieving revision 1.8
diff -u -r1.8 main.c
--- main.c	1995/10/26 20:31:55	1.8
+++ main.c	1995/11/15 05:54:20
@@ -84,7 +84,7 @@
 #define	N_RTSTAT	9
 	{ "_rtstat" },
 #define	N_UNIXSW	10
-	{ "_unixsw" },
+	{ "_localsw" },
 #define N_IDP		11
 	{ "_nspcb"},
 #define N_IDPSTAT	12
@@ -414,7 +414,7 @@
 	if (af == AF_ISO || af == AF_UNSPEC)
 		for (tp = isoprotox; tp->pr_name; tp++)
 			printproto(tp, tp->pr_name);
-	if ((af == AF_UNIX || af == AF_UNSPEC) && !sflag)
+	if (af == AF_UNIX && !sflag)
 		unixpr(nl[N_UNIXSW].n_value);
 	exit(0);
 }

Opinions?

-Peter



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951115134900.4722A-100000>