Subject: bin/3659: netstat -A gives bogus PCB for AppleTalk connections
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 05/22/1997 00:35:56
>Number:         3659
>Category:       bin
>Synopsis:       netstat -A gives bogus PCB for AppleTalk connections
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 21 22:50:03 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:
netstat -A prints the same (incorrect) PCB address for all AppleTalk
connections:

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              *.*.*             

>How-To-Repeat:
Do a netstat -Afatalk on a machine with active appletalk connections

>Fix:
Looks like the atalkprotopr() routine prints the value of the "ppcb"
variable without ever setting it to anything. Here's a patch that sets it
to something; whether it's the right something or not, I don't know, but
it looks cool at least :)

--- /usr/src/usr.bin/netstat/atalk.c	Thu Apr  3 06:28:44 1997
+++ atalk.c	Thu May 22 00:27:53 1997
@@ -246,7 +246,7 @@
 	ddpcb = cb;
 	prev = (struct ddpcb *) off;
 	for (next = initial; next != NULL; prev = next) {
-		u_long          ppcb;
+		u_long          ppcb = (u_long) next;
 
 		if (kread((u_long) next, (char *) &ddpcb, sizeof(ddpcb)) < 0)
 			return;
>Audit-Trail:
>Unformatted: