git: 5f43b0cb7c3c - main - ddb: provide inp_flags2 when printing inpcbs

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Mon, 03 Nov 2025 15:19:24 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f43b0cb7c3cb7c3209598f8c0818cb47cd9de96

commit 5f43b0cb7c3cb7c3209598f8c0818cb47cd9de96
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-11-03 11:17:29 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-11-03 11:17:29 +0000

    ddb: provide inp_flags2 when printing inpcbs
    
    Reviewed by:            markj, Peter Lei
    MFC after:              3 days
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D53542
---
 sys/netinet/in_pcb.c | 3 +++
 sys/netinet/in_pcb.h | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index edc6c8f29cc0..b7dae78fb2c2 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -3076,6 +3076,9 @@ db_print_inpcb(struct inpcb *inp, const char *name, int indent)
 	db_print_indent(indent);
 	db_printf("inp_flags: 0x%b\n", inp->inp_flags, INP_FLAGS_BITS);
 
+	db_print_indent(indent);
+	db_printf("inp_flags2: 0x%b\n", inp->inp_flags2, INP_FLAGS2_BITS);
+
 	db_print_indent(indent);
 	db_printf("inp_sp: %p   inp_vflag: 0x%b\n", inp->inp_sp,
 	    inp->inp_vflag, INP_VFLAGS_BITS);
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 60f129bce216..975b8129c70d 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -624,6 +624,13 @@ void 	inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,
 #define INP_2PCP_MASK	(INP_2PCP_BIT0 | INP_2PCP_BIT1 | INP_2PCP_BIT2)
 #define INP_2PCP_SHIFT		18         /* shift PCP field in/out of inp_flags2 */
 
+/* inp_flags2 description for use with printf(9) %b identifier. */
+#define	INP_FLAGS2_BITS	"\20" \
+    "\11INP_RECVFLOWID\12INP_RECVRSSBUCKETID" \
+    "\13INP_RATE_LIMIT_CHANGED\14INP_ORIGDSTADDR" \
+    "\22INP_2PCP_SET\23INP_2PCP_BIT0\24INP_2PCP_BIT1" \
+    "\25INP_2PCP_BIT2"
+
 /*
  * Flags passed to in_pcblookup*(), inp_smr_lock() and inp_next().
  */