git: 9506da19ca73 - stable/14 - ddb: fix handling of BBLog entries when BBLog is disabled

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Thu, 04 Sep 2025 20:02:38 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=9506da19ca73f54c277ffa9fd89a774a6117d2d0

commit 9506da19ca73f54c277ffa9fd89a774a6117d2d0
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-06-10 16:32:39 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-09-04 20:02:16 +0000

    ddb: fix handling of BBLog entries when BBLog is disabled
    
    Fixes:          a62c6b0de48a ("ddb: add optional printing of BBLog entries")
    Sponsored by:   Netflix, Inc.
    
    (cherry picked from commit 0dc78204a7dcbc51bfab4c701e1335084548bc05)
---
 sys/netinet/tcp_log_buf.h | 7 +++----
 sys/netinet/tcp_usrreq.c  | 5 +++++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/netinet/tcp_log_buf.h b/sys/netinet/tcp_log_buf.h
index 7755fbccdb45..363ea13b1743 100644
--- a/sys/netinet/tcp_log_buf.h
+++ b/sys/netinet/tcp_log_buf.h
@@ -567,6 +567,9 @@ void tcp_log_flowend(struct tcpcb *tp);
 void tcp_log_sendfile(struct socket *so, off_t offset, size_t nbytes,
     int flags);
 int tcp_log_apply_ratio(struct tcpcb *tp, int ratio);
+#ifdef DDB
+void db_print_bblog_entries(struct tcp_log_stailq *log_entries, int indent);
+#endif
 #else /* !TCP_BLACKBOX */
 #define tcp_log_verbose	(false)
 
@@ -582,9 +585,5 @@ tcp_log_event(struct tcpcb *tp, struct tcphdr *th, struct sockbuf *rxbuf,
 }
 #endif /* TCP_BLACKBOX */
 
-#ifdef DDB
-void db_print_bblog_entries(struct tcp_log_stailq *log_entries, int indent);
-#endif
-
 #endif	/* _KERNEL */
 #endif	/* __tcp_log_buf_h__ */
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 89bc019e8884..daa04845ab79 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -3243,7 +3243,12 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent, bool show_bblog)
 	    tp->t_lognum, tp->t_loglimit, tp->t_logsn);
 
 	if (show_bblog) {
+#ifdef TCP_BLACKBOX
 		db_print_bblog_entries(&tp->t_logs, indent);
+#else
+		db_print_indent(indent);
+		db_printf("BBLog not supported\n");
+#endif
 	}
 }