Page MenuHomeFreeBSD

D59131.id184805.diff
No OneTemporary

D59131.id184805.diff

diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -4295,6 +4295,9 @@
bcopy(CC_ALGO(tp)->name, xt->xt_cc, TCP_CA_NAME_MAX);
#ifdef TCP_BLACKBOX
(void)tcp_log_get_id(tp, xt->xt_logid);
+ xt->t_lognum = tp->t_lognum;
+ xt->t_loglimit = tp->t_loglimit;
+ xt->t_logsn = tp->t_logsn;
#endif
xt->xt_len = sizeof(struct xtcpcb);
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1233,7 +1233,10 @@
uint32_t t_dsack_pack; /* (n) */
uint16_t xt_encaps_port; /* (s) */
int16_t spare16;
- int32_t spare32[22];
+ int32_t t_lognum; /* (s) */
+ int32_t t_loglimit; /* (s) */
+ uint32_t t_logsn; /* (s) */
+ int32_t spare32[19];
} __aligned(8);
#ifdef _KERNEL
diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -198,6 +198,9 @@
int state;
int fibnum;
int bblog_state;
+ int bblog_num;
+ int bblog_limit;
+ unsigned int bblog_sn;
const struct proto *proto;
const char *protoname;
char stack[TCP_FUNCTION_NAME_LEN_MAX];
@@ -749,6 +752,9 @@
if (proto == &protos[TCP]) {
sock->state = xtp->t_state;
sock->bblog_state = xtp->t_logstate;
+ sock->bblog_num = xtp->t_lognum;
+ sock->bblog_limit = xtp->t_loglimit;
+ sock->bblog_sn = xtp->t_logsn;
memcpy(sock->stack, xtp->xt_stack,
TCP_FUNCTION_NAME_LEN_MAX);
memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX);
@@ -1195,6 +1201,9 @@
int path_state;
int conn_state;
int bblog_state;
+ int bblog_num;
+ int bblog_limit;
+ int bblog_sn;
int stack;
int cc;
};
@@ -1315,6 +1324,12 @@
if (opt_b && s->proto == &protos[TCP]) {
len = strlen(bblog_state(s->bblog_state));
cw->bblog_state = MAX(cw->bblog_state, len);
+ len = snprintf(NULL, 0, "%d", s->bblog_num);
+ cw->bblog_num = MAX(cw->bblog_num, len);
+ len = snprintf(NULL, 0, "%d", s->bblog_limit);
+ cw->bblog_limit = MAX(cw->bblog_limit, len);
+ len = snprintf(NULL, 0, "%u", s->bblog_sn);
+ cw->bblog_sn = MAX(cw->bblog_sn, len);
}
first = false;
}
@@ -1533,13 +1548,32 @@
cw->conn_state, "??");
}
if (opt_b) {
- if (s->proto == &protos[TCP])
+ if (s->proto == &protos[TCP]) {
xo_emit(" {:bblog-state/%-*s}",
cw->bblog_state,
bblog_state(s->bblog_state));
- else if (!is_xo_style_encoding)
+ snprintf(buf, bufsize, "%d",
+ s->bblog_num);
+ xo_emit(" {:bblog-number/%*s}",
+ cw->bblog_num, buf);
+ snprintf(buf, bufsize, "%d",
+ s->bblog_limit);
+ xo_emit(" {:bblog-limit/%*s}",
+ cw->bblog_limit, buf);
+ snprintf(buf, bufsize, "%u",
+ s->bblog_sn);
+ xo_emit(" {:bblog-serial-number/%*s}",
+ cw->bblog_sn, buf);
+ } else if (!is_xo_style_encoding) {
xo_emit(" {:bblog-state/%-*s}",
cw->bblog_state, "??");
+ xo_emit(" {:bblog-number/%*s}",
+ cw->bblog_num, "??");
+ xo_emit(" {:bblog-limit/%*s}",
+ cw->bblog_limit, "??");
+ xo_emit(" {:bblog-serial-number/%*s}",
+ cw->bblog_sn, "??");
+ }
}
if (opt_S) {
if (s->proto == &protos[TCP])
@@ -1599,6 +1633,9 @@
*__HDR_PATH_STATE="PATH STATE",
*__HDR_CONN_STATE="CONN STATE",
*__HDR_BBLOG_STATE="BBLOG STATE",
+ *__HDR_BBLOG_NUM="BBLOG NUM",
+ *__HDR_BBLOG_LIMIT="BBLOG LIM",
+ *__HDR_BBLOG_SN="BBLOG SN",
*__HDR_STACK="STACK",
*__HDR_CC="CC";
@@ -1631,6 +1668,9 @@
.path_state = strlen(__HDR_PATH_STATE),
.conn_state = strlen(__HDR_CONN_STATE),
.bblog_state = strlen(__HDR_BBLOG_STATE),
+ .bblog_num = strlen(__HDR_BBLOG_NUM),
+ .bblog_limit = strlen(__HDR_BBLOG_LIMIT),
+ .bblog_sn = strlen(__HDR_BBLOG_SN),
.stack = strlen(__HDR_STACK),
.cc = strlen(__HDR_CC),
};
@@ -1665,8 +1705,12 @@
__HDR_PATH_STATE);
xo_emit(" {T:/%-*s}", cw.conn_state, __HDR_CONN_STATE);
}
- if (opt_b)
+ if (opt_b) {
xo_emit(" {T:/%-*s}", cw.bblog_state, __HDR_BBLOG_STATE);
+ xo_emit(" {T:/%*s}", cw.bblog_num, __HDR_BBLOG_NUM);
+ xo_emit(" {T:/%*s}", cw.bblog_limit, __HDR_BBLOG_LIMIT);
+ xo_emit(" {T:/%*s}", cw.bblog_sn, __HDR_BBLOG_SN);
+ }
if (opt_S)
xo_emit(" {T:/%-*s}", cw.stack, __HDR_STACK);
if (opt_C)
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
--- a/usr.bin/sockstat/sockstat.1
+++ b/usr.bin/sockstat/sockstat.1
@@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd June 8, 2026
+.Dd August 23, 2026
.Dt SOCKSTAT 1
.Os
.Sh NAME
@@ -67,7 +67,7 @@
Show the address of a protocol control block (PCB) associated with a socket;
used for debugging.
.It Fl b
-Show the BBLog state of the socket.
+Show BBLog related information for the socket.
This is currently only implemented for TCP.
.It Fl C
Display the congestion control module, if applicable.
@@ -228,6 +228,19 @@
The BBLog state if
.Fl b
is specified (only for TCP).
+.It Li BBLOG NUM
+The number of BBLog entries currently being stored at the endpoint if
+.Fl b
+is specified (only for TCP).
+.It Li BBLOG LIM
+The maximum number of BBLog entries which can be stored at the endpoint
+if
+.Fl b
+is specified (only for TCP).
+.It Li BBLOG SN
+The next BBLog sequence number to be assigned if
+.Fl b
+is specified (only for TCP).
.It Li STACK
The protocol stack if
.Fl S

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 2, 10:18 AM (20 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37877074
Default Alt Text
D59131.id184805.diff (5 KB)

Event Timeline