From nobody Fri Oct 31 19:08:18 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 4cyr9H2hdXz6Dnlx; Fri, 31 Oct 2025 19:08:19 +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 4cyr9H0BF4z4DW0; Fri, 31 Oct 2025 19:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761937699; 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=xUKihVkk/+Mt8u3Ud5KQY6nt/zObzQRPNFQ4lkKd6XI=; b=Z3KzGuxaibDCEQlbq/y//zt9G9dSVYGdp++Wkxcv1CjjYVEz2rFaoxIN0yUkRimb3grYWX 1rw7Gqiw1uY9hjg978Ji8+QVaimgfgDqhjqZS//ZnewqreFfExM7FIXxPrEx7F1AUWG6hp +LoEKMky03ttuzo4Vq9F57UAV6jinfbad9Bx1vUqnXzMBn/sE4yx3D8bMECJ9YtXLOa9XA S/I/qHZzu03eL2Vcu55GaaIO6MX6jQrGz1a2tKSomtWTMnOTHBq/EpG0UURDYUAhztEAlc Puy9WH+JsDZzswOFipo+gOm2BMKUWNLfINppQiQCRAwB62kCn4ut90R679vlEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1761937699; 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=xUKihVkk/+Mt8u3Ud5KQY6nt/zObzQRPNFQ4lkKd6XI=; b=VyjMCWubiKL3CpD/Lqqk+tHNROvaVi8BO6E1vHkDe55DhYbR6iZQK61o7Wnn+n8UodQJT0 yAc1iq2JgLAkopnXNLSdLhD5ADEi4lrVl/Y751F88TLoiK2vtAfKwtxMMK2yaM+Kb75IYk 9e5LUcujcPek2sZ3L7gOFPQMXNErMMI8o1DAgIcxfPNreJnYlzIxuosI0JnY+pUxdz4xag 5LDB62FKpYdLSGzfHq3ir46k3z+9bKcEE8c03NG9G/suv56Q8PHehQ+PBd/hpKMptOKPUQ kzB7Be2b3JqsCSowKZwkz3Vw7b5WAn+J58+0U66P82c4zGHIFXhlRg+VDiK7OQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1761937699; a=rsa-sha256; cv=none; b=K+vSKdGCcIiemy0HTy+WQ9Z6T+ypN26/AT3T0fvOvOdpcWU4DePYvcxxXS0moXBerZHCIc N6qaCpjsRJEIovBr5alSiHwmTdQYe4uKDNHTYonn85UsZdxZv1aypBfewCJRb/MOp1lUir RexPgsEM/I2RXmu4vkY2Z8XTETXEtSmmBhk5xl1GjFXlmsmo+/aDfTe4wyP1JQBkZo4Krr S1mIB50mJboPzHK1E3Dt6XzON8WtkoVgi34mHWGEiUh+QF0zH7Sn1MGdWLbI63tL7MrkQ9 DQbaS2NQ/H8DEoN/tQUfoGijYpo//BE50rywa99xOK8nrP6p9dbEFtxQyBO3og== 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 4cyr9G6px6z1KVq; Fri, 31 Oct 2025 19:08:18 +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 59VJ8IZ8062442; Fri, 31 Oct 2025 19:08:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 59VJ8Inu062439; Fri, 31 Oct 2025 19:08:18 GMT (envelope-from git) Date: Fri, 31 Oct 2025 19:08:18 GMT Message-Id: <202510311908.59VJ8Inu062439@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: a0b91ae49c19 - stable/14 - netstat: add support for UDP-Lite endpoints 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/14 X-Git-Reftype: branch X-Git-Commit: a0b91ae49c190d2976b2b5f0b41177b4e5da30ff Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=a0b91ae49c190d2976b2b5f0b41177b4e5da30ff commit a0b91ae49c190d2976b2b5f0b41177b4e5da30ff Author: Michael Tuexen AuthorDate: 2025-10-23 07:15:22 +0000 Commit: Michael Tuexen CommitDate: 2025-10-31 14:05:57 +0000 netstat: add support for UDP-Lite endpoints With this patch UDP-Lite endpoints are also shown per default. Reviewed by: Nick Banks Differential Revision: https://reviews.freebsd.org/D53252 (cherry picked from commit c2b08c13c20d44c3368bcbf738624e5fac461314) --- usr.bin/netstat/inet.c | 37 ++++++++++++++++++++++++++----------- usr.bin/netstat/main.c | 4 ++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 363224d5f913..898158ce288a 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -90,7 +90,7 @@ static void inetprint(const char *, struct in_addr *, int, const char *, int, const int); #endif #ifdef INET6 -static int udp_done, tcp_done, sdp_done; +static int udp_done, udplite_done, tcp_done, sdp_done; #endif /* INET6 */ static int @@ -107,6 +107,9 @@ pcblist_sysctl(int proto, const char *name, char **bufp) case IPPROTO_UDP: mibvar = "net.inet.udp.pcblist"; break; + case IPPROTO_UDPLITE: + mibvar = "net.inet.udplite.pcblist"; + break; default: mibvar = "net.inet.raw.pcblist"; break; @@ -227,13 +230,20 @@ protopr(u_long off, const char *name, int af1, int proto) return; else udp_done = 1; +#endif + break; + case IPPROTO_UDPLITE: +#ifdef INET6 + if (udplite_done != 0) + return; + else + udplite_done = 1; #endif break; } if (!pcblist_sysctl(proto, name, &buf)) return; - if (istcp && (cflag || Cflag)) { fnamelen = strlen("Stack"); cnamelen = strlen("CC"); @@ -325,18 +335,18 @@ protopr(u_long off, const char *name, int af1, int proto) "Proto", "Listen", "Local Address"); else if (Tflag) xo_emit((Aflag && !Wflag) ? - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%s}" : + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%s}" : ((!Wflag || af1 == AF_INET) ? - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%s}" : - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"), + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%s}" : + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%s}"), "Proto", "Rexmit", "OOORcv", "0-win", "Local Address", "Foreign Address"); else { xo_emit((Aflag && !Wflag) ? - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" : + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-18.18s} {T:/%-18.18s}" : ((!Wflag || af1 == AF_INET) ? - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" : - "{T:/%-5.5s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"), + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-22.22s} {T:/%-22.22s}" : + "{T:/%-9.9s} {T:/%-6.6s} {T:/%-6.6s} {T:/%-45.45s} {T:/%-45.45s}"), "Proto", "Recv-Q", "Send-Q", "Local Address", "Foreign Address"); if (!xflag && !Rflag) @@ -389,9 +399,14 @@ protopr(u_long off, const char *name, int af1, int proto) vchar = ((inp->inp_vflag & INP_IPV4) != 0) ? "4" : ""; if (istcp && (tp->t_flags & TF_TOE) != 0) - xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", "toe", vchar); - else - xo_emit("{:protocol/%-3.3s%-2.2s/%s%s} ", name, vchar); + xo_emit("{:protocol/%-3.3s%-6.6s/%s%s} ", "toe", vchar); + else { + int len; + + len = max (2, 9 - strlen(name)); + xo_emit("{:protocol/%.7s%-*.*s/%s%s} ", name, len, len, + vchar); + } if (Lflag) { char buf1[33]; diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c index 481284cb88a6..a60d951c8d39 100644 --- a/usr.bin/netstat/main.c +++ b/usr.bin/netstat/main.c @@ -96,6 +96,8 @@ static struct protox { tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, { -1 , N_UDPSTAT, 1, protopr, udp_stats, NULL, "udp", 1, IPPROTO_UDP }, + { -1, -1, 1, protopr, + NULL, NULL, "udplite", 1, IPPROTO_UDPLITE }, #ifdef SCTP { -1, N_SCTPSTAT, 1, sctp_protopr, sctp_stats, NULL, "sctp", 1, IPPROTO_SCTP }, @@ -142,6 +144,8 @@ static struct protox ip6protox[] = { tcp_stats, NULL, "tcp", 1, IPPROTO_TCP }, { -1 , N_UDPSTAT, 1, protopr, udp_stats, NULL, "udp", 1, IPPROTO_UDP }, + { -1, -1, 1, protopr, + NULL, NULL, "udplite", 1, IPPROTO_UDPLITE }, { -1 , N_IP6STAT, 1, protopr, ip6_stats, ip6_ifstats, "ip6", 1, IPPROTO_RAW }, { -1 , N_ICMP6STAT, 1, protopr,