The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=52ebb8a7d4f8c77b9dacdeef1dff3caec1394bea
commit 52ebb8a7d4f8c77b9dacdeef1dff3caec1394bea Author: Gleb Smirnoff <[email protected]> AuthorDate: 2023-08-25 17:31:55 +0000 Commit: Zhenlei Huang <[email protected]> CommitDate: 2026-02-05 18:10:36 +0000 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 (cherry picked from commit 6f3947be2aff9350514b5a414104d0afaeb53cdf) --- sbin/ifconfig/ifconfig_netlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifconfig_netlink.c b/sbin/ifconfig/ifconfig_netlink.c index aadd7d1096c3..7145c037e54e 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -278,7 +278,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)
