summaryrefslogtreecommitdiff
path: root/src/lbdecision.cc
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-07-27 17:01:08 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-07-27 17:01:08 -0700
commitb80e518d20d05646404a28c2a5cbfc86d0221600 (patch)
tree7d9f5fc32c677819adcb9a679a75b2d73d76cfa4 /src/lbdecision.cc
parent6047ad1d172c1f825ff98468e2ffdb33002c718f (diff)
downloadvyatta-wanloadbalance-b80e518d20d05646404a28c2a5cbfc86d0221600.tar.gz
vyatta-wanloadbalance-b80e518d20d05646404a28c2a5cbfc86d0221600.zip
clean up all of mangle table on exit, including new entries. fixed bug in target iteration where some targets never completed test cycle
Diffstat (limited to 'src/lbdecision.cc')
-rw-r--r--src/lbdecision.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc
index cf77331..5534452 100644
--- a/src/lbdecision.cc
+++ b/src/lbdecision.cc
@@ -391,23 +391,26 @@ LBDecision::shutdown(LBData &data)
string stdout;
//then if we do, flush all
- execute("iptables -t mangle -F WANLOADBALANCE_PRE", stdout);
- execute("iptables -t mangle -F WANLOADBALANCE_OUT", stdout);
execute("iptables -t mangle -D PREROUTING -j WANLOADBALANCE_PRE", stdout);
execute("iptables -t mangle -D OUTPUT -j WANLOADBALANCE_OUT", stdout);
+ execute("iptables -t mangle -F WANLOADBALANCE_PRE", stdout);
+ execute("iptables -t mangle -F WANLOADBALANCE_OUT", stdout);
+ execute("iptables -t mangle -X WANLOADBALANCE_PRE", stdout);
+ execute("iptables -t mangle -X WANLOADBALANCE_OUT", stdout);
LBData::LBRuleIter iter = data._lb_rule_coll.begin();
while (iter != data._lb_rule_coll.end()) {
if (iter->second._limit) {
char rule_str[20];
sprintf(rule_str,"%d",iter->first);
- execute(string("iptables -t mangle -D PREROUTING -j WANLOADBALANCE_PRE_LIMIT_") + rule_str,stdout);
- execute(string("iptables -t mangle -D PREROUTING -j WANLOADBALANCE_OUT_LIMIT_") + rule_str,stdout);
+ execute(string("iptables -t mangle -F WANLOADBALANCE_PRE_LIMIT_") + rule_str,stdout);
+ execute(string("iptables -t mangle -F WANLOADBALANCE_OUT_LIMIT_") + rule_str,stdout);
+ execute(string("iptables -t mangle -X WANLOADBALANCE_PRE_LIMIT_") + rule_str,stdout);
+ execute(string("iptables -t mangle -X WANLOADBALANCE_OUT_LIMIT_") + rule_str,stdout);
}
++iter;
}
-
//clear out nat as well
execute("iptables -t nat -F WANLOADBALANCE", stdout);
execute("iptables -t nat -D VYATTA_PRE_SNAT_HOOK -j WANLOADBALANCE", stdout);
@@ -428,6 +431,10 @@ LBDecision::shutdown(LBData &data)
//need to delete ip rule here as well!
+ //clean up mangle final entries here
+ execute(string("iptables -t mangle -F ISP_") + h_iter->first,stdout);
+ execute(string("iptables -t mangle -X ISP_") + h_iter->first,stdout);
+
++h_iter;
}
}