summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremax <emax@FreeBSD.org>2012-05-30 20:02:39 +0000
committeremax <emax@FreeBSD.org>2012-05-30 20:02:39 +0000
commitb57a3bc250a353972d4c15a9a165efc033ec3a73 (patch)
treedb8aeaff652cb0ea7bfe844cfa71b55f9bbec779
parent4542634c3c12e63b2158a6133f0db8e2cb14a346 (diff)
downloadFreeBSD-src-b57a3bc250a353972d4c15a9a165efc033ec3a73.zip
FreeBSD-src-b57a3bc250a353972d4c15a9a165efc033ec3a73.tar.gz
When we return deprecated addresses, we need to reference them.
Reviewed by: bz, scottl MFC after: 3 days
-rw-r--r--sys/netinet6/in6.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index ca491b8..682d4d1 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -2265,14 +2265,20 @@ in6_ifawithifp(struct ifnet *ifp, struct in6_addr *dst)
IF_ADDR_RUNLOCK(ifp);
return (struct in6_ifaddr *)ifa;
}
- IF_ADDR_RUNLOCK(ifp);
/* use the last-resort values, that are, deprecated addresses */
- if (dep[0])
+ if (dep[0]) {
+ ifa_ref((struct ifaddr *)dep[0]);
+ IF_ADDR_RUNLOCK(ifp);
return dep[0];
- if (dep[1])
+ }
+ if (dep[1]) {
+ ifa_ref((struct ifaddr *)dep[1]);
+ IF_ADDR_RUNLOCK(ifp);
return dep[1];
+ }
+ IF_ADDR_RUNLOCK(ifp);
return NULL;
}
OpenPOWER on IntegriCloud