git: 2fef1a6ef9f0 - stable/14 - netlink: Don't directly access ifnet members
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 Dec 2025 09:30:41 UTC
The branch stable/14 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=2fef1a6ef9f095df5ed8f1cd8766878fb960c86b
commit 2fef1a6ef9f095df5ed8f1cd8766878fb960c86b
Author: Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2024-10-31 15:09:48 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-12-26 08:25:47 +0000
netlink: Don't directly access ifnet members
Summary:
Remove the final direct access of struct ifnet members from netlink.
Since only the first address is used, create the iterator and then free,
without fully iterating.
Reviewed By: kp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D42972
(cherry picked from commit b224af946a17b8e7a7b4942157556b5bc86dd6fb)
---
sys/netlink/route/iface.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c
index d98385a4c23e..6fd99cf61e2d 100644
--- a/sys/netlink/route/iface.c
+++ b/sys/netlink/route/iface.c
@@ -322,11 +322,13 @@ dump_iface(struct nl_writer *nw, if_t ifp, const struct nlmsghdr *hdr,
*/
if (if_getaddrlen(ifp) != 0) {
struct ifaddr *ifa;
+ struct ifa_iter it;
NET_EPOCH_ENTER(et);
- ifa = CK_STAILQ_FIRST(&ifp->if_addrhead);
+ ifa = ifa_iter_start(ifp, &it);
if (ifa != NULL)
dump_sa(nw, IFLA_ADDRESS, ifa->ifa_addr);
+ ifa_iter_finish(&it);
NET_EPOCH_EXIT(et);
}