From nobody Fri Aug 25 17:33:20 2023 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 4RXRr06tK4z4qZBq; Fri, 25 Aug 2023 17:33:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RXRr02XFhz3CXR; Fri, 25 Aug 2023 17:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692984800; 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=f+Fkm9HagWTRNhF7wrJtdm18waYkpybjWiCG7F6cUl8=; b=jIb1RUv8mYfOLbV6Bqg3o3EQTcyy+NfHL8dhXgpJcdYPAL5NMKqOB/Zo6Bcw5KMdNllIws 3GDjYBnyEzJI2Jn2i2aBZy6MkZZu9pIe8ZG05YUxSFDLpdSPHK47qsrGtj6ls55sWEgIz6 KNqSR/6XsGpqR9aorElAW+Lc3TgFs/s1U7MZnpBchTibBx2pQBxMGw/p8v82p9DI2+Whzu P2Udc6jQ6QqcQ27gCtj9LT4hxXpG7rSE1q90FDDxxp4LBBn29bzIhJUf4ELneWrtg8oXXN WNitQSKvQvDYBXcfhQ6avtf8/+HCCt2WP8FKcoh9Jmvuy+rDoiJrNEj28tjPCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692984800; 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=f+Fkm9HagWTRNhF7wrJtdm18waYkpybjWiCG7F6cUl8=; b=KM1+7cuwBjYNpnVfHKY7wOAnaJV/0vchwoJrjIUKX4OyVcfCJxjF9nvv5GBweqp7rVu4xd taJ1VvYjq6Ep8C+UgIK9darwAcc91zWBMHxcoDAi2o4qZ9Y48dhyYUGiEYFef2n03ku6uh Y2ba9fjUlsANbD/icDxuULs0XpDxojE6Z/kBbBum33AaOSy9uDpqHMzBUzWNz8PW4Q1eVU 8P29HjpO8D3vLFYKEQyeV2RjZh5x82Pt+CuFCv99DlCJbHYx3PZo24UbUSu/M2EqwHXTPQ Kd9itz30JygZFFZocwJuGoX245q/qJAr8MeXGYsqpLXz7gnlcLrj3zIpImG84g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692984800; a=rsa-sha256; cv=none; b=bwEwhpnUhxbs8AG7Cu0/az7ItmAcSlzEwKnPebmksR3+Fca0zKlZC0NeYkKBP193QxfdKf ox1HIhzmW8z5LVKHapG+2xB/2xZGSbDEM+aX/M19SVH2YP/NtYjw6BP8G3YBcyn2yL8M7v TGWRqeWzmHDTG5WCMy6PwYyRYuP+O26x18FI6dQvUBqSdh0aewzwVduwtDte7/fQRetTg1 ptBLiWKF28+FX5R68ZO8f9NGD7ZueonuUw4R7p/0iStsMcli9qk+qJW9AuLkk1i1Hik4Uq hdIuJuhuckFWgJmh/H4FA9GiQ9WBI4PZMHja8IhLc0oNpjonDRKwFJXUyZiM+Q== 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 4RXRr017gGz1GtQ; Fri, 25 Aug 2023 17:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37PHXKbI099390; Fri, 25 Aug 2023 17:33:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37PHXKqw099386; Fri, 25 Aug 2023 17:33:20 GMT (envelope-from git) Date: Fri, 25 Aug 2023 17:33:20 GMT Message-Id: <202308251733.37PHXKqw099386@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 31016aa0be6d - main - ifconfig: fix 'ifconfig -l ether' 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 31016aa0be6dbf7556a91dda14cfe1ff0dcf933b Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=31016aa0be6dbf7556a91dda14cfe1ff0dcf933b commit 31016aa0be6dbf7556a91dda14cfe1ff0dcf933b Author: Gleb Smirnoff AuthorDate: 2023-08-25 17:31:26 +0000 Commit: Gleb Smirnoff CommitDate: 2023-08-25 17:31:26 +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 --- 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 17de87539d9a..2a53daeb7d01 100644 --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -165,17 +165,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 80e6b9bc2289..3303c4894ba7 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -38,6 +38,7 @@ #include #include +#include #define __constructor __attribute__((constructor)) @@ -279,6 +280,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 76dd99307f31..c3e8cd413409 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -224,6 +224,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) { @@ -282,7 +295,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));