git: 0dc78204a7dc - main - ddb: fix handling of BBLog entries when BBLog is disabled

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Tue, 10 Jun 2025 16:36:28 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=0dc78204a7dcbc51bfab4c701e1335084548bc05

commit 0dc78204a7dcbc51bfab4c701e1335084548bc05
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-06-10 16:32:39 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-06-10 16:32:39 +0000

    ddb: fix handling of BBLog entries when BBLog is disabled
    
    Fixes:          a62c6b0de48a ("ddb: add optional printing of BBLog entries")
    MFC after:      1 week
    Sponsored by:   Netflix, Inc.
---
 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 eb33a9c15ebb..fef32e16b2e4 100644
--- a/sys/netinet/tcp_log_buf.h
+++ b/sys/netinet/tcp_log_buf.h
@@ -570,6 +570,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)
 
@@ -585,9 +588,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 1eee45e3c2ac..cd273803dacf 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -3210,7 +3210,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
 	}
 }