Fix some minor nits in netstat whereby large interface names would be
truncated. In environments where many tunnel or vlan interfaces are created, interface names have high numbers which overflow the field width. PRs: bin/52349, bin/35838 Submitted by: Mike Tancsa, Scot W. Hetzel Approved by: re (rwatson)
This commit is contained in:
parent
a2ed0b4e3d
commit
25d295e1ed
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123030
@ -188,8 +188,12 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
|
||||
return;
|
||||
|
||||
if (!pfunc) {
|
||||
printf("%-5.5s %5.5s %-13.13s %-17.17s %8.8s %5.5s",
|
||||
"Name", "Mtu", "Network", "Address", "Ipkts", "Ierrs");
|
||||
if (Wflag)
|
||||
printf("%-7.7s", "Name");
|
||||
else
|
||||
printf("%-5.5s", "Name");
|
||||
printf(" %5.5s %-13.13s %-17.17s %8.8s %5.5s",
|
||||
"Mtu", "Network", "Address", "Ipkts", "Ierrs");
|
||||
if (bflag)
|
||||
printf(" %10.10s","Ibytes");
|
||||
printf(" %8.8s %5.5s", "Opkts", "Oerrs");
|
||||
@ -251,7 +255,11 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
|
||||
drops = ifnet.if_snd.ifq_drops;
|
||||
|
||||
if (ifaddraddr == 0) {
|
||||
printf("%-5.5s %5lu ", name, ifnet.if_mtu);
|
||||
if (Wflag)
|
||||
printf("%-7.7s", name);
|
||||
else
|
||||
printf("%-5.5s", name);
|
||||
printf(" %5lu ", ifnet.if_mtu);
|
||||
printf("%-13.13s ", "none");
|
||||
printf("%-17.17s ", "none");
|
||||
} else {
|
||||
@ -268,7 +276,11 @@ intpr(int _interval, u_long ifnetaddr, void (*pfunc)(char *))
|
||||
(u_long)TAILQ_NEXT(&ifaddr.ifa, ifa_link);
|
||||
continue;
|
||||
}
|
||||
printf("%-5.5s %5lu ", name, ifnet.if_mtu);
|
||||
if (Wflag)
|
||||
printf("%-7.7s", name);
|
||||
else
|
||||
printf("%-5.5s", name);
|
||||
printf(" %5lu ", ifnet.if_mtu);
|
||||
switch (sa->sa_family) {
|
||||
case AF_UNSPEC:
|
||||
printf("%-13.13s ", "none");
|
||||
|
@ -119,6 +119,9 @@ is also present, show the number of dropped packets.
|
||||
If
|
||||
.Fl t
|
||||
is also present, show the contents of watchdog timers.
|
||||
If
|
||||
.Fl W
|
||||
is also present, print interface names using a wider field size.
|
||||
.It Xo
|
||||
.Bk -words
|
||||
.Nm
|
||||
@ -215,7 +218,10 @@ When
|
||||
.Fl W
|
||||
is also present,
|
||||
show the path MTU
|
||||
for each route.
|
||||
for each route,
|
||||
and print interface
|
||||
names with a wider
|
||||
field size.
|
||||
.It Xo
|
||||
.Bk -words
|
||||
.Nm
|
||||
|
@ -225,13 +225,13 @@ pr_family(int af1)
|
||||
#ifndef INET6
|
||||
#define WID_DST_DEFAULT(af) 18 /* width of destination column */
|
||||
#define WID_GW_DEFAULT(af) 18 /* width of gateway column */
|
||||
#define WID_IF_DEFAULT(af) 6 /* width of netif column */
|
||||
#define WID_IF_DEFAULT(af) (Wflag ? 8 : 6) /* width of netif column */
|
||||
#else
|
||||
#define WID_DST_DEFAULT(af) \
|
||||
((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18)
|
||||
#define WID_GW_DEFAULT(af) \
|
||||
((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18)
|
||||
#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : 6)
|
||||
#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 8 : 6))
|
||||
#endif /*INET6*/
|
||||
|
||||
static int wid_dst;
|
||||
|
Loading…
Reference in New Issue
Block a user