From: Michael Tremer Date: Wed, 29 Jun 2011 17:51:24 +0000 (+0200) Subject: openvpnctrl: Create firewall rules properly if roadwarrior server is disabled. X-Git-Tag: v2.9-core53~29^2~3^2~12 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=858d8d9092dae3839e9129448d8a51937aebc909 openvpnctrl: Create firewall rules properly if roadwarrior server is disabled. --- diff --git a/src/misc-progs/openvpnctrl.c b/src/misc-progs/openvpnctrl.c index 68bbe2fff5..73cfb1df98 100644 --- a/src/misc-progs/openvpnctrl.c +++ b/src/misc-progs/openvpnctrl.c @@ -268,39 +268,34 @@ void createChain(char *chain) { } void createAllChains(void) { - if (!((strcmp(enablered, "on")==0) || (strcmp(enableblue, "on")==0) || (strcmp(enableorange, "on")==0))){ - fprintf(stderr, "OpenVPN is not enabled on any interface\n"); - exit(1); - } else { - // create chain and chain references - if (!strcmp(enableorange, "on")) { - if (strlen(orangeif)) { - createChain(OVPNORANGE); - createChainReference(OVPNORANGE); - } else { - fprintf(stderr, "OpenVPN enabled on orange but no orange interface found\n"); - //exit(1); - } + // create chain and chain references + if (!strcmp(enableorange, "on")) { + if (strlen(orangeif)) { + createChain(OVPNORANGE); + createChainReference(OVPNORANGE); + } else { + fprintf(stderr, "OpenVPN enabled on orange but no orange interface found\n"); + //exit(1); } - - if (!strcmp(enableblue, "on")) { - if (strlen(blueif)) { - createChain(OVPNBLUE); - createChainReference(OVPNBLUE); - } else { - fprintf(stderr, "OpenVPN enabled on blue but no blue interface found\n"); - //exit(1); - } + } + + if (!strcmp(enableblue, "on")) { + if (strlen(blueif)) { + createChain(OVPNBLUE); + createChainReference(OVPNBLUE); + } else { + fprintf(stderr, "OpenVPN enabled on blue but no blue interface found\n"); + //exit(1); } - - if (!strcmp(enablered, "on")) { - if (strlen(redif)) { - createChain(OVPNRED); - createChainReference(OVPNRED); - } else { - fprintf(stderr, "OpenVPN enabled on red but no red interface found\n"); - //exit(1); - } + } + + if (!strcmp(enablered, "on")) { + if (strlen(redif)) { + createChain(OVPNRED); + createChainReference(OVPNRED); + } else { + fprintf(stderr, "OpenVPN enabled on red but no red interface found\n"); + //exit(1); } } } @@ -310,12 +305,6 @@ void setFirewallRules(void) { char dport[STRING_SIZE] = ""; char dovpnip[STRING_SIZE] = ""; - /* check if it makes sence to proceed further */ - if (!((strcmp(enablered, "on")==0) || (strcmp(enableblue, "on")==0) || (strcmp(enableorange, "on")==0))){ - fprintf(stderr, "Config error, at least one device must be enabled\n"); - exit(1); - } - kv = initkeyvalues(); if (!readkeyvalues(kv, CONFIG_ROOT "/ovpn/settings")) {