Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109310445
D26413.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D26413.diff
View Options
Index: head/usr.bin/sockstat/sockstat.1
===================================================================
--- head/usr.bin/sockstat/sockstat.1
+++ head/usr.bin/sockstat/sockstat.1
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 13, 2020
+.Dd September 13, 2020
.Dt SOCKSTAT 1
.Os
.Sh NAME
@@ -35,7 +35,7 @@
.Nd list open sockets
.Sh SYNOPSIS
.Nm
-.Op Fl 46cLlSsUuvw
+.Op Fl 46CcLlSsUuvw
.Op Fl j Ar jid
.Op Fl p Ar ports
.Op Fl P Ar protocols
@@ -56,6 +56,9 @@
Show
.Dv AF_INET6
(IPv6) sockets.
+.It Fl C
+Display the congestion control module, if applicable.
+This is currently only implemented for TCP.
.It Fl c
Show connected sockets.
.It Fl j Ar jail
@@ -170,6 +173,10 @@
.It Li STACK
The protocol stack if
.Fl S
+is specified (only for TCP).
+.It Li CC
+The congestion control if
+.Fl C
is specified (only for TCP).
.El
.Pp
Index: head/usr.bin/sockstat/sockstat.c
===================================================================
--- head/usr.bin/sockstat/sockstat.c
+++ head/usr.bin/sockstat/sockstat.c
@@ -74,6 +74,7 @@
static int opt_4; /* Show IPv4 sockets */
static int opt_6; /* Show IPv6 sockets */
+static int opt_C; /* Show congestion control */
static int opt_c; /* Show connected sockets */
static int opt_j; /* Show specified jail */
static int opt_L; /* Don't show IPv4 or IPv6 loopback sockets */
@@ -118,6 +119,7 @@
int state;
const char *protoname;
char stack[TCP_FUNCTION_NAME_LEN_MAX];
+ char cc[TCP_CA_NAME_MAX];
struct addr *laddr;
struct addr *faddr;
struct sock *next;
@@ -716,6 +718,7 @@
sock->state = xtp->t_state;
memcpy(sock->stack, xtp->xt_stack,
TCP_FUNCTION_NAME_LEN_MAX);
+ memcpy(sock->cc, xtp->xt_cc, TCP_CA_NAME_MAX);
}
sock->protoname = protoname;
hash = (int)((uintptr_t)sock->socket % HASHSIZE);
@@ -1130,12 +1133,24 @@
}
offset += 13;
}
- if (opt_S && s->proto == IPPROTO_TCP) {
- while (pos < offset)
- pos += xprintf(" ");
- xprintf("%.*s", TCP_FUNCTION_NAME_LEN_MAX,
- s->stack);
+ if (opt_S) {
+ if (s->proto == IPPROTO_TCP) {
+ while (pos < offset)
+ pos += xprintf(" ");
+ pos += xprintf("%.*s",
+ TCP_FUNCTION_NAME_LEN_MAX,
+ s->stack);
+ }
+ offset += TCP_FUNCTION_NAME_LEN_MAX + 1;
}
+ if (opt_C) {
+ if (s->proto == IPPROTO_TCP) {
+ while (pos < offset)
+ pos += xprintf(" ");
+ xprintf("%.*s", TCP_CA_NAME_MAX, s->cc);
+ }
+ offset += TCP_CA_NAME_MAX + 1;
+ }
}
if (laddr != NULL)
laddr = laddr->next;
@@ -1170,7 +1185,10 @@
printf(" %-12s", "CONN STATE");
}
if (opt_S)
- printf(" %.*s", TCP_FUNCTION_NAME_LEN_MAX, "STACK");
+ printf(" %-*.*s", TCP_FUNCTION_NAME_LEN_MAX,
+ TCP_FUNCTION_NAME_LEN_MAX, "STACK");
+ if (opt_C)
+ printf(" %-.*s", TCP_CA_NAME_MAX, "CC");
printf("\n");
}
setpassent(1);
@@ -1286,13 +1304,16 @@
int o, i;
opt_j = -1;
- while ((o = getopt(argc, argv, "46cj:Llp:P:qSsUuvw")) != -1)
+ while ((o = getopt(argc, argv, "46Ccj:Llp:P:qSsUuvw")) != -1)
switch (o) {
case '4':
opt_4 = 1;
break;
case '6':
opt_6 = 1;
+ break;
+ case 'C':
+ opt_C = 1;
break;
case 'c':
opt_c = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 4, 9:57 AM (21 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16451607
Default Alt Text
D26413.diff (3 KB)
Attached To
Mode
D26413: Extend sockstat to display the TCP congestion control
Attached
Detach File
Event Timeline
Log In to Comment