aboutsummaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2023-08-25 17:31:26 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2023-08-25 17:31:26 +0000
commit31016aa0be6dbf7556a91dda14cfe1ff0dcf933b (patch)
tree4f113432997bffe88e55fb3caf258d6f3f0de772 /sbin/ifconfig
parent24a81a968d21b3eef1a0a2d786859b274546bd34 (diff)
downloadsrc-31016aa0be6dbf7556a91dda14cfe1ff0dcf933b.tar.gz
src-31016aa0be6dbf7556a91dda14cfe1ff0dcf933b.zip
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/af_link.c11
-rw-r--r--sbin/ifconfig/ifconfig.h2
-rw-r--r--sbin/ifconfig/ifconfig_netlink.c15
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 <libifconfig.h>
#include <stdbool.h>
+#include <net/if_types.h>
#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));