]> git.ipfire.org Git - people/teissler/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)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Aug 2013 12:15:28 +0000 (14:15 +0200)
src/misc-progs/openvpnctrl.c

index 95027577eeb47110bccd1cb9881af9f42f78d68a..97491e40c234230f8adb228d15b8b08fa39f8cd0 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);
@@ -459,9 +466,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);