mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 02:37:15 +00:00
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
This commit is contained in:
parent
24a81a968d
commit
31016aa0be
|
@ -165,17 +165,6 @@ link_status(if_ctx *ctx, const struct ifaddrs *ifa)
|
|||
}
|
||||
|
||||
#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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue