summaryrefslogtreecommitdiffstats
path: root/sys/netipsec/key.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/netipsec/key.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/netipsec/key.c')
-rw-r--r--sys/netipsec/key.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index 08547a8..3dc6878 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -3982,10 +3982,13 @@ key_ismyaddr6(sin6)
struct in6_multi *in6m;
#endif
+ IN6_IFADDR_RLOCK();
TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
if (key_sockaddrcmp((struct sockaddr *)&sin6,
- (struct sockaddr *)&ia->ia_addr, 0) == 0)
+ (struct sockaddr *)&ia->ia_addr, 0) == 0) {
+ IN6_IFADDR_RUNLOCK();
return 1;
+ }
#if 0
/*
@@ -3996,10 +3999,13 @@ key_ismyaddr6(sin6)
*/
in6m = NULL;
IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m);
- if (in6m)
+ if (in6m) {
+ IN6_IFADDR_RUNLOCK();
return 1;
+ }
#endif
}
+ IN6_IFADDR_RUNLOCK();
/* loopback, just for safety */
if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
OpenPOWER on IntegriCloud