Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146996395
D22912.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D22912.diff
View Options
Index: head/sys/net/route.c
===================================================================
--- head/sys/net/route.c
+++ head/sys/net/route.c
@@ -833,7 +833,7 @@
* to reflect size of the provided buffer. if no NHR_COPY is specified,
* point dst,netmask and gw @info fields to appropriate @rt values.
*
- * if @flags contains NHR_REF, do refcouting on rt_ifp.
+ * if @flags contains NHR_REF, do refcouting on rt_ifp and rt_ifa.
*
* Returns 0 on success.
*/
@@ -903,10 +903,9 @@
info->rti_flags = rt->rt_flags;
info->rti_ifp = rt->rt_ifp;
info->rti_ifa = rt->rt_ifa;
- ifa_ref(info->rti_ifa);
if (flags & NHR_REF) {
- /* Do 'traditional' refcouting */
if_ref(info->rti_ifp);
+ ifa_ref(info->rti_ifa);
}
return (0);
@@ -916,8 +915,8 @@
* Lookups up route entry for @dst in RIB database for fib @fibnum.
* Exports entry data to @info using rt_exportinfo().
*
- * if @flags contains NHR_REF, refcouting is performed on rt_ifp.
- * All references can be released later by calling rib_free_info()
+ * If @flags contains NHR_REF, refcouting is performed on rt_ifp and rt_ifa.
+ * All references can be released later by calling rib_free_info().
*
* Returns 0 on success.
* Returns ENOENT for lookup failure, ENOMEM for export failure.
@@ -963,6 +962,7 @@
rib_free_info(struct rt_addrinfo *info)
{
+ ifa_free(info->rti_ifa);
if_rele(info->rti_ifp);
}
@@ -1631,9 +1631,12 @@
error = rt_getifa_fib(info, fibnum);
if (error)
return (error);
+ } else {
+ ifa_ref(info->rti_ifa);
}
rt = uma_zalloc(V_rtzone, M_NOWAIT);
if (rt == NULL) {
+ ifa_free(info->rti_ifa);
return (ENOBUFS);
}
rt->rt_flags = RTF_UP | flags;
@@ -1642,6 +1645,7 @@
* Add the gateway. Possibly re-malloc-ing the storage for it.
*/
if ((error = rt_setgate(rt, dst, gateway)) != 0) {
+ ifa_free(info->rti_ifa);
uma_zfree(V_rtzone, rt);
return (error);
}
@@ -1665,7 +1669,6 @@
* examine the ifa and ifa->ifa_ifp if it so desires.
*/
ifa = info->rti_ifa;
- ifa_ref(ifa);
rt->rt_ifa = ifa;
rt->rt_ifp = ifa->ifa_ifp;
rt->rt_weight = 1;
@@ -2108,7 +2111,6 @@
* Do the actual request
*/
bzero((caddr_t)&info, sizeof(info));
- ifa_ref(ifa);
info.rti_ifa = ifa;
info.rti_flags = flags |
(ifa->ifa_flags & ~IFA_RTSELF) | RTF_PINNED;
@@ -2122,7 +2124,6 @@
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = netmask;
error = rtrequest1_fib(cmd, &info, &rt, fibnum);
-
if (error == 0 && rt != NULL) {
/*
* notify any listening routing agents of the change
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 8, 10:45 AM (13 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29403501
Default Alt Text
D22912.diff (2 KB)
Attached To
Mode
D22912: Plug some ifaddr refcount leaks.
Attached
Detach File
Event Timeline
Log In to Comment