kernel-netlink: Don't cache route entries if installation fails

Fixes #500.
This commit is contained in:
Tobias Brunner 2014-02-07 11:37:30 +01:00
parent 5e75f50b70
commit f0f78b74d4
1 changed files with 5 additions and 2 deletions

View File

@ -1962,10 +1962,13 @@ METHOD(kernel_net_t, add_route, status_t,
this->routes_lock->unlock(this->routes_lock);
return ALREADY_DONE;
}
found = route_entry_clone(&route);
this->routes->put(this->routes, found, found);
status = manage_srcroute(this, RTM_NEWROUTE, NLM_F_CREATE | NLM_F_EXCL,
dst_net, prefixlen, gateway, src_ip, if_name);
if (status == SUCCESS)
{
found = route_entry_clone(&route);
this->routes->put(this->routes, found, found);
}
this->routes_lock->unlock(this->routes_lock);
return status;
}