Subject: bin/3660: Some columns are misaligned in netstat output
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 05/22/1997 00:44:43
>Number: 3660
>Category: bin
>Synopsis: Some columns are misaligned in netstat output
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 21 22:50:07 1997
>Last-Modified:
>Originator: Dave Huang
>Organization:
Name: Dave Huang | Mammal, mammal / their names are called /
INet: khym@bga.com | they raise a paw / the bat, the cat /
FurryMUCK: Dahan | dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 21 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Release: NetBSD-current as of May 21, 1997
>Environment:
System: NetBSD dahan.metonymy.com 1.2E NetBSD 1.2E (SPIFF) #47: Sun May 18 13:11:49 CDT 1997 khym@dahan.metonymy.com:/usr/src.local/sys/arch/i386/compile/SPIFF i386
>Description:
If an interface has any AppleTalk addresses, those columns aren't aligned
with the column headings in the netstat -i output:
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
ed0 1500 <Link> 00:00:24:22:dc:f9 75584 3 116492 0 50
ed0 1500 10.1.1.64/28 sloth 75584 3 116492 0 50
ed0 1500 atalk:1 1.1 75584 3 116492 0 50
ed1 1500 <Link> 02:60:8c:6b:15:7a 16930 0 59411 0 0
ed1 1500 10 sloth-3com 16930 0 59411 0 0
ed1 1500 atalk:2 2.1 16930 0 59411 0 0
lo0 32768 <Link> 5143 0 5143 0 0
lo0 32768 127 localhost 5143 0 5143 0 0
lo0 32768 atalk:0 0.0 5143 0 5143 0 0
:
:
netstat -A for inet and atalk connections also have misaligned columns:
Active Internet connections
PCB Proto Recv-Q Send-Q Local Address Foreign Address (state)
0xf8699300 tcp 0 0 sloth.telnet dahan.1036 ESTABLISHED
Active ATALK connections
PCB Proto Recv-Q Send-Q Local Address Foreign Address (state)
0xe5ac ddp 0 0 2.1.1 *.*.*
0xe5ac ddp 0 0 2.1.2 *.*.*
0xe5ac ddp 0 0 2.1.4 *.*.*
0xe5ac ddp 0 0 2.1.6 *.*.*
0xe5ac ddp 0 0 1.1.1 *.*.*
0xe5ac ddp 0 0 1.1.2 *.*.*
0xe5ac ddp 0 0 1.1.4 *.*.*
0xe5ac ddp 0 0 1.1.6 *.*.*
0xe5ac ddp 0 0 *.*.1 *.*.*
0xe5ac ddp 0 0 *.*.2 *.*.*
0xe5ac ddp 0 0 *.*.4 *.*.*
0xe5ac ddp 0 0 *.*.6 *.*.*
Active UNIX domain sockets
Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr
f86aa100 dgram 0 0 0 f8678d80 0 0
f867a100 dgram 0 0 f8675700 0 f86a89c0 0 /dev/log
>How-To-Repeat:
netstat -i or netstat -A on a machine with atalk and/or inet connections :)
>Fix:
Here's a patch that fixes the netstat -A by getting rid of the leading "0x",
to match the unix domain stuff... And I changed netstat -i listing for
AppleTalk addresses to match the ethernet and inet addresses.
diff -ur /usr/src/usr.bin/netstat/atalk.c ./atalk.c
--- /usr/src/usr.bin/netstat/atalk.c Thu Apr 3 06:28:44 1997
+++ ./atalk.c Thu May 22 00:27:53 1997
@@ -274,7 +274,7 @@
first = 0;
}
if (Aflag)
- printf("0x%lx ", ppcb);
+ printf("%8lx ", ppcb);
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
printf(Aflag ? " %-18.18s" : " %-22.22s", atalk_print(
diff -ur /usr/src/usr.bin/netstat/if.c ./if.c
--- /usr/src/usr.bin/netstat/if.c Mon Apr 7 06:23:35 1997
+++ ./if.c Thu May 22 00:03:58 1997
@@ -190,9 +190,9 @@
}
break;
case AF_APPLETALK:
- printf("atalk:%-12.12s ",
+ printf("atalk:%-7.7s ",
atalk_print(sa,0x10));
- printf("%-9.9s ", atalk_print(sa,0x0b));
+ printf("%-17.17s ", atalk_print(sa,0x0b));
break;
case AF_NS:
{
diff -ur /usr/src/usr.bin/netstat/inet.c ./inet.c
--- /usr/src/usr.bin/netstat/inet.c Thu Apr 3 06:28:44 1997
+++ ./inet.c Thu May 22 00:19:11 1997
@@ -140,9 +140,9 @@
}
if (Aflag)
if (istcp)
- printf("%8lp ", (u_long) inpcb.inp_ppcb);
+ printf("%8lx ", (u_long) inpcb.inp_ppcb);
else
- printf("%8lp ", (u_long) prev);
+ printf("%8lx ", (u_long) prev);
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, name);
>Audit-Trail:
>Unformatted: