ddb: optionally print inp when printing tcpcb
Add /i option to the ddb commands show tcpcb and show all tcpcbs, which enables the printing of the t_inpcb. Reviewed by: markj MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D53497
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
.\" any improvements or extensions that they make and grant Carnegie Mellon
|
.\" any improvements or extensions that they make and grant Carnegie Mellon
|
||||||
.\" the rights to redistribute these changes.
|
.\" the rights to redistribute these changes.
|
||||||
.\"
|
.\"
|
||||||
.Dd June 10, 2025
|
.Dd October 31, 2025
|
||||||
.Dt DDB 4
|
.Dt DDB 4
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@@ -604,12 +604,15 @@ The
|
|||||||
modifier will print command line arguments for each process.
|
modifier will print command line arguments for each process.
|
||||||
.\"
|
.\"
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic show Cm all tcpcbs Ns Op Li / Ns Cm b Ns Cm l
|
.It Ic show Cm all tcpcbs Ns Op Li / Ns Cm b Ns Cm i Ns Cm l
|
||||||
Show the same output as "show tcpcb" does, but for all
|
Show the same output as "show tcpcb" does, but for all
|
||||||
TCP control blocks within the system.
|
TCP control blocks within the system.
|
||||||
The
|
The
|
||||||
.Cm b
|
.Cm b
|
||||||
modifier will request BBLog entries to be printed.
|
modifier will request BBLog entries to be printed.
|
||||||
|
If the
|
||||||
|
.Cm i
|
||||||
|
modifier is provided, the corresponding IP control block is also shown.
|
||||||
Using the
|
Using the
|
||||||
.Cm l
|
.Cm l
|
||||||
modifier will limit the output to TCP control blocks, which are locked.
|
modifier will limit the output to TCP control blocks, which are locked.
|
||||||
@@ -1106,7 +1109,7 @@ on i386.)
|
|||||||
Not present on some platforms.
|
Not present on some platforms.
|
||||||
.\"
|
.\"
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic show Cm tcpcb Ns Oo Li / Ns Cm b Oc Ar addr
|
.It Ic show Cm tcpcb Ns Oo Li / Ns Cm b Ns Cm i Oc Ar addr
|
||||||
Print TCP control block
|
Print TCP control block
|
||||||
.Vt struct tcpcb
|
.Vt struct tcpcb
|
||||||
lying at address
|
lying at address
|
||||||
@@ -1117,6 +1120,9 @@ header file.
|
|||||||
The
|
The
|
||||||
.Cm b
|
.Cm b
|
||||||
modifier will request BBLog entries to be printed.
|
modifier will request BBLog entries to be printed.
|
||||||
|
If the
|
||||||
|
.Cm i
|
||||||
|
modifier is provided, the corresponding IP control block is also shown.
|
||||||
.\"
|
.\"
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic show Cm thread Op Ar addr | tid
|
.It Ic show Cm thread Op Ar addr | tid
|
||||||
|
|||||||
@@ -3058,7 +3058,7 @@ db_print_inconninfo(struct in_conninfo *inc, const char *name, int indent)
|
|||||||
ntohs(inc->inc_fport));
|
ntohs(inc->inc_fport));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
db_print_inpflags(int inp_flags)
|
db_print_inpflags(int inp_flags)
|
||||||
{
|
{
|
||||||
int comma;
|
int comma;
|
||||||
|
|||||||
@@ -730,6 +730,9 @@ int in_pcbquery_txrlevel(struct inpcb *, uint32_t *);
|
|||||||
void in_pcboutput_txrtlmt(struct inpcb *, struct ifnet *, struct mbuf *);
|
void in_pcboutput_txrtlmt(struct inpcb *, struct ifnet *, struct mbuf *);
|
||||||
void in_pcboutput_eagain(struct inpcb *);
|
void in_pcboutput_eagain(struct inpcb *);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef DDB
|
||||||
|
void db_print_inpcb(struct inpcb *, const char *, int);
|
||||||
|
#endif
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#endif /* !_NETINET_IN_PCB_H_ */
|
#endif /* !_NETINET_IN_PCB_H_ */
|
||||||
|
|||||||
@@ -3088,7 +3088,8 @@ db_print_bblog_state(int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
|
db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog,
|
||||||
|
bool show_inpcb)
|
||||||
{
|
{
|
||||||
|
|
||||||
db_print_indent(indent);
|
db_print_indent(indent);
|
||||||
@@ -3096,6 +3097,9 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
|
|||||||
|
|
||||||
indent += 2;
|
indent += 2;
|
||||||
|
|
||||||
|
if (show_inpcb)
|
||||||
|
db_print_inpcb(tptoinpcb(tp), "t_inpcb", indent);
|
||||||
|
|
||||||
db_print_indent(indent);
|
db_print_indent(indent);
|
||||||
db_printf("t_segq first: %p t_segqlen: %d t_dupacks: %d\n",
|
db_printf("t_segq first: %p t_segqlen: %d t_dupacks: %d\n",
|
||||||
TAILQ_FIRST(&tp->t_segq), tp->t_segqlen, tp->t_dupacks);
|
TAILQ_FIRST(&tp->t_segq), tp->t_segqlen, tp->t_dupacks);
|
||||||
@@ -3227,33 +3231,36 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
|
|||||||
DB_SHOW_COMMAND(tcpcb, db_show_tcpcb)
|
DB_SHOW_COMMAND(tcpcb, db_show_tcpcb)
|
||||||
{
|
{
|
||||||
struct tcpcb *tp;
|
struct tcpcb *tp;
|
||||||
bool show_bblog;
|
bool show_bblog, show_inpcb;
|
||||||
|
|
||||||
if (!have_addr) {
|
if (!have_addr) {
|
||||||
db_printf("usage: show tcpcb <addr>\n");
|
db_printf("usage: show tcpcb[/bi] <addr>\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
show_bblog = strchr(modif, 'b') != NULL;
|
show_bblog = strchr(modif, 'b') != NULL;
|
||||||
|
show_inpcb = strchr(modif, 'i') != NULL;
|
||||||
tp = (struct tcpcb *)addr;
|
tp = (struct tcpcb *)addr;
|
||||||
|
db_print_tcpcb(tp, "tcpcb", 0, show_bblog, show_inpcb);
|
||||||
db_print_tcpcb(tp, "tcpcb", 0, show_bblog);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DB_SHOW_ALL_COMMAND(tcpcbs, db_show_all_tcpcbs)
|
DB_SHOW_ALL_COMMAND(tcpcbs, db_show_all_tcpcbs)
|
||||||
{
|
{
|
||||||
VNET_ITERATOR_DECL(vnet_iter);
|
VNET_ITERATOR_DECL(vnet_iter);
|
||||||
struct inpcb *inp;
|
struct inpcb *inp;
|
||||||
bool only_locked, show_bblog;
|
struct tcpcb *tp;
|
||||||
|
bool only_locked, show_bblog, show_inpcb;
|
||||||
|
|
||||||
only_locked = strchr(modif, 'l') != NULL;
|
only_locked = strchr(modif, 'l') != NULL;
|
||||||
show_bblog = strchr(modif, 'b') != NULL;
|
show_bblog = strchr(modif, 'b') != NULL;
|
||||||
|
show_inpcb = strchr(modif, 'i') != NULL;
|
||||||
VNET_FOREACH(vnet_iter) {
|
VNET_FOREACH(vnet_iter) {
|
||||||
CURVNET_SET(vnet_iter);
|
CURVNET_SET(vnet_iter);
|
||||||
CK_LIST_FOREACH(inp, &V_tcbinfo.ipi_listhead, inp_list) {
|
CK_LIST_FOREACH(inp, &V_tcbinfo.ipi_listhead, inp_list) {
|
||||||
if (only_locked &&
|
if (only_locked &&
|
||||||
inp->inp_lock.rw_lock == RW_UNLOCKED)
|
inp->inp_lock.rw_lock == RW_UNLOCKED)
|
||||||
continue;
|
continue;
|
||||||
db_print_tcpcb(intotcpcb(inp), "tcpcb", 0, show_bblog);
|
tp = intotcpcb(inp);
|
||||||
|
db_print_tcpcb(tp, "tcpcb", 0, show_bblog, show_inpcb);
|
||||||
if (db_pager_quit)
|
if (db_pager_quit)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user