From nobody Thu Oct 9 21:32:15 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 4cjNPY6cp0z6C9HJ; Thu, 09 Oct 2025 21:32:17 +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 4cjNPY5zLRz3k77; Thu, 09 Oct 2025 21:32:17 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760045537; 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=uQBDBjvTsXh48G5Dd87JaXtKpy0+wjYcl/m0syo0lHg=; b=ry9PHt+eJoTDFEtvm8aOLZWF6fpSVCLNDL3qL8ktiZeX0elBJgauPdK8PIVnmfSj2F9eZe dW/rU9P+PTreoowh/cAqHjDDUyXB6YFvOn2atNYEDq47kVSYgPhNXjbj8Pza69sZciMfoZ 8SnmYyMAlHQAIMCfB9JxX0kJAaK4gACNJnmm21tAG6BrqaGd/Y+KM6LdCwBgZNes+hasKs ptuIFgVQ4Svw9nxck//MS9BX/0jf42LOdp9x8p94ufazKzTvnHaf1Hx24V6xzQlEuLCJA5 8Mos8mvtCAX1dwqJuWh6ZR7QakM2Bdc9V7ST4HOhBuAQ3lPNqQALnesVNBeFkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760045537; 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=uQBDBjvTsXh48G5Dd87JaXtKpy0+wjYcl/m0syo0lHg=; b=ASzSrZyLaj1MwXiQ62P2TLFYA+9JJgDb8x0QiZFjYuqan65oaZcoHLCVcwqthoUu7i7Aen RImwgFLEi4uUdbNkl77+B8jbXdIj9kSQoDGMWqCzV5vZsBbQsIfByS11rVGwNwiu2+n7+M JVF9nIIw2hiYMEsbX15VLSVtpot+CAWbDcKp31dsL+L6nGf048odrVsp61W1zo0mZfzdLM qJBtv9Iew73PewULs6olDAXheW3mXKG14rrn9FindTKWIs9dfhhwXSOaM9OA6sMutrZCVe 3DRGtXLSq7X3BvDzKWuwO0nsBw9J266eiqGjakD0/BBWR3A2KQoy8OKjk3LlYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760045537; a=rsa-sha256; cv=none; b=bOplQl95si1Ynnh6sWu77Yp/JVuQ5lj7xMhj2tO0k3hO1C5t1s7bOgGRNoDKUFQKrk9azH gHcQ9cF9BH9upV4akILpPk3AZpzVppxgLyJKZADtPV6awPAwfsHESPy+hLng6ZWLo4/0jM uw3PUianaE+LIChGoCCo6J0TT81ItqkHGEPpARBDdmbo9sXCe+UV9FisbqFZrgrzOfbrsE 9M3+piip5uGNXVAuGgKCGkWFlgU3v+mv95lv9KIv+5dE0Bf8rZKe1Q5PaG1EKSGYyKp0Lk BMWO5VPZjsZ1jWsYyK5FUU2wtyW/c9QfSe0mUD+Lz3VfZMSXzos9Kzqfj4pOog== 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 4cjNPY17SSzNKd; Thu, 09 Oct 2025 21:32:17 +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 23:32:15 +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: References: <202510091919.599JJ5dd028526@gitrepo.freebsd.org> <995AAC96-FFE6-4D25-90C5-1BE9B6BF3729@FreeBSD.org> <2B20483E-F15A-4BEA-AEE5-6490A94AC8B0@FreeBSD.org> To: Alan Somers X-Mailer: Apple Mail (2.3864.100.1.1.5) > On 9. Oct 2025, at 22:39, Alan Somers wrote: >=20 > On Thu, Oct 9, 2025 at 2:38=E2=80=AFPM Michael Tuexen = wrote: > > 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. >=20 > I would think that HTML should behave like JSON, since it's used for = creating tables. I think https://reviews.freebsd.org/D53005 should address your comments. Thanks for the feedback! Best regards Michael > > > 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. >=20 > 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 >=20