From 18ed5401584761f133068b2ff6a5efca16dd0627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 21 Feb 2014 13:28:49 +0100 Subject: [PATCH] yum-proxy: fix stop command - iptables-restore do not accept -D iptables-restore format accept only "-A" command, so remove the rules with direct call to iptables --- network/iptables-yum-proxy | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/network/iptables-yum-proxy b/network/iptables-yum-proxy index eaaa4f0..262afe5 100755 --- a/network/iptables-yum-proxy +++ b/network/iptables-yum-proxy @@ -1,17 +1,20 @@ #!/bin/sh -if [ "$1" == "start" ]; then - CMD="-I" -else - # Remove rules - CMD="-D" -fi +RULE_FILTER="INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT" +RULE_NAT="PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT" +if [ "$1" == "start" ]; then cat <<__EOF__ | iptables-restore -n *filter -$CMD INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT +-A $RULE_FILTER COMMIT *nat -$CMD PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT +-A $RULE_NAT COMMIT __EOF__ +else + # Remove rules + iptables -D $RULE_FILTER + iptables -t nat -D $RULE_NAT + exit 0 +fi