/* Check for CONFIG_TYPE=2 or 3 i.e. RED ethernet present. If not,
* exit gracefully. This is not an error... */
- if (!((strcmp(configtype, "2")==0) || (strcmp(configtype, "3")==0) || (strcmp(configtype, "6")==0) || (strcmp(configtype, "7")==0)))
+ if (!((strcmp(configtype, "1")==0) || (strcmp(configtype, "2")==0) || (strcmp(configtype, "3")==0) || (strcmp(configtype, "4")==0)))
return;
/* Now check the RED_TYPE - aliases only work with STATIC. */
}
if (!(initsetuid()))
exit(1);
-
+
+ FILE *file = NULL;
+
+ /* Get vpnwatch pid */
+
+ if (file = fopen("/var/run/vpn-watch.pid", "r")) {
+ safe_system("kill -9 $(cat /var/run/vpn-watch.pid)");
+ safe_system("unlink /var/run/vpn-watch.pid)");
+ }
+ close(file);
+
/* FIXME: workaround for pclose() issue - still no real idea why
* this is happening */
signal(SIGCHLD, SIG_DFL);
/* handle operations that doesn't need start the ipsec system */
if (argc == 2) {
if (strcmp(argv[1], "D") == 0) {
- safe_system("/usr/local/bin/vpn-watch --stop");
ipsec_norules();
/* Only shutdown pluto if it really is running */
int fd;
/* Get pluto pid */
if ((fd = open("/var/run/pluto.pid", O_RDONLY)) != -1) {
- safe_system("/etc/rc.d/ipsec stop 2> /dev/null >/dev/null");
+ safe_system("/etc/rc.d/init.d/ipsec stop 2> /dev/null >/dev/null");
close(fd);
}
exit(0);
}
}
- /* stop the watch script as soon as possible */
- safe_system("/usr/local/bin/vpn-watch --stop");
-
/* clear iptables vpn rules */
ipsec_norules();
char if_orange[STRING_SIZE] = "";
char if_blue[STRING_SIZE] = "";
char s[STRING_SIZE];
- FILE *file = NULL;
if (!(file = fopen(CONFIG_ROOT "/vpn/config", "r"))) {
fprintf(stderr, "Couldn't open vpn settings file");
if ((argc == 2) && strcmp(argv[1], "S") == 0) {
load_modules();
safe_system("/usr/sbin/ipsec tncfg --clear >/dev/null");
- safe_system("/etc/rc.d/ipsec restart >/dev/null");
+ safe_system("/etc/rc.d/init.d/ipsec restart >/dev/null");
add_alias_interfaces(configtype, redtype, if_red, (enable_red+enable_green+enable_orange+enable_blue) >>1 );
- safe_system("/usr/local/bin/vpn-watch --start");
exit(0);
}
}
}
fclose(file);
- safe_system("/usr/local/bin/vpn-watch --start");
+ safe_system("/usr/local/bin/vpn-watch &");
return 0;
}