Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2003 04:44:00 -0500
From:      Mike Makonnen <mtm@identd.net>
To:        freebsd-audit@freebsd.org
Cc:        Mark Murray <markm@freebsd.org>
Subject:   Minor fixes to netstat
Message-ID:  <20030108094400.GA7614@quark>

next in thread | raw e-mail | index | archive | help

--ZoaI/ZTpAVc4A5k6
Content-Type: multipart/mixed; boundary="jI8keyz6grp/JLjh"
Content-Disposition: inline


--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi folks,

Does anyone have any objections to the following patch to netstat?
It basically, fixes some typos/grammar nits and adds another
mini-function to correctly handle singular/plurals of words ending
in 'ly'.

netstat.diff	- the patch
out.diff	- the result of the patch

Cheers.
--=20
Mike Makonnen  | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm@identd.net | Fingerprint: D228 1A6F C64E 120A A1C9  A3AA DAE1 E2AF DBCC=
 68B9

--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netstat.diff"
Content-Transfer-Encoding: quoted-printable

Index: usr.bin/netstat/inet.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/netstat/inet.c,v
retrieving revision 1.55
diff -u -r1.55 inet.c
--- usr.bin/netstat/inet.c	5 Sep 2002 17:06:51 -0000	1.55
+++ usr.bin/netstat/inet.c	25 Dec 2002 02:40:50 -0000
@@ -630,7 +630,7 @@
=20
 	p(icps_error, "\t%lu call%s to icmp_error\n");
 	p(icps_oldicmp,
-	    "\t%lu error%s not generated 'cuz old message was icmp\n");
+	    "\t%lu error%s not generated in response to an icmp message\n");
 	for (first =3D 1, i =3D 0; i < ICMP_MAXTYPE + 1; i++)
 		if (icmpstat.icps_outhist[i] !=3D 0) {
 			if (first) {
Index: usr.bin/netstat/inet6.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/netstat/inet6.c,v
retrieving revision 1.20
diff -u -r1.20 inet6.c
--- usr.bin/netstat/inet6.c	5 Sep 2002 17:06:51 -0000	1.20
+++ usr.bin/netstat/inet6.c	25 Dec 2002 03:02:34 -0000
@@ -416,7 +416,7 @@
 	    "\t%llu packet%s whose headers are not continuous\n");
 	p(ip6s_nogif, "\t%llu tunneling packet%s that can't find gif\n");
 	p(ip6s_toomanyhdr,
-	    "\t%llu packet%s discarded due to too may headers\n");
+	    "\t%llu packet%s discarded because of too many headers\n");
=20
 	/* for debugging source address selection */
 #define PRINT_SCOPESTAT(s,i) do {\
@@ -538,7 +538,7 @@
 	p(ifs6_out_fragcreat, "\t%llu output datagram%s succeeded on fragment\n");
 	p(ifs6_reass_reqd, "\t%llu incoming datagram%s fragmented\n");
 	p(ifs6_reass_ok, "\t%llu datagram%s reassembled\n");
-	p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembling\n");
+	p(ifs6_reass_fail, "\t%llu datagram%s failed on reassembly\n");
 	p(ifs6_in_mcast, "\t%llu multicast datagram%s received\n");
 	p(ifs6_out_mcast, "\t%llu multicast datagram%s sent\n");
=20
@@ -834,11 +834,11 @@
     printf(m, (unsigned long long)icmp6stat.f, plural(icmp6stat.f))
 #define p_5(f, m) printf(m, (unsigned long long)icmp6stat.f)
=20
-	p(icp6s_error, "\t%llu call%s to icmp_error\n");
+	p(icp6s_error, "\t%llu call%s to icmp6_error\n");
 	p(icp6s_canterror,
-	    "\t%llu error%s not generated because old message was icmp error or s=
o\n");
+	    "\t%llu error%s not generated in response to an icmp6 message\n");
 	p(icp6s_toofreq,
-	  "\t%llu error%s not generated because rate limitation\n");
+	  "\t%llu error%s not generated because of rate limitation\n");
 #define NELEM (int)(sizeof(icmp6stat.icp6s_outhist)/sizeof(icmp6stat.icp6s=
