git: 6f3947be2aff - main - ifconfig: fix 'ifconfig -l link'
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Aug 2023 17:33:21 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=6f3947be2aff9350514b5a414104d0afaeb53cdf commit 6f3947be2aff9350514b5a414104d0afaeb53cdf Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2023-08-25 17:31:55 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2023-08-25 17:31:55 +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 --- 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 c3e8cd413409..a6f52ea2a7f0 100644 --- a/sbin/ifconfig/ifconfig_netlink.c +++ b/sbin/ifconfig/ifconfig_netlink.c @@ -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)