bin/161986: Interface auto-width in "netstat -rn"

Dennis Yusupoff dyr at smartspb.net
Tue Oct 25 09:10:02 UTC 2011


>Number:         161986
>Category:       bin
>Synopsis:       Interface auto-width in "netstat -rn"
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 25 09:10:01 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Dennis Yusupoff
>Release:        7,8 and 9
>Organization:
SmartTelecom
>Environment:
No matter :)
>Description:
Currently there are two version of "netstat -rn" - "wide" and "usual". Wide is turning on by option "-W" and show additional information about routes (only for IPv4 family, as I understand route.c) - MTU and the full interface name(limited, however, by 8 symbols). In "usual" mode Netif limited by 6 symbols, which definitly isn't enough for VLAN interfaces:

===
netstat  -rn| head -n6
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            217.119.16.33      UGS         0 2147187618    em0
10.1.0.0/16        10.78.77.9         UG1         0        0 vlan30
===


===
netstat  -Wrn| head -n6
Routing tables

Internet:
Destination        Gateway            Flags    Refs        Use    Mtu    Netif Expire
default            217.119.16.33      UGS         0 2147115775   1500      em0
10.1.0.0/16        10.78.77.9         UG1         0          0   1500 vlan3050
===

I think, that truncating Netif is absolutely incorrect and easily confusing most FreeBSD users. 

So I propose:
1. Limit wid_if by getting width of longest netif name (i.e. automatically, on-the-fly)
2.1 Show full netif by default or:
2.2 Add special "truncated" symbol at the end of Netif, for example ">", like that:
===
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            217.119.16.33      UGS         0 2147187618    em0
10.1.0.0/16        10.78.77.9         UG1         0        0 vlan30>
===


>How-To-Repeat:

>Fix:
Don't know C as should, but it looks like it might be easily patch route.c

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list