git: f6923c0a68a6 - stable/15 - sockstat: improve handling of path state
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 17 Oct 2025 05:47:37 UTC
The branch stable/15 has been updated by tuexen:
URL: https://cgit.FreeBSD.org/src/commit/?id=f6923c0a68a67d69762e188273f0e87f231ec964
commit f6923c0a68a67d69762e188273f0e87f231ec964
Author: Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-10-14 06:39:37 +0000
Commit: Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-10-17 05:46:53 +0000
sockstat: improve handling of path state
Only suppress the path state column when producing traditional text
output. When generating html output, always include the column.
Please note that when generating json or xml output, optional fields
like the path state are only generated if they is applicable. This
has not been changed.
The changes in this patch were suggested by asomers.
Reviewed by: asomers
Fixes: 746eadecaa7d ("sockstat: show path state column only when useful")
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D53005
(cherry picked from commit 97e858f5b335ae8f98619f9cee8ab9a0501cd06d)
---
usr.bin/sockstat/main.c | 8 +++++---
usr.bin/sockstat/sockstat.1 | 5 +++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c
index 7fedfd5b8724..d1ea6b1bc958 100644
--- a/usr.bin/sockstat/main.c
+++ b/usr.bin/sockstat/main.c
@@ -1789,9 +1789,11 @@ main(int argc, char *argv[])
argc = xo_parse_args(argc, argv);
if (argc < 0)
exit(1);
- if (xo_get_style(NULL) != XO_STYLE_TEXT &&
- xo_get_style(NULL) != XO_STYLE_HTML)
- is_xo_style_encoding = true;
+ if (xo_get_style(NULL) != XO_STYLE_TEXT) {
+ show_path_state = true;
+ if (xo_get_style(NULL) != XO_STYLE_HTML)
+ is_xo_style_encoding = true;
+ }
opt_j = -1;
while ((o = getopt(argc, argv, "46AbCcfIij:Llnp:P:qSsUuvw")) != -1)
switch (o) {
diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1
index d14eb967ad0f..1498fb1d88f7 100644
--- 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 October 9, 2025
+.Dd October 14, 2025
.Dt SOCKSTAT 1
.Os
.Sh NAME
@@ -205,7 +205,8 @@ is specified (only for SCTP or TCP).
The path state if
.Fl s
is specified (only for SCTP).
-This column is only shown when there is at least one path state shown.
+When using traditional text output, this column is only shown when there is at
+least one path state to show.
.It Li CONN STATE
The connection state if
.Fl s