summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/nd6_rtr.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-06-25 16:35:28 +0000
committerrwatson <rwatson@FreeBSD.org>2009-06-25 16:35:28 +0000
commitbd6eb7be79d81290efa6dcaa9f492a05b1966344 (patch)
treeff4ff11920651e5f6aaeaa54e259e4f335eec1af /sys/netinet6/nd6_rtr.c
parent07492aedb8a9805aa9b5287012a05ac498d59d7b (diff)
downloadFreeBSD-src-bd6eb7be79d81290efa6dcaa9f492a05b1966344.zip
FreeBSD-src-bd6eb7be79d81290efa6dcaa9f492a05b1966344.tar.gz
Add address list locking for in6_ifaddrhead/ia_link: as with locking
for in_ifaddrhead, we stick with an rwlock for the time being, which we will revisit in the future with a possible move to rmlocks. Some pieces of code require significant further reworking to be safe from all classes of writer-writer races. Reviewed by: bz MFC after: 6 weeks
Diffstat (limited to 'sys/netinet6/nd6_rtr.c')
-rw-r--r--sys/netinet6/nd6_rtr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index c5021f6..c746fcd 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -1500,6 +1500,8 @@ pfxlist_onlink_check()
* detached. Note, however, that a manually configured address should
* always be attached.
* The precise detection logic is same as the one for prefixes.
+ *
+ * XXXRW: in6_ifaddrhead locking.
*/
TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) {
if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF))
@@ -1949,10 +1951,12 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay)
* there may be a time lag between generation of the ID and generation
* of the address. So, we'll do one more sanity check.
*/
+ IN6_IFADDR_RLOCK();
TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr,
&ifra.ifra_addr.sin6_addr)) {
if (trylimit-- == 0) {
+ IN6_IFADDR_RUNLOCK();
/*
* Give up. Something strange should have
* happened.
@@ -1961,10 +1965,12 @@ in6_tmpifadd(const struct in6_ifaddr *ia0, int forcegen, int delay)
"find a unique random IFID\n"));
return (EEXIST);
}
+ IN6_IFADDR_RUNLOCK();
forcegen = 1;
goto again;
}
}
+ IN6_IFADDR_RUNLOCK();
/*
* The Valid Lifetime is the lower of the Valid Lifetime of the
OpenPOWER on IntegriCloud