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
This commit is contained in:
parent
98e5ffac8c
commit
18ed540158
@ -1,17 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ "$1" == "start" ]; then
|
RULE_FILTER="INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT"
|
||||||
CMD="-I"
|
RULE_NAT="PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT"
|
||||||
else
|
|
||||||
# Remove rules
|
|
||||||
CMD="-D"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if [ "$1" == "start" ]; then
|
||||||
cat <<__EOF__ | iptables-restore -n
|
cat <<__EOF__ | iptables-restore -n
|
||||||
*filter
|
*filter
|
||||||
$CMD INPUT -i vif+ -p tcp --dport 8082 -j ACCEPT
|
-A $RULE_FILTER
|
||||||
COMMIT
|
COMMIT
|
||||||
*nat
|
*nat
|
||||||
$CMD PR-QBS-SERVICES -i vif+ -d 10.137.255.254 -p tcp --dport 8082 -j REDIRECT
|
-A $RULE_NAT
|
||||||
COMMIT
|
COMMIT
|
||||||
__EOF__
|
__EOF__
|
||||||
|
else
|
||||||
|
# Remove rules
|
||||||
|
iptables -D $RULE_FILTER
|
||||||
|
iptables -t nat -D $RULE_NAT
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user