From nobody Thu Oct 9 20:37:56 2025 X-Original-To: dev-commits-src-all@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 4cjMBt5t72z6C5lw; Thu, 09 Oct 2025 20:37:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cjMBt5BMzz3YpK; Thu, 09 Oct 2025 20:37:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760042278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i8I5VUdzlffGjITZ/CdwgQg8tPsPRdi+HqJTl9K1+Kw=; b=HFf2PzIu8CuY/bP7I6PDuV5XAQuhxbysnhQQofWnAjr+Ri6/kJvQToG3nmCdIBGjFDFN87 XQFuvWigmwvG2SPJnpp4S3EhOde9htp3TxqXKPcTWdLp+bMNQtiAKtD8RVACCrAnxeGGMc 1IIE3SLu3413TKhKyEPjgHwFPK3b6a7+CGdZXPbWIjxjtZJKw8uFFG0p3pOU3huQ9OnzNk rnfTa6pXi7SgokU1784pACdXFGDpqG2QzJ7at6de/u6BgR25d95+F27QndKUGkrCr/ORVa AEkNaehj/DwEmFwUWmpVWD1a3YE2PWSw8fZJOZw0b3YF2WCAW8Fg3UtsWBP7vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760042278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i8I5VUdzlffGjITZ/CdwgQg8tPsPRdi+HqJTl9K1+Kw=; b=Kof38SCZhyArPk+zH2IPHfv5oThbv31d2akjPLi3Dk+X2Ed36PHLq8TPbdb8pOMj6AUc5l ucn23GEpYSTQ4DxTANbvwvimKrkK8SNtyADzq7pECGJ477fbURjoqpNo44nSfKxmYY+KQK j8xKntlf4fXPE5rHc2qlwgCZjR76jY+u6XtlDRUCwEbhCIGqgu83UWCAEIBaZmsBgIn6zZ ePWe3IMAx91ehSkQPBBeTFxA0GsHYIfS0ybWKrWpEhPi102fLwjSmfV4CVQZ2AJc0kEIkZ 01c2C6L+OjUhFPoAc7zaqge2/n4fgwZZ4uDexA3UD4PbrjfTGC7t9E7AoGGL4g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760042278; a=rsa-sha256; cv=none; b=wfZUYPw1+mguLp6rAHLYJ3OgnlOljXHsxvEOAn/zGD3X8lrSD0PXDmaLQQVoGQmZmVHVFE MXKQ6Ga88Zqx0DIyX1GHAZ3eafi8m/rDRFEPv2bqQ+RUHVVZKGj3yIxmg4eBfDKHAP0HkF U7+MiCPL/SyU/4HdGsj0+6GNaFDV39uBicdzQRB6lbaeYq1LWZ+KobAJpXrdfM5IJ67/iU m9eLq6kdJoR3uzrSYh73SJNSc5nZCTOfgUyOLXpJD4kHjQyUIzV7Stmm0nw5hSXY9Zas59 9XIJfTAhlUwjXfmEXag8S9bvcu9HSiq3tmLft/IkVErz23qbh+/7U9xPkuU4Mg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from smtpclient.apple (unknown [IPv6:2a02:8109:1101:be00:cdd8:d234:59ae:b639]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: tuexen) by smtp.freebsd.org (Postfix) with ESMTPSA id 4cjMBt0s8QzKHm; Thu, 09 Oct 2025 20:37:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.100.1.1.5\)) Subject: Re: git: 746eadecaa7d - main - sockstat: show path state column only when useful From: Michael Tuexen In-Reply-To: Date: Thu, 9 Oct 2025 22:37:56 +0200 Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2B20483E-F15A-4BEA-AEE5-6490A94AC8B0@FreeBSD.org> References: <202510091919.599JJ5dd028526@gitrepo.freebsd.org> <995AAC96-FFE6-4D25-90C5-1BE9B6BF3729@FreeBSD.org> To: Alan Somers X-Mailer: Apple Mail (2.3864.100.1.1.5) > On 9. Oct 2025, at 22:25, Alan Somers wrote: >=20 > On Thu, Oct 9, 2025 at 2:22=E2=80=AFPM Michael Tuexen = wrote: > > On 9. Oct 2025, at 22:01, Alan Somers wrote: > >=20 > > It looks like this change will cause sockstat to skip output path = state even in JSON output mode. Is that deliberate? I would think that = it would be better for machine-readable formats if the output were = predictable. > I haven't used it in that setup. So you would prefer to only drop the = column > when generating plain text? >=20 > Yes What about HTML? Wondering if I could base the display of the column on is_xo_style_encoding. > > Also, the English in the man page is awkward. I think you mean = "at least one path to show". > Would "at least one path state to show" be acceptable? >=20 > Yes, that would be good. Will fix it in combination with the above issue. Best regards Michael > Best regards > Michael > >=20 > > On Thu, Oct 9, 2025 at 1:19=E2=80=AFPM Michael Tuexen = wrote: > > The branch main has been updated by tuexen: > >=20 > > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D746eadecaa7dc8913721cbaa9be4e603= bd36ea49 > >=20 > > commit 746eadecaa7dc8913721cbaa9be4e603bd36ea49 > > Author: Michael Tuexen > > AuthorDate: 2025-10-09 19:16:38 +0000 > > Commit: Michael Tuexen > > CommitDate: 2025-10-09 19:16:38 +0000 > >=20 > > sockstat: show path state column only when useful > >=20 > > 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. > >=20 > > Reviewed by: rrs > > MFC after: 3 days > > Sponsored by: Netflix, Inc. > > Differential Revision: https://reviews.freebsd.org/D52986 > > --- > > usr.bin/sockstat/main.c | 8 ++++++-- > > usr.bin/sockstat/sockstat.1 | 3 ++- > > 2 files changed, 8 insertions(+), 3 deletions(-) > >=20 > > 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 =3D false; > >=20 > > /* > > * 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 =3D 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 !=3D NULL && > > s->proto =3D=3D IPPROTO_SCTP && > > s->state !=3D 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 >=20