git: 59062fd0b2f1 - main - netinet6: use IF_ADDR_LOCK instead of IF_AFDATA_LOCK
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Dec 2025 16:37:56 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=59062fd0b2f1a159a94f97cd05a76f66eb40837c
commit 59062fd0b2f1a159a94f97cd05a76f66eb40837c
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-12-05 16:29:00 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-12-05 16:29:00 +0000
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.
---
sys/netinet6/scope6.c | 14 +++++++++-----
1 file 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);
}