summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-06-12 15:29:35 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-06-12 15:29:35 -0700
commit3b93ae2f8e434f16624637e86b1ac05f0acc67a7 (patch)
treeec9e36cc1770ecd50c7ba40a6490d9c2c98c8309
parent56959843d90bfcfe0a1e0b55787230b56229bb52 (diff)
downloadvyatta-wanloadbalance-3b93ae2f8e434f16624637e86b1ac05f0acc67a7.tar.gz
vyatta-wanloadbalance-3b93ae2f8e434f16624637e86b1ac05f0acc67a7.zip
fixed problem with ping target failure that is not the last listed interface, now the correct mangle wan load balance is referenced when an
interface fails.
-rw-r--r--src/lbdecision.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc
index 6573374..856e06f 100644
--- a/src/lbdecision.cc
+++ b/src/lbdecision.cc
@@ -191,11 +191,11 @@ LBDecision::run(LBData &lb_data)
char fbuf[20],dbuf[20];
while (w_iter != w_end) {
- sprintf(fbuf,"%f",w_iter->second);
- sprintf(dbuf,"%d",w_iter->first);
- // execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -m statistic --mode random --probability " + fbuf + " -j CONNMARK --set-mark " + dbuf);
- execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -m statistic --mode random --probability " + fbuf + " -j ISP_" + dbuf);
-
+ if (w_iter->second > 0) {
+ sprintf(fbuf,"%f",w_iter->second);
+ sprintf(dbuf,"%d",w_iter->first);
+ execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -m statistic --mode random --probability " + fbuf + " -j ISP_" + dbuf);
+ }
++w_iter;
}
//last one is special case, the catch all rule
@@ -274,6 +274,9 @@ LBDecision::get_new_weights(LBData &data, LBRule &rule)
weights.insert(pair<int,float>(ct,iter->second));
group += iter->second;
}
+ else {
+ weights.insert(pair<int,float>(ct,0));
+ }
++ct;
++iter;
}