From phk@critter.freebsd.dk  Sun Mar 11 14:38:34 2001
Return-Path: <phk@critter.freebsd.dk>
Received: from phk.freebsd.dk (phk.freebsd.dk [212.242.86.136])
	by hub.freebsd.org (Postfix) with ESMTP id 193E437B71A
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sun, 11 Mar 2001 14:38:33 -0800 (PST)
	(envelope-from phk@critter.freebsd.dk)
Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163])
	by phk.freebsd.dk (8.9.3/8.9.3) with ESMTP id XAA08262
	for <FreeBSD-gnats-submit@FreeBSD.org>; Sun, 11 Mar 2001 23:38:32 +0100 (CET)
	(envelope-from phk@critter.freebsd.dk)
Received: (from phk@localhost)
	by critter.freebsd.dk (8.11.1/8.11.1) id f2BM3oQ47060;
	Sun, 11 Mar 2001 23:03:50 +0100 (CET)
	(envelope-from phk)
Message-Id: <200103112203.f2BM3oQ47060@critter.freebsd.dk>
Date: Sun, 11 Mar 2001 23:03:50 +0100 (CET)
From: Poul-Henning Kamp <phk@critter.freebsd.dk>
Reply-To: phk@critter.freebsd.dk
To: FreeBSD-gnats-submit@FreeBSD.org
Cc:
Subject: sockstat truncates field
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         25712
>Category:       bin
>Synopsis:       sockstat truncates field
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 11 14:40:01 PST 2001
>Closed-Date:    Sun May 27 06:12:29 PDT 2001
>Last-Modified:  Sun May 27 06:13:13 PDT 2001
>Originator:     Poul-Henning Kamp
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD critter.freebsd.dk 5.0-CURRENT FreeBSD 5.0-CURRENT #9: Thu Jan 4 10:12:17 CET 2001 root@critter.freebsd.dk:/freebsd/src/sys/compile/FLUTTER i386


>Description:

Portnumbers may get truncated, which can confuse the heck out of
people.

Example where "1141" gets truncated to "114"

femmer:/home/jail/nsx/etc/namedb# sockstat | grep 212.242.86.173
bind     named     1103    3 udp4   212.242.86.173:114    *:*                  
bind     named     1103   20 udp4   212.242.86.173:53     *:*                  
bind     named     1103   21 tcp4   212.242.86.173:53     *:*                  
root     ntpd       248   10 udp4   212.242.86.173:123    *:*                  

femmer:/home/jail/nsx/etc/namedb# netstat -an | grep 212.242.86.173
tcp4       0      0  212.242.86.173.53      *.*                    LISTEN
udp4       0      0  212.242.86.173.1141    *.*                    
udp4       0      0  212.242.86.173.53      *.*                    
udp4       0      0  212.242.86.173.123     *.*            

>How-To-Repeat:
	
>Fix:

	
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Mon Mar 12 17:34:25 PST 2001 
Responsible-Changed-Why:  
I wrote sockstat(1). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25712 

From: Dag-Erling Smorgrav <des@ofug.org>
To: phk@critter.freebsd.dk
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/25712: sockstat truncates field
Date: 13 Mar 2001 02:38:54 +0100

 Poul-Henning Kamp <phk@critter.freebsd.dk> writes:
 > femmer:/home/jail/nsx/etc/namedb# netstat -an | grep 212.242.86.173
 > tcp4       0      0  212.242.86.173.53      *.*                    LISTEN
 > udp4       0      0  212.242.86.173.1141    *.*                    
 > udp4       0      0  212.242.86.173.53      *.*                    
 > udp4       0      0  212.242.86.173.123     *.*            
 
 The problem is that sockstat(1) uses 'netstat -Aan', which truncates
 port numbers to restrict the source and destination address to 19
 characters each (15 for dotted quad + 1 for colon leave only 3 for
 port number). Unfortunately, there's no way to join the information
 from 'netstat -an' with that from 'netstat -Aan' (no common key), so
 this will remain a problem until an option is added to netstat(1) to
 *not* truncate even if this causes individual lines to exceed 80
 characters.
 
 DES
 -- 
 Dag-Erling Smorgrav - des@ofug.org

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: Dag-Erling Smorgrav <des@ofug.org>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/25712: sockstat truncates field 
Date: Tue, 13 Mar 2001 11:57:28 +0100

 In message <xzp3dcisb0x.fsf@flood.ping.uio.no>, Dag-Erling Smorgrav writes:
 >Poul-Henning Kamp <phk@critter.freebsd.dk> writes:
 >> femmer:/home/jail/nsx/etc/namedb# netstat -an | grep 212.242.86.173
 >> tcp4       0      0  212.242.86.173.53      *.*                    LISTEN
 >> udp4       0      0  212.242.86.173.1141    *.*                    
 >> udp4       0      0  212.242.86.173.53      *.*                    
 >> udp4       0      0  212.242.86.173.123     *.*            
 >
 >The problem is that sockstat(1) uses 'netstat -Aan', which truncates
 >port numbers to restrict the source and destination address to 19
 >characters each (15 for dotted quad + 1 for colon leave only 3 for
 >port number). 
 
 Well, then netstat -Aan should be fixed :-)
 
 --
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk@FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD committer       | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Sun May 27 06:12:29 PDT 2001 
State-Changed-Why:  
Fixed before 4.3-RELEASE. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25712 
>Unformatted:
