]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
openvpnctrl: Cleanup flushChain functions.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 12 Jun 2013 12:14:53 +0000 (14:14 +0200)
committerAlexander Marx <amarx@ipfire.org>
Thu, 8 Aug 2013 05:51:18 +0000 (07:51 +0200)
src/misc-progs/openvpnctrl.c

index 576e57fcd081d57d612f92ea4e09bfabe225a155..af13901629a9ae0419978134385e8ed4aa556a7a 100644 (file)
@@ -259,7 +259,7 @@ void setChainRules(char *chain, char *interface, char *protocol, char *port)
 void flushChain(char *chain) {
        char str[STRING_SIZE];
 
-       sprintf(str, "/sbin/iptables -F %sINPUT", chain);
+       sprintf(str, "/sbin/iptables -F %s", chain);
        executeCommand(str);
 }
 
@@ -270,6 +270,13 @@ void flushChainNAT(char *chain) {
        executeCommand(str);
 }
 
+void flushChainINPUT(char *chain) {
+       char str[STRING_SIZE];
+
+       snprintf(str, STRING_SIZE, "%sINPUT", chain);
+       flushChain(str);
+}
+
 void deleteChainReference(char *chain) {
        char str[STRING_SIZE];
 
@@ -289,9 +296,9 @@ void deleteAllChains(void) {
        deleteChainReference(OVPNRED);
        deleteChainReference(OVPNBLUE);
        deleteChainReference(OVPNORANGE);
-       flushChain(OVPNRED);
-       flushChain(OVPNBLUE);
-       flushChain(OVPNORANGE);
+       flushChainINPUT(OVPNRED);
+       flushChainINPUT(OVPNBLUE);
+       flushChainINPUT(OVPNORANGE);
        deleteChain(OVPNRED);
        deleteChain(OVPNBLUE);
        deleteChain(OVPNORANGE);
@@ -455,9 +462,9 @@ void setFirewallRules(void) {
        freekeyvalues(kv);
 
        // Flush all chains.
-       flushChain(OVPNRED);
-       flushChain(OVPNBLUE);
-       flushChain(OVPNORANGE);
+       flushChainINPUT(OVPNRED);
+       flushChainINPUT(OVPNBLUE);
+       flushChainINPUT(OVPNORANGE);
        flushChain(OVPNBLOCK);
        flushChainNAT(OVPNNAT);