1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00

ifconfig: fix 'ifconfig -l link'

The rtnetlink(4) RTM_GETADDR does not list link level addresses, thus
the correct match for interfaces that have a link level address should
be based on what was returned by RTM_GETLINK.

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D41586
This commit is contained in:
Gleb Smirnoff 2023-08-25 10:31:55 -07:00
parent 31016aa0be
commit 6f3947be2a

View File

@ -299,7 +299,13 @@ match_iface(struct ifconfig_args *args, struct iface *iface)
.sdl_alen = NLA_DATA_LEN(link->ifla_address),
};
return (match_ether(&sdl));
}
} else if (args->afp->af_af == AF_LINK)
/*
* The rtnetlink(4) RTM_GETADDR does not list link level
* addresses, so latter cycle won't match anything. Short
* circuit on RTM_GETLINK has provided us an address.
*/
return (link->ifla_address != NULL);
for (struct ifa *ifa = iface->ifa; ifa != NULL; ifa = ifa->next) {
if (args->afp->af_af == ifa->addr.ifa_family)