The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=8291ea8761c2d686d43f14c08ec0e644673b28f3
commit 8291ea8761c2d686d43f14c08ec0e644673b28f3 Author: Gleb Smirnoff <[email protected]> AuthorDate: 2025-12-05 16:29:00 +0000 Commit: Gleb Smirnoff <[email protected]> CommitDate: 2025-12-05 16:29:00 +0000 netinet6: use IF_ADDR_LOCK instead of IF_AFDATA_LOCK in defrtr_ipv6_only_ifp It is not clear what exactly this function is locking against. Seems like just use some generic interface lock. The IF_AFDATA_LOCK goes away soon together with if_afdata[], so put at least something in its place. Note that this code is dead anyway (#ifdef EXPERIMENTAL). --- sys/netinet6/nd6_rtr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index 224cd7e56b4d..7bbba30a3a21 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -253,6 +253,9 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) * interface to see whether they are all advertising the "S" * (IPv6-Only) flag. If they do set, otherwise unset, the * interface flag we later use to filter on. + * + * XXXGL: The use of IF_ADDR_WLOCK (previously it was IF_AFDATA_LOCK) in this + * function is quite strange. */ static void defrtr_ipv6_only_ifp(struct ifnet *ifp) @@ -276,9 +279,9 @@ defrtr_ipv6_only_ifp(struct ifnet *ifp) ipv6_only = false; ND6_RUNLOCK(); - IF_AFDATA_WLOCK(ifp); + IF_ADDR_WLOCK(ifp); ipv6_only_old = ND_IFINFO(ifp)->flags & ND6_IFF_IPV6_ONLY; - IF_AFDATA_WUNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); /* If nothing changed, we have an early exit. */ if (ipv6_only == ipv6_only_old) @@ -312,12 +315,12 @@ defrtr_ipv6_only_ifp(struct ifnet *ifp) } #endif - IF_AFDATA_WLOCK(ifp); + IF_ADDR_WLOCK(ifp); if (ipv6_only) ND_IFINFO(ifp)->flags |= ND6_IFF_IPV6_ONLY; else ND_IFINFO(ifp)->flags &= ~ND6_IFF_IPV6_ONLY; - IF_AFDATA_WUNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); #ifdef notyet /* Send notification of flag change. */ @@ -328,9 +331,9 @@ static void defrtr_ipv6_only_ipf_down(struct ifnet *ifp) { - IF_AFDATA_WLOCK(ifp); + IF_ADDR_WLOCK(ifp); ND_IFINFO(ifp)->flags &= ~ND6_IFF_IPV6_ONLY; - IF_AFDATA_WUNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } #endif /* EXPERIMENTAL */
