git: 23cda744e4da - stable/14 - sockstat: add support for UDP-Lite endpoints

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 31 Oct 2025 19:04:34 UTC
The branch stable/14 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=23cda744e4dae48ee3857f33158e30d241868d2a

commit 23cda744e4dae48ee3857f33158e30d241868d2a
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2025-10-23 07:12:32 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2025-10-31 14:04:01 +0000

    sockstat: add support for UDP-Lite endpoints
    
    With this patch UDP-Lite endpoints are also show per default.
    
    Reviewed by:            Peter Lei, Nick Banks
    Relnotes:               yes
    Differential Revision:  https://reviews.freebsd.org/D53230
    
    (cherry picked from commit f48c6390dd5a01ab2b33f26ee50f4e8cbe8ae737)
---
 usr.bin/sockstat/sockstat.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index afb635179d82..587647e5950f 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -104,7 +104,8 @@ static bool	 show_path_state = false;
 /*
  * Default protocols to use if no -P was defined.
  */
-static const char *default_protos[] = {"sctp", "tcp", "udp", "divert" };
+static const char *default_protos[] = {"sctp", "tcp", "udp", "udplite",
+    "divert" };
 static size_t	   default_numprotos = nitems(default_protos);
 
 static int	*protos;	/* protocols to use */
@@ -686,6 +687,10 @@ gather_inet(int proto)
 		varname = "net.inet.udp.pcblist";
 		protoname = "udp";
 		break;
+	case IPPROTO_UDPLITE:
+		varname = "net.inet.udplite.pcblist";
+		protoname = "udplite";
+		break;
 	case IPPROTO_DIVERT:
 		varname = "net.inet.divert.pcblist";
 		protoname = "div";
@@ -734,6 +739,7 @@ gather_inet(int proto)
 			protoname = xtp->t_flags & TF_TOE ? "toe" : "tcp";
 			break;
 		case IPPROTO_UDP:
+		case IPPROTO_UDPLITE:
 		case IPPROTO_DIVERT:
 			xip = (struct xinpcb *)xig;
 			if (!check_ksize(xip->xi_len, struct xinpcb))
@@ -1161,7 +1167,7 @@ displaysock(struct sock *s, int pos)
 	faddr = s->faddr;
 	first = 1;
 	while (laddr != NULL || faddr != NULL) {
-		offset = 37;
+		offset = 40;
 		while (pos < offset)
 			pos += xprintf(" ");
 		switch (s->family) {
@@ -1389,7 +1395,7 @@ display(void)
 	int n, pos;
 
 	if (opt_q != 1) {
-		printf("%-8s %-10s %-5s %-3s %-6s %-*s %-*s",
+		printf("%-8s %-10s %-5s %-3s %-9s %-*s %-*s",
 		    "USER", "COMMAND", "PID", "FD", "PROTO",
 		    opt_w ? 45 : 21, "LOCAL ADDRESS",
 		    opt_w ? 45 : 21, "FOREIGN ADDRESS");