]> git.ipfire.org Git - people/stevee/network.git/commitdiff
ipsec: Make sure strongswan is started when it should be
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Aug 2017 21:28:17 +0000 (21:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Aug 2017 21:28:17 +0000 (21:28 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ipsec

index 22c6d5296ddcfdbba35d2f11243ff3019ab0c0ee..d75d920dc94d30c4110270eca3bcd80aae4bb7df 100644 (file)
@@ -344,12 +344,24 @@ ipsec_strongswan_autostart() {
        done
 
        # Start strongswan when we need it and when it is not yet enabled
-       if ${autostart_needed} && ! service_is_enabled "strongswan"; then
-               service_enable "strongswan"
+       if ${autostart_needed}; then
+               if ! service_is_enabled "strongswan"; then
+                       service_enable "strongswan"
+               fi
+
+               if ! service_is_active "strongswan"; then
+                       service_start "strongswan"
+               fi
 
        # Disable strongswan when we do not need it but it is enabled
-       elif ! ${autostart_needed} && service_is_enabled "strongswan"; then
-               service_disable "strongswan"
+       elif ! ${autostart_needed}; then
+               if service_is_enabled "strongswan"; then
+                       service_disable "strongswan"
+               fi
+
+               if service_is_active "strongswan"; then
+                       service_stop "strongswan"
+               fi
        fi
 }