From: Tobias Brunner Date: Fri, 7 Feb 2014 10:37:58 +0000 (+0100) Subject: kernel-pfroute: Don't cache route entries if installation fails X-Git-Tag: 5.1.2rc1~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=822b22c96fd1110209d9b680bd905ea29095bd42;p=thirdparty%2Fstrongswan.git kernel-pfroute: Don't cache route entries if installation fails --- diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c index bc10610cd5..844d7c4b43 100644 --- a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c +++ b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c @@ -1420,9 +1420,12 @@ 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_route(this, RTM_ADD, dst_net, prefixlen, gateway, 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; }