summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-10-30 22:56:13 +0000
committersam <sam@FreeBSD.org>2003-10-30 22:56:13 +0000
commite6809a8b876002cd81a771faaf6d9b2cc8c864f7 (patch)
treec1d01a8caec127d5a9d6c1890c0a80dc1abe6cd8 /sys
parentc2053cfe71f0cf6db9c522ab75d082a1c9f7525c (diff)
downloadFreeBSD-src-e6809a8b876002cd81a771faaf6d9b2cc8c864f7.zip
FreeBSD-src-e6809a8b876002cd81a771faaf6d9b2cc8c864f7.tar.gz
use a local variable to avoid holding a lock across a call out of view
Supported by: FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/nd6_nbr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 9598228..0ed8311 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -207,6 +207,7 @@ nd6_ns_input(m, off, icmp6len)
if (!ifa) {
struct rtentry *rt;
struct sockaddr_in6 tsin6;
+ int need_proxy;
bzero(&tsin6, sizeof tsin6);
tsin6.sin6_len = sizeof(struct sockaddr_in6);
@@ -214,8 +215,11 @@ nd6_ns_input(m, off, icmp6len)
tsin6.sin6_addr = taddr6;
rt = rtalloc1((struct sockaddr *)&tsin6, 0, 0);
- if (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 &&
- rt->rt_gateway->sa_family == AF_LINK) {
+ need_proxy = (rt && (rt->rt_flags & RTF_ANNOUNCE) != 0 &&
+ rt->rt_gateway->sa_family == AF_LINK);
+ if (rt)
+ rtfree(rt);
+ if (need_proxy) {
/*
* proxy NDP for single entry
*/
@@ -226,8 +230,6 @@ nd6_ns_input(m, off, icmp6len)
proxydl = SDL(rt->rt_gateway);
}
}
- if (rt)
- rtfree(rt);
}
if (!ifa) {
/*
OpenPOWER on IntegriCloud