Change ipsec up/down of a tunnel.
authorArne Fitzenreiter <arne_f@ipfire.org>
Sat, 8 May 2010 13:35:11 +0000 (15:35 +0200)
committerArne Fitzenreiter <arne_f@ipfire.org>
Sat, 8 May 2010 13:35:11 +0000 (15:35 +0200)
src/misc-progs/ipsecctrl.c

index 7205afb..aa6b8a4 100644 (file)
@@ -138,11 +138,7 @@ int decode_line (char *s,
 void turn_connection_on (char *name, char *type) {
         char command[STRING_SIZE];
 
-        safe_system("/usr/sbin/ipsec whack --rereadall >/dev/null");
-        memset(command, 0, STRING_SIZE);
-        snprintf(command, STRING_SIZE - 1, 
-                "/usr/sbin/ipsec down %s >/dev/null", name);
-        safe_system(command);
+        safe_system("/usr/sbin/ipsec reload >/dev/null");
         memset(command, 0, STRING_SIZE);
         snprintf(command, STRING_SIZE - 1, 
                 "/usr/sbin/ipsec up %s >/dev/null", name);
@@ -155,8 +151,9 @@ void turn_connection_off (char *name) {
         char command[STRING_SIZE];
         memset(command, 0, STRING_SIZE);
         snprintf(command, STRING_SIZE - 1, 
-                "/usr/sbin/ipsec down %s >/dev/null", name);
+                "/usr/sbin/ipsec whack --delete --name %s >/dev/null", name);
         safe_system(command);
+        safe_system("/usr/sbin/ipsec whack --rereadall >/dev/null");
 }