aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-12-05 16:29:00 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-12-05 16:29:00 +0000
commit59062fd0b2f1a159a94f97cd05a76f66eb40837c (patch)
treed5cd9961a8ebe3498932218b8382013eaf783b87
parent69e041521a80a0b8950f6ec25269a9c3949d6590 (diff)
netinet6: use IF_ADDR_LOCK instead of IF_AFDATA_LOCK
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.
-rw-r--r--sys/netinet6/scope6.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 08702a2e81ab..a683ebdec956 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -137,6 +137,10 @@ scope6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp)
}
}
+/*
+ * XXXGL: The use of IF_ADDR_WLOCK (previously it was IF_AFDATA_LOCK) in this
+ * function is quite strange.
+ */
static int
scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
{
@@ -144,11 +148,11 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
int error = 0;
struct scope6_id *sid = NULL;
- IF_AFDATA_WLOCK(ifp);
+ IF_ADDR_WLOCK(ifp);
sid = SID(ifp);
if (!sid) { /* paranoid? */
- IF_AFDATA_WUNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (EINVAL);
}
@@ -171,7 +175,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
*/
if (i == IPV6_ADDR_SCOPE_INTFACELOCAL &&
idlist->s6id_list[i] != ifp->if_index) {
- IF_AFDATA_WUNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (EINVAL);
}
@@ -187,7 +191,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
* consistency for safety in later use.
*/
NET_EPOCH_EXIT(et);
- IF_AFDATA_WUNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (EINVAL);
}
NET_EPOCH_EXIT(et);
@@ -201,7 +205,7 @@ scope6_set(struct ifnet *ifp, struct scope6_id *idlist)
sid->s6id_list[i] = idlist->s6id_list[i];
}
}
- IF_AFDATA_WUNLOCK(ifp);
+ IF_ADDR_WUNLOCK(ifp);
return (error);
}