summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authorsilby <silby@FreeBSD.org>2009-09-23 05:32:33 +0000
committersilby <silby@FreeBSD.org>2009-09-23 05:32:33 +0000
commit9c5b455a41ce8f7b10145c8a290f81331587c91b (patch)
tree76f2b47fd35d2e9ce001f2cf92bd065dade6b305 /usr.bin/netstat
parent5f1ec7efd7eb12038c14eda248c63705b89b3772 (diff)
downloadFreeBSD-src-9c5b455a41ce8f7b10145c8a290f81331587c91b.zip
FreeBSD-src-9c5b455a41ce8f7b10145c8a290f81331587c91b.tar.gz
In netstat -x, do not try to print out tcp timer status for udp sockets.
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index da07e1d..65884ad 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -355,6 +355,7 @@ protopr(u_long off, const char *name, int af1, int proto)
} else {
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
+ timer = NULL;
}
/* Ignore sockets for protocols other than the desired one. */
@@ -425,7 +426,7 @@ protopr(u_long off, const char *name, int af1, int proto)
printf("%7.7s %7.7s %7.7s %7.7s %7.7s %7.7s %s\n",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime",
- "(state)");
+ "(state)");
} else
printf("(state)\n");
}
@@ -529,13 +530,14 @@ protopr(u_long off, const char *name, int af1, int proto)
so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
so->so_rcv.sb_mbmax, so->so_snd.sb_mbmax);
- printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d ",
- timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
- timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
- timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
- timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
- timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
- timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
+ if (timer != NULL)
+ printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d %4d.%02d ",
+ timer->tt_rexmt / 1000, (timer->tt_rexmt % 1000) / 10,
+ timer->tt_persist / 1000, (timer->tt_persist % 1000) / 10,
+ timer->tt_keep / 1000, (timer->tt_keep % 1000) / 10,
+ timer->tt_2msl / 1000, (timer->tt_2msl % 1000) / 10,
+ timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
+ timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
}
if (istcp && !Lflag) {
OpenPOWER on IntegriCloud