_outhist[0]))
 	for (first =3D 1, i =3D 0; i < NELEM; i++)
 		if (icmp6stat.icp6s_outhist[i] !=3D 0) {
@@ -903,6 +903,8 @@
 	int s;
 #define	p(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <=3D 1) \
     printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, plural(if=
r.ifr_ifru.ifru_icmp6stat.f))
+#define	p2(f, m) if (ifr.ifr_ifru.ifru_icmp6stat.f || sflag <=3D 1) \
+    printf(m, (unsigned long long)ifr.ifr_ifru.ifru_icmp6stat.f, pluralies=
(ifr.ifr_ifru.ifru_icmp6stat.f))
=20
 	if ((s =3D socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
 		perror("Warning: socket(AF_INET6)");
@@ -925,13 +927,13 @@
 	p(ifs6_in_paramprob, "\t%llu input parameter problem error%s\n");
 	p(ifs6_in_pkttoobig, "\t%llu input packet too big error%s\n");
 	p(ifs6_in_echo, "\t%llu input echo request%s\n");
-	p(ifs6_in_echoreply, "\t%llu input echo reply%s\n");
+	p2(ifs6_in_echoreply, "\t%llu input echo repl%s\n");
 	p(ifs6_in_routersolicit, "\t%llu input router solicitation%s\n");
 	p(ifs6_in_routeradvert, "\t%llu input router advertisement%s\n");
 	p(ifs6_in_neighborsolicit, "\t%llu input neighbor solicitation%s\n");
 	p(ifs6_in_neighboradvert, "\t%llu input neighbor advertisement%s\n");
 	p(ifs6_in_redirect, "\t%llu input redirect%s\n");
-	p(ifs6_in_mldquery, "\t%llu input MLD query%s\n");
+	p2(ifs6_in_mldquery, "\t%llu input MLD quer%s\n");
 	p(ifs6_in_mldreport, "\t%llu input MLD report%s\n");
 	p(ifs6_in_mlddone, "\t%llu input MLD done%s\n");
=20
@@ -943,13 +945,13 @@
 	p(ifs6_out_paramprob, "\t%llu output parameter problem error%s\n");
 	p(ifs6_out_pkttoobig, "\t%llu output packet too big error%s\n");
 	p(ifs6_out_echo, "\t%llu output echo request%s\n");
-	p(ifs6_out_echoreply, "\t%llu output echo reply%s\n");
+	p2(ifs6_out_echoreply, "\t%llu output echo repl%s\n");
 	p(ifs6_out_routersolicit, "\t%llu output router solicitation%s\n");
 	p(ifs6_out_routeradvert, "\t%llu output router advertisement%s\n");
 	p(ifs6_out_neighborsolicit, "\t%llu output neighbor solicitation%s\n");
 	p(ifs6_out_neighboradvert, "\t%llu output neighbor advertisement%s\n");
 	p(ifs6_out_redirect, "\t%llu output redirect%s\n");
-	p(ifs6_out_mldquery, "\t%llu output MLD query%s\n");
+	p2(ifs6_out_mldquery, "\t%llu output MLD quer%s\n");
 	p(ifs6_out_mldreport, "\t%llu output MLD report%s\n");
 	p(ifs6_out_mlddone, "\t%llu output MLD done%s\n");
=20
Index: usr.bin/netstat/main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v
retrieving revision 1.58
diff -u -r1.58 main.c
--- usr.bin/netstat/main.c	5 Sep 2002 17:06:51 -0000	1.58
+++ usr.bin/netstat/main.c	25 Dec 2002 02:56:14 -0000
@@ -703,6 +703,12 @@
 	return (n !=3D 1 ? "es" : "");
 }
=20
+const char *
+pluralies(int n)
+{
+	return (n !=3D 1 ? "ies" : "y");
+}
+
 /*
  * Find the protox for the given "well-known" name.
  */

--jI8keyz6grp/JLjh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="out.diff"
Content-Transfer-Encoding: quoted-printable

'netstat -s' output:=20
 icmp:
 	0 calls to icmp_error
-	0 errors not generated 'cuz old message was icmp
+	0 errors not generated in response to an icmp message
=2E..
-	0 packets discarded due to too may headers
+	0 packets discarded because of too many headers
=2E..
-	0 calls to icmp_error
-	0 errors not generated because old message was icmp error or so
-	0 errors not generated because rate limitation
+	0 calls to icmp6_error
+	0 errors not generated in response to an icmp6 message
+	0 errors not generated because of rate limitation

'netstat -I dc0 -s' output:
=20
-	0 datagrams failed on reassembling
+	0 datagrams failed on reassembly
=2E..
-	0 input echo replys
+	0 input echo replies
=2E..
-	0 input MLD querys
+	0 input MLD queries
=2E..
-	0 output echo replys
+	0 output echo replies
=2E..
-	0 output MLD querys
+	0 output MLD queries
 	2 output MLD reports
 	0 output MLD dones

--jI8keyz6grp/JLjh--

--ZoaI/ZTpAVc4A5k6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+G/Lf2uHir9vMaLkRAl7FAKDpFAQI34/dwmzHJskt5v6m57kOsACfY9Eh
737Z/BaLz3hzxiXyT2Z7YAA=
=z3P8
-----END PGP SIGNATURE-----

--ZoaI/ZTpAVc4A5k6--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030108094400.GA7614>