Bug 21546

Summary: netstat -rn output needs netmask info added
Product: Base System Reporter: frank <frank>
Component: binAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-RELEASE   
Hardware: Any   
OS: Any   

Description frank 2000-09-26 01:10:01 UTC
If I have fxp0 as 192.168.0.x/24, netstat -rn -f inet shows this route as

192.168		link#1 ...

which makes you think it is a /16.

Fix: 

netstat needs to report netmasks explicitly, and expand the destination
IP to at least the prefix length (if not all 4 octets).

eg:

192.168.0/24	link#1	...

or

192.168.0.0/24	link#1	...
How-To-Repeat: `ifconfig fxp0 192.168.0.1 netmask 255.255.255.0; netstat -rn -f inet'
Comment 1 Ruslan Ermilov 2000-09-26 08:51:34 UTC
On Mon, Sep 25, 2000 at 05:06:45PM -0700, frank@google.com wrote:
> 
> If I have fxp0 as 192.168.0.x/24, netstat -rn -f inet shows this route as
> 
> 192.168		link#1 ...
> 
> which makes you think it is a /16.
> 
No, it does not, because I know that the standard netmask for class C
network is /24.  In other words, netstat(1) does not output the netmask
for a network route unless it is different from the default netmask for
this network's class, IN_CLASS[ABC]_NET (see /usr/include/netinet/in.h).

-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 2 ru freebsd_committer freebsd_triage 2001-06-08 16:43:34 UTC
State Changed
From-To: open->closed

Fixed in 5.0-CURRENT, in netstat/route.c,v 1.49. 
netstat(1) now prints at least 2 bytes for class B 
networks and at least 3 bytes for class C networks. 
MFC into 4.3-STABLE within a week. 


Comment 3 ru freebsd_committer freebsd_triage 2001-06-08 16:43:34 UTC
Responsible Changed
From-To: freebsd-bugs->ru

The fix was mine.