summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorhiren <hiren@FreeBSD.org>2015-04-06 18:40:50 +0000
committerhiren <hiren@FreeBSD.org>2015-04-06 18:40:50 +0000
commit39fb34452ff3bc4927f319c53cfad417efb4e883 (patch)
treefab8dc20b771524ae042d1c3a2ab99512f74b231 /usr.bin
parent511fc2e53ec0c25a92e2d1a47a46821b30ee2b6d (diff)
downloadFreeBSD-src-39fb34452ff3bc4927f319c53cfad417efb4e883.zip
FreeBSD-src-39fb34452ff3bc4927f319c53cfad417efb4e883.tar.gz
MFC r266418, r266448
Add the flowtype to the inpcb. Add -R to netstat to dump RSS/flow information. Reviewed by: delphij Relnotes: yes (for r266448) Sponsored by: Limelight Networks
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/inet.c14
-rw-r--r--usr.bin/netstat/main.c8
-rw-r--r--usr.bin/netstat/netstat.h1
3 files changed, 18 insertions, 5 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 09b3110..f8ff31b 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -429,7 +429,7 @@ protopr(u_long off, const char *name, int af1, int proto)
"%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s",
"Proto", "Recv-Q", "Send-Q",
"Local Address", "Foreign Address");
- if (!xflag)
+ if (!xflag && !Rflag)
printf(" (state)");
}
if (xflag) {
@@ -441,6 +441,9 @@ protopr(u_long off, const char *name, int af1, int proto)
printf(" %7.7s %7.7s %7.7s %7.7s %7.7s %7.7s",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime");
+ } else if (Rflag) {
+ printf (" %8.8s %5.5s",
+ "flowid", "ftype");
}
putchar('\n');
first = 0;
@@ -549,7 +552,7 @@ protopr(u_long off, const char *name, int af1, int proto)
timer->tt_delack / 1000, (timer->tt_delack % 1000) / 10,
timer->t_rcvtime / 1000, (timer->t_rcvtime % 1000) / 10);
}
- if (istcp && !Lflag && !xflag && !Tflag) {
+ if (istcp && !Lflag && !xflag && !Tflag && !Rflag) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
printf("%d", tp->t_state);
else {
@@ -560,7 +563,12 @@ protopr(u_long off, const char *name, int af1, int proto)
putchar('*');
#endif /* defined(TF_NEEDSYN) && defined(TF_NEEDFIN) */
}
- }
+ }
+ if (Rflag) {
+ printf(" %08x %5d",
+ inp->inp_flowid,
+ inp->inp_flowtype);
+ }
putchar('\n');
}
if (xig != oxig && xig->xig_gen != oxig->xig_gen) {
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 42e7080..1bfc951 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -326,6 +326,7 @@ int numeric_port; /* show ports numerically */
static int pflag; /* show given protocol */
int Qflag; /* show netisr information */
int rflag; /* show routing tables (or routing stats) */
+int Rflag; /* show flow / RSS statistics */
int sflag; /* show protocol statistics */
int Wflag; /* wide display */
int Tflag; /* TCP Information */
@@ -350,7 +351,7 @@ main(int argc, char *argv[])
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:rSTsuWw:xz"))
+ while ((ch = getopt(argc, argv, "46AaBbdF:f:ghI:iLlM:mN:np:Qq:RrSTsuWw:xz"))
!= -1)
switch(ch) {
case '4':
@@ -468,6 +469,9 @@ main(int argc, char *argv[])
case 'r':
rflag = 1;
break;
+ case 'R':
+ Rflag = 1;
+ break;
case 's':
++sflag;
break;
@@ -864,7 +868,7 @@ static void
usage(void)
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
-"usage: netstat [-46AaLnSTWx] [-f protocol_family | -p protocol]\n"
+"usage: netstat [-46AaLnRSTWx] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
" netstat -i | -I interface [-46abdhnW] [-f address_family]\n"
" [-M core] [-N system]",
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 414b4ce..d2e9d32 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -45,6 +45,7 @@ extern int noutputs; /* how much outputs before we exit */
extern int numeric_addr; /* show addresses numerically */
extern int numeric_port; /* show ports numerically */
extern int rflag; /* show routing tables (or routing stats) */
+extern int Rflag; /* show flowid / RSS information */
extern int sflag; /* show protocol statistics */
extern int Tflag; /* show TCP control block info */
extern int Wflag; /* wide display */
OpenPOWER on IntegriCloud