diff options
| author | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-14 06:39:37 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-14 06:48:43 +0000 |
| commit | 97e858f5b335ae8f98619f9cee8ab9a0501cd06d (patch) | |
| tree | 5a8bed22ec2d5b4180ef1957e694434634316667 | |
| parent | ad13fd5a8fa1607805d11ced3428e86dbd94778e (diff) | |
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")
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D53005
| -rw-r--r-- | usr.bin/sockstat/main.c | 8 | ||||
| -rw-r--r-- | 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 |
