diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c index be58a22c0e6..55b75d847c1 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 1ea6c29e4dd..672020443b8 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -38,6 +38,7 @@ #include #include +#include #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 0ec63e3a0b9..aadd7d1096c 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));