From nobody Mon Nov 10 19:33:18 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d50FV6j1Qz63K3j; Mon, 10 Nov 2025 19:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d50FV5x99z3Snx; Mon, 10 Nov 2025 19:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762803198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yuzSwbmmBZQIwA337F2GvtXs7178yCAA/euEY5BMIOE=; b=rW/ZBZlYxabnB45HzTXt+KL/8LU2xnrS3t49n2qDYvdmPFibHGHwM3oiafigrEfMdehobH N13cExlM/WVoKWCJuQexS+j9FX/sz6rLT+9jFHDbXjLVvvrQb8C6f/V/7/qsDwDLI4C9+8 Jr1Lq9AkLYQFByl4WXYV1ga7G9xDRD2mfsv/HySzfLKDLBnW7JUTPbZQB7F7lfNT2cli9b v6ZDZS+AG6S7qj8/OR9pJPCuYeq7osvX5W779nAYrOEuLo5sOxGpqzwNcdI8C4vfTUSuei NAas95sDKUjU95LWbpPaLmfk8EHrukBJzQ5BhIKe3g92cHxMQkwk+p0fB4IKlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762803198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yuzSwbmmBZQIwA337F2GvtXs7178yCAA/euEY5BMIOE=; b=TwJgj9RNAt/+Ku+PDl2ZMIVugUJIVT8v+xR6j3fr4GwfhVBgM7TCBS6CwiLtoBTJ/L2Vqa +Kw9wBO8Og4WqfxYwwYbUcfgnDYTMbtEBc2EIHZatQag7g1JyxDCMJi3oIeKLJPrS+FwKW FIadbGBIJQMFfGaxIKo6rnxJJ3dH6Gteppof+n69rPIT3LZDCWkj4putdVkD/77JPompy8 hcc6A0aP5cOBzovMkpXariE45y1DM8pZwhoUIkN6j6lVAhH6In4VJm/dK9FkeOS2Bou9FO Y7f/K9v+mqxeUHsVOpDzHBAXE5grCLzOvDlKkiQzVH2NKcskdusR12lg64DdHA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762803198; a=rsa-sha256; cv=none; b=b5tycS6ZHuV5foEwD8/dX/cCT/HnZqQNGD9waeC2ed0FboTHtNnJa7NicklMGMIobCplXs jnBz5gtKhHt3mkP0afpc55wqFxhNrfd6GVHzxKvyAkk0Ek9Z+41CqwidTrTAqAs/DrbSsE VEtrudMd+Fs0TJnsRFsrwCDgcPTDWY6Uw85xcodYzWGgXsAIrwwPw0V5THmEAKaM4Mpe+K YN5I4+lnFkm9i1mfCj8y2F28Bc8YBpp7EFB55m4PAWgLFanOkUM0b3dwi0i+pI4J/zUl6c h+bl1q3/MVu2Jb0HOKNabr77cR7xQZ5jzdwPme64jiZW/FAd7wjpOdHh04KsBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d50FV5K69zXKR; Mon, 10 Nov 2025 19:33:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5AAJXIUS068882; Mon, 10 Nov 2025 19:33:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AAJXIZg068879; Mon, 10 Nov 2025 19:33:18 GMT (envelope-from git) Date: Mon, 10 Nov 2025 19:33:18 GMT Message-Id: <202511101933.5AAJXIZg068879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: d463a4c4bb1f - stable/15 - ddb: optionally print inp when printing tcpcb List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: d463a4c4bb1f05439a74da5e44c106e0f8e9721c Auto-Submitted: auto-generated The branch stable/15 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d463a4c4bb1f05439a74da5e44c106e0f8e9721c commit d463a4c4bb1f05439a74da5e44c106e0f8e9721c Author: Michael Tuexen AuthorDate: 2025-10-31 18:05:02 +0000 Commit: Michael Tuexen CommitDate: 2025-11-10 19:31:45 +0000 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 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D53497 (cherry picked from commit 9aa5a79e2af9a6a8930bbe8a7a024df2cf44e433) --- share/man/man4/ddb.4 | 12 +++++++++--- sys/netinet/in_pcb.c | 2 +- sys/netinet/in_pcb.h | 3 +++ sys/netinet/tcp_usrreq.c | 21 ++++++++++++++------- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4 index 3c4894c03d62..a882a5204fb2 100644 --- a/share/man/man4/ddb.4 +++ b/share/man/man4/ddb.4 @@ -24,7 +24,7 @@ .\" any improvements or extensions that they make and grant Carnegie Mellon .\" the rights to redistribute these changes. .\" -.Dd June 10, 2025 +.Dd October 31, 2025 .Dt DDB 4 .Os .Sh NAME @@ -604,12 +604,15 @@ The modifier will print command line arguments for each process. .\" .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 TCP control blocks within the system. The .Cm b 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 .Cm l modifier will limit the output to TCP control blocks, which are locked. @@ -1106,7 +1109,7 @@ on i386.) Not present on some platforms. .\" .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 .Vt struct tcpcb lying at address @@ -1117,6 +1120,9 @@ header file. The .Cm b modifier will request BBLog entries to be printed. +If the +.Cm i +modifier is provided, the corresponding IP control block is also shown. .\" .Pp .It Ic show Cm thread Op Ar addr | tid diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 3b11a7718cff..53300eb10e09 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -3058,7 +3058,7 @@ db_print_inconninfo(struct in_conninfo *inc, const char *name, int indent) ntohs(inc->inc_fport)); } -static void +void db_print_inpflags(int inp_flags) { int comma; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 9e0618e87601..7d41e3d690e0 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -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_eagain(struct inpcb *); #endif +#ifdef DDB +void db_print_inpcb(struct inpcb *, const char *, int); +#endif #endif /* _KERNEL */ #endif /* !_NETINET_IN_PCB_H_ */ diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 98c934955121..c4a54646f3a2 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -3088,7 +3088,8 @@ db_print_bblog_state(int state) } 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); @@ -3096,6 +3097,9 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog) indent += 2; + if (show_inpcb) + db_print_inpcb(tptoinpcb(tp), "t_inpcb", indent); + db_print_indent(indent); db_printf("t_segq first: %p t_segqlen: %d t_dupacks: %d\n", 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) { struct tcpcb *tp; - bool show_bblog; + bool show_bblog, show_inpcb; if (!have_addr) { - db_printf("usage: show tcpcb \n"); + db_printf("usage: show tcpcb[/bi] \n"); return; } show_bblog = strchr(modif, 'b') != NULL; + show_inpcb = strchr(modif, 'i') != NULL; tp = (struct tcpcb *)addr; - - db_print_tcpcb(tp, "tcpcb", 0, show_bblog); + db_print_tcpcb(tp, "tcpcb", 0, show_bblog, show_inpcb); } DB_SHOW_ALL_COMMAND(tcpcbs, db_show_all_tcpcbs) { VNET_ITERATOR_DECL(vnet_iter); struct inpcb *inp; - bool only_locked, show_bblog; + struct tcpcb *tp; + bool only_locked, show_bblog, show_inpcb; only_locked = strchr(modif, 'l') != NULL; show_bblog = strchr(modif, 'b') != NULL; + show_inpcb = strchr(modif, 'i') != NULL; VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); CK_LIST_FOREACH(inp, &V_tcbinfo.ipi_listhead, inp_list) { if (only_locked && inp->inp_lock.rw_lock == RW_UNLOCKED) 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) break; }