summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-04-20 23:23:31 +0000
committerrwatson <rwatson@FreeBSD.org>2009-04-20 23:23:31 +0000
commit62b8423b511feacc12c6fd0450234aab53d56715 (patch)
treec7b60752ce6d45da9b17c02fb45e6790d6320cf7 /sys/net/rtsock.c
parent6dff27073dd2a25472cdde4ad14416c2251e6202 (diff)
downloadFreeBSD-src-62b8423b511feacc12c6fd0450234aab53d56715.zip
FreeBSD-src-62b8423b511feacc12c6fd0450234aab53d56715.tar.gz
Acquire address list lock before walking an interface's address list to
identify possible jail addresses on it for IPv4 and IPv6. MFC after: 2 weeks
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 6b7c29b..dd19dfc 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -356,6 +356,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp,
* Try to find an address on the given outgoing interface
* that belongs to the jail.
*/
+ IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct sockaddr *sa;
sa = ifa->ifa_addr;
@@ -367,6 +368,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp,
break;
}
}
+ IF_ADDR_UNLOCK(ifp);
if (!found) {
/*
* As a last resort return the 'default' jail address.
@@ -394,6 +396,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp,
* Try to find an address on the given outgoing interface
* that belongs to the jail.
*/
+ IF_ADDR_LOCK(ifp);
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
struct sockaddr *sa;
sa = ifa->ifa_addr;
@@ -406,6 +409,7 @@ rtm_get_jailed(struct rt_addrinfo *info, struct ifnet *ifp,
break;
}
}
+ IF_ADDR_UNLOCK(ifp);
if (!found) {
/*
* As a last resort return the 'default' jail address.
OpenPOWER on IntegriCloud