Subject: misc/886: netstat -i doesn't line up columns correctly (better fix included)
To: None <gnats-admin@NetBSD.ORG>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: netbsd-bugs
Date: 03/20/1995 15:20:05
>Number: 886
>Category: misc
>Synopsis: netstat -i doesn't line up columns correctly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: misc-bug-people (Misc Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Mar 20 15:20:03 1995
>Originator: Kenneth Stailey
>Organization:
what's that?
>Release: March 18th tarballs
>Environment:
System: NetBSD pluto 1.0A NetBSD 1.0A (PLUTO) #19: Sat Mar 18 16:46:13 EST 1995 ken@pluto:/usr/src/sys/arch/i386/compile/PLUTO i386
>Description:
When I type "netstat -i" I get this:
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
ep0 1500 <Link> 0.20.af.9c.dc.ec 144 0 289 0 0
ep0 1500 spacenet.co pluto.spacenet. 144 0 289 0 0
lo0 32768 <Link> 162 0 162 0 0
lo0 32768 127 localhost 162 0 162 0 0
sl0* 296 <Link> 0 0 0 0 0
The problem is that ethernet addresses need 17 character
positions, not 15.
>How-To-Repeat:
"netstat -i" on my system (my ether address needs 16 character
positions)
>Fix:
Apply the following (new and improved) patch
--- if.c.DIST Thu Mar 9 15:53:51 1995
+++ if.c.new Mon Mar 20 17:49:20 1995
@@ -92,7 +92,7 @@
}
if (kread(ifnetaddr, (char *)&ifnetaddr, sizeof ifnetaddr))
return;
- printf("%-5.5s %-5.5s %-11.11s %-15.15s %8.8s %5.5s %8.8s %5.5s",
+ printf("%-5.5s %-5.5s %-11.11s %-17.17s %8.8s %5.5s %8.8s %5.5s",
"Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs",
"Opkts", "Oerrs");
printf(" %5s", "Coll");
@@ -155,7 +155,7 @@
netname(htonl(ifaddr.in.ia_subnet),
ifaddr.in.ia_subnetmask));
#endif
- printf("%-15.15s ",
+ printf("%-17.17s ",
routename(sin->sin_addr.s_addr));
break;
case AF_NS:
@@ -192,7 +192,11 @@
while (--n >= 0)
m += printf("%x%c", *cp++ & 0xff,
n > 0 ? '.' : ' ');
+#if 0
m = 28 - m;
+#else
+ m = 30 - m;
+#endif
while (m-- > 0)
putchar(' ');
break;
--SAA01984.795740751/pluto.spacenet.com--
>Audit-Trail:
>Unformatted: