diff options
author | Justin Hibbits <jhibbits@FreeBSD.org> | 2024-10-31 15:09:48 +0000 |
---|---|---|
committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2024-11-13 19:30:58 +0000 |
commit | b224af946a17b8e7a7b4942157556b5bc86dd6fb (patch) | |
tree | 0147a211c6025dc2404c0bffb657da3b6574f1b6 | |
parent | 3f2eb1ac2326826383e919383554d14a69a5321d (diff) |
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
-rw-r--r-- | sys/netlink/route/iface.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netlink/route/iface.c b/sys/netlink/route/iface.c index 7d33c89a396a..48fdab6a8475 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); } |