- sprintf(str, "/sbin/iptables -t nat -F %s", chain);
- executeCommand(str);
-}
-
-void deleteChainReference(char *chain) {
- char str[STRING_SIZE];
-
- sprintf(str, "/sbin/iptables -D INPUT -j %sINPUT", chain);
- executeCommand(str);
- safe_system(str);
- sprintf(str, "/sbin/iptables -D FORWARD -j %sFORWARD", chain);
- executeCommand(str);
- safe_system(str);
-}
-
-void deleteChain(char *chain) {
- char str[STRING_SIZE];
-
- sprintf(str, "/sbin/iptables -X %sINPUT", chain);
- executeCommand(str);
- sprintf(str, "/sbin/iptables -X %sFORWARD", chain);
- executeCommand(str);
-}
-
-void deleteAllChains(void) {
- // not an elegant solution, but to avoid timing problems with undeleted chain references
- deleteChainReference(OVPNRED);
- deleteChainReference(OVPNBLUE);
- deleteChainReference(OVPNORANGE);
- flushChain(OVPNRED);
- flushChain(OVPNBLUE);
- flushChain(OVPNORANGE);
- deleteChain(OVPNRED);
- deleteChain(OVPNBLUE);
- deleteChain(OVPNORANGE);
-}
-
-void createChainReference(char *chain) {
- char str[STRING_SIZE];
- sprintf(str, "/sbin/iptables -I INPUT %s -j %sINPUT", "14", chain);
- executeCommand(str);
- sprintf(str, "/sbin/iptables -I FORWARD %s -j %sFORWARD", "12", chain);
- executeCommand(str);
-}
-
-void createChain(char *chain) {
- char str[STRING_SIZE];
- sprintf(str, "/sbin/iptables -N %sINPUT", chain);
- executeCommand(str);
- sprintf(str, "/sbin/iptables -N %sFORWARD", chain);