diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-04-02 09:33:15 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-04-02 09:33:15 -0700 |
commit | 3c28df532e783cb42d0f003da402783767308e6d (patch) | |
tree | a63b623e6d128db891b29ac873d6781f3232c371 /src/lbdecision.cc | |
parent | c9229987f30ddc568568ac743c037d1a2f62c7d0 (diff) | |
download | vyatta-wanloadbalance-3c28df532e783cb42d0f003da402783767308e6d.tar.gz vyatta-wanloadbalance-3c28df532e783cb42d0f003da402783767308e6d.zip |
added source based routing feature.
Diffstat (limited to 'src/lbdecision.cc')
-rw-r--r-- | src/lbdecision.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc index 70f9a8e..5373b9e 100644 --- a/src/lbdecision.cc +++ b/src/lbdecision.cc @@ -273,10 +273,20 @@ LBDecision::run(LBData &lb_data) for (w_iter = weights.begin(); w_iter != (--weights.end()); w_iter++) { 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, stdout); + if (lb_data._enable_source_based_routing) { + execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m statistic --mode random --probability " + fbuf + " -j ISP_" + dbuf, stdout); + } + else { + execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -m statistic --mode random --probability " + fbuf + " -j ISP_" + dbuf, stdout); + } } sprintf(dbuf,"%d",(--weights.end())->first); - execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j ISP_" + dbuf, stdout); + if (lb_data._enable_source_based_routing) { + execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -j ISP_" + dbuf, stdout); + } + else { + execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j ISP_" + dbuf, stdout); + } execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -j CONNMARK --restore-mark", stdout); } } |