From nobody Thu Oct 10 10:03:25 2024 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 4XPQLk0vsxz5Ymq1; Thu, 10 Oct 2024 10:03:26 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XPQLj6ZPSz4t03; Thu, 10 Oct 2024 10:03:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728554605; 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=+WNt+IcYq00owyJ7jOnOcHfdkTBzSxlu1XIAUuVNZbg=; b=FbSnLAZap+BrTbmQQ2qQ/7kRx+35aQy70lYuH4kuFN9vHNv2DGxgMaewBd5Rm1udyngk/K kiv478spgjcXWR0n6lhbn0j9G5V9FysrK5WTPtI4q6BQfk7hPFr7SbpnQx177V7Pl+Hbc0 cxdO77cpI/itThRZHKfzkYDWpMbNPDuhmeGyXjL097qCCoCwC8vBCBSq4ywehX4VBSonpW 8ClGnJQpXcV7Exh1jNhvP4752XHc49360Pw922uTk+6uCR3XUBUbMryUraEZtxtzCMR/Jd T6N9GzElbE2/CHVXfa+Q9aamh69m8zBxZZrBBH13CwaeKp7dnOMpxMDm1+y5RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728554605; 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=+WNt+IcYq00owyJ7jOnOcHfdkTBzSxlu1XIAUuVNZbg=; b=ehihCPJvx24HU5bKZdpvNPVMiPiOPSH3tW0cLwzlGw6py1hi8HfBFcMsaGvYmstAqHzfmL xaU9Iim1Ygu/CtIQdXY8G42/68HQLUJtwOjr9qr/p5p13+QG9Rt/DaO70eYQRz8berKjTu c8jErphH9T4tUwzEoNMUfT7gRVlpL45q0QEALviCTv+prHZDwthJ/DHYL0pvUTiXn7VIe2 PMIAhttgBiY3fy9IESrXQ52+5IvT80VNGYYHnzeV+qAccu3FPL2exQgD9Ulk0NRzApSQuX CyCiZdO1fcb6w3gcRB0Tmq1udxS/bp+BahCjrIOX4cNyRkS/LdnBdw1nDIbDkQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728554605; a=rsa-sha256; cv=none; b=Z2T9sIMJD+4w6QlUIrLAe8ARBdrIKguU6n7nhwRZnM5AZNyKYO5A51NkrYTpU24ERt6Wta hFkn7zbwHMDTD/EofBqjXAJBOyr7DUbYWb7ycl9zeI4v8NTsukucjh7fBACGj96gq6PoxL seRWStTn/8NMmsPGmdqg/31EuU+RYE3PzqURBxYiFa+C8BttOnVvW9S9DhuhFL5VTH7nER +Xs+j02X/Tz7QUOt8prYhXMMrdf/A9npS5lBGfYgxRMmZEyq78m1O4qdGyiBTiapnc1ET/ DqW8XIp3gKjQt1rzmvXU8ux3Q81r20olRkzAvBfYPzXciM41TYAOc7SaV4VUTw== 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 4XPQLj69w6zt5F; Thu, 10 Oct 2024 10:03:25 +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 49AA3Ph9052804; Thu, 10 Oct 2024 10:03:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49AA3PoM052801; Thu, 10 Oct 2024 10:03:25 GMT (envelope-from git) Date: Thu, 10 Oct 2024 10:03:25 GMT Message-Id: <202410101003.49AA3PoM052801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 3e46d65d5619 - stable/13 - netstat: increase width of Netif column 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3e46d65d56198760ad0a867a651dffb11fbd258d Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=3e46d65d56198760ad0a867a651dffb11fbd258d commit 3e46d65d56198760ad0a867a651dffb11fbd258d Author: Lexi Winter AuthorDate: 2024-05-08 09:44:29 +0000 Commit: Zhenlei Huang CommitDate: 2024-10-10 10:00:48 +0000 netstat: increase width of Netif column The previous width of Netif (10 or 8) was too short for modern interface names; make it 12, which is long enough to display "epair0a.1000". This came up in practice with genet(4) interfaces, since the base interface name is long enough that with the previous limit, VLAN identifiers would be truncated at 1 character in the IPv6 output: "genet0.100" becomes "genet0.1". The width is now fixed, and doesn't depend on the address family, because there's no reason that length of the interface name would vary based on the AF. PR: 266474 Reviewed by: imp,zlei,Mina Galić Pull Request: https://github.com/freebsd/freebsd-src/pull/1223 (cherry picked from commit d33b87e8cf91a6bcb5eac0ecc0371c1041c61050) netstat: for -W, use IFNAMSIZ If -W is specified, use IFNAMSIZ as the width of the Netif column, instead of the default 12. (cherry picked from commit ae9c0ba8ef2f540f9030909cf07e3c59f876fd23) (cherry picked from commit 6b86b8f0f6b6bfd5d93e45c7f584ec5bffac2a62) --- usr.bin/netstat/nhops.c | 5 ++--- usr.bin/netstat/route.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/usr.bin/netstat/nhops.c b/usr.bin/netstat/nhops.c index 19a7a6891050..c4412bc68081 100644 --- a/usr.bin/netstat/nhops.c +++ b/usr.bin/netstat/nhops.c @@ -65,16 +65,15 @@ #include "common.h" /* column widths; each followed by one space */ +#define WID_IF_DEFAULT (Wflag ? IFNAMSIZ : 12) /* width of netif column */ #ifndef INET6 #define WID_DST_DEFAULT(af) 18 /* width of destination column */ #define WID_GW_DEFAULT(af) 18 /* width of gateway column */ -#define WID_IF_DEFAULT(af) (Wflag ? 10 : 8) /* width of netif column */ #else #define WID_DST_DEFAULT(af) \ ((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18) #define WID_GW_DEFAULT(af) \ ((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18) -#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 10 : 8)) #endif /*INET6*/ static int wid_dst; static int wid_gw; @@ -416,7 +415,7 @@ print_nhops_sysctl(int fibnum, int af) wid_flags = 6; wid_pksent = 8; wid_mtu = 6; - wid_if = WID_IF_DEFAULT(fam); + wid_if = WID_IF_DEFAULT; xo_open_instance("rt-family"); pr_family(fam); xo_open_list("nh-entry"); diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c index 5c737b28df78..0a0ddc52f61f 100644 --- a/usr.bin/netstat/route.c +++ b/usr.bin/netstat/route.c @@ -183,16 +183,15 @@ pr_family(int af1) } /* column widths; each followed by one space */ +#define WID_IF_DEFAULT (Wflag ? IFNAMSIZ : 12) /* width of netif column */ #ifndef INET6 #define WID_DST_DEFAULT(af) 18 /* width of destination column */ #define WID_GW_DEFAULT(af) 18 /* width of gateway column */ -#define WID_IF_DEFAULT(af) (Wflag ? 10 : 8) /* width of netif column */ #else #define WID_DST_DEFAULT(af) \ ((af) == AF_INET6 ? (numeric_addr ? 33: 18) : 18) #define WID_GW_DEFAULT(af) \ ((af) == AF_INET6 ? (numeric_addr ? 29 : 18) : 18) -#define WID_IF_DEFAULT(af) ((af) == AF_INET6 ? 8 : (Wflag ? 10 : 8)) #endif /*INET6*/ static int wid_dst; @@ -283,7 +282,7 @@ p_rtable_sysctl(int fibnum, int af) wid_flags = 6; wid_pksent = 8; wid_mtu = 6; - wid_if = WID_IF_DEFAULT(fam); + wid_if = WID_IF_DEFAULT; wid_expire = 6; xo_open_instance("rt-family"); pr_family(fam);