aboutsummaryrefslogtreecommitdiffstats
path: root/main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch')
-rw-r--r--main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch b/main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch
new file mode 100644
index 0000000000..f8af98c62f
--- /dev/null
+++ b/main/strongswan/0010-shunt-manager-Remove-stored-entries-if-installation-.patch
@@ -0,0 +1,43 @@
+From 616ff9a2369fd250a2b9e8d2a00f37e2e8d3a2f3 Mon Sep 17 00:00:00 2001
+From: Tobias Brunner <tobias@strongswan.org>
+Date: Tue, 14 Jul 2015 16:50:32 +0200
+Subject: [PATCH] shunt-manager: Remove stored entries if installation fails
+
+---
+ src/libcharon/sa/shunt_manager.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/src/libcharon/sa/shunt_manager.c b/src/libcharon/sa/shunt_manager.c
+index 434bace..2e42e7e 100644
+--- a/src/libcharon/sa/shunt_manager.c
++++ b/src/libcharon/sa/shunt_manager.c
+@@ -122,7 +122,7 @@ METHOD(shunt_manager_t, install, bool,
+ {
+ enumerator_t *enumerator;
+ child_cfg_t *child_cfg;
+- bool found = FALSE;
++ bool found = FALSE, success;
+
+ /* check if not already installed */
+ this->lock->write_lock(this->lock);
+@@ -146,7 +146,16 @@ METHOD(shunt_manager_t, install, bool,
+ this->shunts->insert_last(this->shunts, child->get_ref(child));
+ this->lock->unlock(this->lock);
+
+- return install_shunt_policy(child);
++ success = install_shunt_policy(child);
++
++ if (!success)
++ {
++ this->lock->write_lock(this->lock);
++ this->shunts->remove(this->shunts, child, NULL);
++ this->lock->unlock(this->lock);
++ child->destroy(child);
++ }
++ return success;
+ }
+
+ /**
+--
+2.4.6
+