Date: Thu, 05 Feb 2026 18:12:18 +0000 From: Zhenlei Huang <zlei@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Gleb Smirnoff <glebius@FreeBSD.org> Subject: git: 151dcad51394 - stable/14 - ifconfig: fix 'ifconfig -l ether' Message-ID: <6984dd82.31d4f.78d19e9b@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=151dcad51394e841f1cf3e798e5cdb4dd8131949 commit 151dcad51394e841f1cf3e798e5cdb4dd8131949 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2023-08-25 17:31:26 +0000 Commit: Zhenlei Huang <zlei@FreeBSD.org> CommitDate: 2026-02-05 18:10:35 +0000 ifconfig: fix 'ifconfig -l ether' When matching interfaces for being Ethernet, use same trick that the link module does - pass if_type through convert_iftype(). That restores historicaly behaviour of listing lagg(4) ports. Reviewed by: melifaro Differential Revision: https://reviews.freebsd.org/D41585 (cherry picked from commit 31016aa0be6dbf7556a91dda14cfe1ff0dcf933b) --- sbin/ifconfig/af_link.c | 11 ----------- sbin/ifconfig/ifconfig.h | 2 ++ sbin/ifconfig/ifconfig_netlink.c | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c index be58a22c0e66..55b75d847c16 100644 --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -160,17 +160,6 @@ pcp: } #else -static uint8_t -convert_iftype(uint8_t iftype) -{ - switch (iftype) { - case IFT_IEEE8023ADLAG: - return (IFT_ETHER); - case IFT_INFINIBANDLAG: - return (IFT_INFINIBAND); - } - return (iftype); -} static void link_status_nl(if_ctx *ctx, if_link_t *link, if_addr_t *ifa __unused) diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 1ea6c29e4ddb..672020443b8c 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -38,6 +38,7 @@ #include <libifconfig.h> #include <stdbool.h> +#include <net/if_types.h> #define __constructor __attribute__((constructor)) @@ -291,6 +292,7 @@ struct afswtch *af_getbyfamily(int af); void af_other_status(if_ctx *ctx); void print_ifstatus(if_ctx *ctx); void print_metric(if_ctx *ctx); +ifType convert_iftype(ifType iftype); /* Netlink-related functions */ void list_interfaces_nl(struct ifconfig_args *args); diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c index 0ec63e3a0b99..aadd7d1096c3 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -203,6 +203,19 @@ if_nametoindex_nl(struct snl_state *ss, const char *ifname) return (link.ifi_index); } +ifType +convert_iftype(ifType iftype) +{ + switch (iftype) { + case IFT_IEEE8023ADLAG: + return (IFT_ETHER); + case IFT_INFINIBANDLAG: + return (IFT_INFINIBAND); + default: + return (iftype); + } +} + static void prepare_ifaddrs(struct snl_state *ss, struct ifmap *ifmap) { @@ -261,7 +274,7 @@ match_iface(struct ifconfig_args *args, struct iface *iface) struct sockaddr_dl sdl = { .sdl_len = sizeof(struct sockaddr_dl), .sdl_family = AF_LINK, - .sdl_type = link->ifi_type, + .sdl_type = convert_iftype(link->ifi_type), .sdl_alen = NLA_DATA_LEN(link->ifla_address), }; return (match_ether(&sdl));home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6984dd82.31d4f.78d19e9b>
