netstat

Andrew Thompson andy at fud.org.nz
Tue Jul 1 03:45:00 PDT 2003


Hi,


Is there any reason that the interface name in netstat is truncated at 5
chars? I have a box with ~100 vlans so the interface name gets chopped
after vlan9.

Here is a patch to increase it to 7 chars. Any probs?


thanks,

Andy



--- usr.bin/netstat/if.c.orig   Tue Jul  1 22:37:14 2003
+++ usr.bin/netstat/if.c        Tue Jul  1 22:38:59 2003
@@ -188,7 +188,7 @@
                return;
  
        if (!pfunc) {
-               printf("%-5.5s %5.5s %-13.13s %-17.17s %8.8s %5.5s",
+               printf("%-7.7s %5.5s %-13.13s %-17.17s %8.8s %5.5s",
                       "Name", "Mtu", "Network", "Address", "Ipkts",
"Ierrs");
                if (bflag)
                        printf(" %10.10s","Ibytes");
@@ -254,7 +254,7 @@
                drops = ifnet.if_snd.ifq_drops;
  
                if (ifaddraddr == 0) {
-                       printf("%-5.5s %5lu ", name, ifnet.if_mtu);
+                       printf("%-7.7s %5lu ", name, ifnet.if_mtu);
                        printf("%-13.13s ", "none");
                        printf("%-17.17s ", "none");
                } else {
@@ -271,7 +271,7 @@
                                    (u_long)TAILQ_NEXT(&ifaddr.ifa,
ifa_link);
                                continue;
                        }
-                       printf("%-5.5s %5lu ", name, ifnet.if_mtu);
+                       printf("%-7.7s %5lu ", name, ifnet.if_mtu);
                        switch (sa->sa_family) {
                        case AF_UNSPEC:
                                printf("%-13.13s ", "none");







More information about the freebsd-current mailing list