aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2014-02-07 11:37:58 +0100
committerTobias Brunner <tobias@strongswan.org>2014-02-12 13:52:25 +0100
commit822b22c96fd1110209d9b680bd905ea29095bd42 (patch)
tree516bfa9a722922d021ae7ae2814289b75a1164de
parentf0f78b74d4cf111f5fbaac8a581e29e33d782aa6 (diff)
downloadstrongswan-822b22c96fd1110209d9b680bd905ea29095bd42.tar.bz2
strongswan-822b22c96fd1110209d9b680bd905ea29095bd42.tar.xz
kernel-pfroute: Don't cache route entries if installation fails
-rw-r--r--src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c b/src/libhydra/plugins/kernel_pfroute/kernel_pfroute_net.c
index bc10610cd..844d7c4b4 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;
}