From 39d87f20b42f7c54ce65506eea59b3534b191b17 Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Fri, 4 Aug 2017 21:26:36 +0200 Subject: [PATCH] ipsec: reload connection when the config changes Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- src/functions/functions.ipsec | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/functions/functions.ipsec b/src/functions/functions.ipsec index 61bdcb28..5a464b5d 100644 --- a/src/functions/functions.ipsec +++ b/src/functions/functions.ipsec @@ -295,7 +295,17 @@ ipsec_connection_exists() { # Reloads the connection after config changes ipsec_reload() { - return ${EXIT_TRUE} + local connection=${1} + + if ! ipsec_connection_to_strongswan ${connection}; then + log ERROR "Could not generate strongswan config for ${connnection}" + return ${EXIT_ERROR} + fi + + if ! cmd swanctl --load-all; then + log ERROR "Could not reload strongswan config" + return ${EXIT_ERROR} + fi } # Handle the cli after authentification -- 2.39.5