From nobody Fri Oct 17 05:47:35 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cnv3r1hfXz6Cfrm; Fri, 17 Oct 2025 05:47:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cnv3r10nKz3SYh; Fri, 17 Oct 2025 05:47:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760680056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gJeN9jxm5OPEl7+a3cSa0ojqJfC2+thZVk+WmMOM4v4=; b=UOOfbUOvHLj8/kVvDGkDiNrCcL8Apib67gXCfR0bSNinhI1Psumn8zd7KVp0YekX2+0E4V YkzlF60ktfhJvraARR8QlgH2Un/JvgM0cJz1Kqa36GoJ2jLuBovFxXMiFvUCI00s2W+9ta thHfPK5/7keL8i7rjjohZV+y+EtOPv23UQfFZ+hbaq1s9Kgi29bB7OWBwPZh7/4YYijQeT GBX9DGh8xNag68J6CFW0eMD2Uz9DRbLYNj8BVS3b2/YBlFagwbpyGOZV28ZH3lMIzieruY jSlhcKeVkslcqArIov2D2FqS237ojud95PhKgnwPLXVORkUIIZ33ScEB6PbHPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760680056; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gJeN9jxm5OPEl7+a3cSa0ojqJfC2+thZVk+WmMOM4v4=; b=JzwVxN+ulB3DOsmSlzMwS78CwXPxp3q7e8HsTe/yngcJxySp3XK/nPxuECoPbLEy7xlP5S d+hXY+0HP1pb7XMvXl6/OqefASlZ4XOhkdAJPmuWYyFNoUP5lce8IQtiqZHsvOxX4ajV2t pKxhonexeSXY64L0T0htoOkBazW0EVo6ikPfojPpE5JZzWmeDPoTGXQHuC0Ter+PZKT+zl Xpkw1Ae+7tSNobDuzZHYboJqID2HIYTdq6bLJ/7gbrxBOJVIsO0HuETnqrw0/k68G1L2bW WbXXOl9hu5oKrJVqP6QniqTtb+EsfwilFN/FZTOZPxodKfdqeM4l4/x+XLAwKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760680056; a=rsa-sha256; cv=none; b=rF4uJ4UIJ3ijtz+/TTLmdyCk6uanfBylVNCOJdyoQ46QRaiQ5Uj3t4pw7YDnOo8nIwaJyg QsU1Bfko9LQiNCGKiAhIdT4hBMIHhkGaz/SsCeJ33vz6eqj4c6oCj6F3n4ti39zJNUscvi KVNS9E28RLigYzlJtJkJE5xPzbEW1wHbr6Ruz+eyJdCROumo2ohu0u1Ctt56Gcq4Qchhex 1vBrA9QCbp0Xx90OuOeHLw+uMK3LNNO5so7FdZUhgCN8OhrzduMrL5L7jD6GHtqecGKUMy 6+bercl9QIxhyuzU445j3PizyXZHygPhyo9irZRh5ZGfMooCVW4kFtOxNYjeyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cnv3r0VGmzhb8; Fri, 17 Oct 2025 05:47:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 59H5lZHl010279; Fri, 17 Oct 2025 05:47:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59H5lZwQ010277; Fri, 17 Oct 2025 05:47:35 GMT (envelope-from git) Date: Fri, 17 Oct 2025 05:47:35 GMT Message-Id: <202510170547.59H5lZwQ010277@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 9a0a114b7f10 - stable/15 - sockstat: show path state column only when useful List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 9a0a114b7f10c9510f6e2d4e5d1c5e40218f383b Auto-Submitted: auto-generated The branch stable/15 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=9a0a114b7f10c9510f6e2d4e5d1c5e40218f383b commit 9a0a114b7f10c9510f6e2d4e5d1c5e40218f383b Author: Michael Tuexen AuthorDate: 2025-10-09 19:16:38 +0000 Commit: Michael Tuexen CommitDate: 2025-10-17 05:46:23 +0000 sockstat: show path state column only when useful Showing the path state column is only useful, if there is at least one SCTP endpoint shown, which is not in the state CLOSED or LISTEN. Don't show it when it is not useful. Reviewed by: rrs Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D52986 (cherry picked from commit 746eadecaa7dc8913721cbaa9be4e603bd36ea49) --- usr.bin/sockstat/main.c | 8 ++++++-- usr.bin/sockstat/sockstat.1 | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/usr.bin/sockstat/main.c b/usr.bin/sockstat/main.c index f0eb83eb3e9f..7fedfd5b8724 100644 --- a/usr.bin/sockstat/main.c +++ b/usr.bin/sockstat/main.c @@ -103,6 +103,7 @@ static bool opt_u; /* Show Unix domain sockets */ static u_int opt_v; /* Verbose mode */ static bool opt_w; /* Automatically size the columns */ static bool is_xo_style_encoding; +static bool show_path_state = false; /* * Default protocols to use if no -P was defined. @@ -584,6 +585,7 @@ gather_sctp(void) !(local_all_loopback || foreign_all_loopback))) { RB_INSERT(socks_t, &socks, sock); + show_path_state = true; } else { free_socket(sock); } @@ -1485,7 +1487,7 @@ display_sock(struct sock *s, struct col_widths *cw, char *buf, size_t bufsize) } else if (!is_xo_style_encoding) xo_emit(" {:encaps/%*s}", cw->encaps, "??"); } - if (opt_s) { + if (opt_s && show_path_state) { if (faddr != NULL && s->proto == IPPROTO_SCTP && s->state != SCTP_CLOSED && @@ -1632,7 +1634,9 @@ display(void) if (opt_U) xo_emit(" {T:/%*s}", cw.encaps, "ENCAPS"); if (opt_s) { - xo_emit(" {T:/%-*s}", cw.path_state, "PATH STATE"); + if (show_path_state) + xo_emit(" {T:/%-*s}", cw.path_state, + "PATH STATE"); xo_emit(" {T:/%-*s}", cw.conn_state, "CONN STATE"); } if (opt_b) diff --git a/usr.bin/sockstat/sockstat.1 b/usr.bin/sockstat/sockstat.1 index dabb3042bfd4..d14eb967ad0f 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 7, 2025 +.Dd October 9, 2025 .Dt SOCKSTAT 1 .Os .Sh NAME @@ -205,6 +205,7 @@ 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. .It Li CONN STATE The connection state if .Fl s