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
This commit is contained in:
Hiren Panchasara 2015-04-06 18:40:50 +00:00
parent e68b2ce611
commit 29f8b78273
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=281161
4 changed files with 20 additions and 6 deletions

View File

@ -180,7 +180,8 @@ struct inpcb {
uint32_t inp_flowid; /* (x) flow id / queue id */
u_int inp_refcount; /* (i) refcount */
void *inp_pspare[5]; /* (x) route caching / general use */
u_int inp_ispare[6]; /* (x) route caching / user cookie /
uint32_t inp_flowtype; /* (x) M_HASHTYPE value */
u_int inp_ispare[5]; /* (x) route caching / user cookie /
* general use */
/* Local and foreign ports, local and foreign addr. */

View File

@ -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) {

View File

@ -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]",

View File

@ -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 */