Re: netstat output issue

From: Ian FREISLICH <ianf_at_clue.co.za>
Date: Tue, 04 Mar 2008 14:16:31 +0200
Peter Jeremy wrote:
> 
> --IjNIXuzrMEaOuFwn
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> 
> On Thu, Feb 28, 2008 at 02:18:45PM -0800, Barney Cordoba wrote:
> >When using bridging, netstat apparently can only
> >display 5 characters, so "bridge" is shown as the
> >route.
> 
> If you're talking about 'netstat -i', try 'netstat -iW'.

'-W' is marginally better, but in reality "wider" is only really 2
characters wider:

[firewall2.cpt1] ~ $ netstat -iWI vlan2001_vrrp
Name      Mtu Network       Address              Ipkts Ierrs    Opkts Oerrs  Coll
vlan200  1500 <Link#15>                              1     0  2699257     1     0
vlan200  1500 xxx.xx.xx.xx/ xxx.xx.xx.xx        182642     -        0     -     -

It will help Barney, but it doesn't always help.

This patch helps my situation for the '-i' case:

RCS file: /home/ncvs/src/usr.bin/netstat/if.c,v
retrieving revision 1.69
diff -u -d -r1.69 if.c
--- if.c        16 Jul 2007 17:15:54 -0000      1.69
+++ if.c        4 Mar 2008 12:13:48 -0000
_at__at_ -222,7 +222,7 _at__at_
 
        if (!pfunc) {
                if (Wflag)
-                       printf("%-7.7s", "Name");
+                       printf("%-13.13s", "Name");
                else
                        printf("%-5.5s", "Name");
                printf(" %5.5s %-13.13s %-17.17s %8.8s %5.5s",
_at__at_ -291,7 +291,7 _at__at_
 
                if (ifaddraddr == 0) {
                        if (Wflag)
-                               printf("%-7.7s", name);
+                               printf("%-13.13s", name);
                        else
                                printf("%-5.5s", name);
                        printf(" %5lu ", ifnet.if_mtu);
_at__at_ -312,7 +312,7 _at__at_
                                continue;
                        }
                        if (Wflag)
-                               printf("%-7.7s", name);
+                               printf("%-13.13s", name);
                        else
                                printf("%-5.5s", name);
                        printf(" %5lu ", ifnet.if_mtu);


--
Ian Freislich
Received on Tue Mar 04 2008 - 11:17:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:28 UTC