diff options
author | rwatson <rwatson@FreeBSD.org> | 2009-04-20 23:23:31 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2009-04-20 23:23:31 +0000 |
commit | 62b8423b511feacc12c6fd0450234aab53d56715 (patch) | |
tree | c7b60752ce6d45da9b17c02fb45e6790d6320cf7 | |
parent | 6dff27073dd2a25472cdde4ad14416c2251e6202 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/net/rtsock.c | 4 |
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. |