summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-06-10 18:35:10 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-06-10 18:35:10 -0700
commit2e7c23ff8769b41bdca8b1932552c4b88e9cb243 (patch)
tree25f5e8cd6e9268847bedca98fd1981c1cfb3b69a
parent98982243bb131c56f94f4bbcf89a58499fe27694 (diff)
downloadvyatta-wanloadbalance-2e7c23ff8769b41bdca8b1932552c4b88e9cb243.tar.gz
vyatta-wanloadbalance-2e7c23ff8769b41bdca8b1932552c4b88e9cb243.zip
needs accept to truncation rule evaluation on a match. this should now distribute traffic across interfaces.
-rw-r--r--src/lbdecision.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc
index 9c13017..da9f98c 100644
--- a/src/lbdecision.cc
+++ b/src/lbdecision.cc
@@ -101,15 +101,15 @@ if so then this stuff goes here!
string iface = iter->first;
sprintf(buf,"%d",ct);
- /*
+
execute(string("iptables -t mangle -N ISP_") + buf);
execute(string("iptables -t mangle -F ISP_") + buf);
execute(string("iptables -t mangle -A ISP_") + buf + " -j CONNMARK --set-mark " + buf);
- execute(string("iptables -t mangle -A ISP_") + buf + " -j MARK --set-mark " + buf);
+ // execute(string("iptables -t mangle -A ISP_") + buf + " -j MARK --set-mark " + buf);
//NOTE, WILL NEED A WAY TO CLEAN UP THIS RULE ON RESTART...
execute(string("iptables -t mangle -A ISP_") + buf + " -j ACCEPT");
- */
+
execute(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop);
execute(string("ip rule add fwmark ") + buf + " table " + buf);
@@ -172,14 +172,16 @@ LBDecision::run(LBData &lb_data)
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 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);
++w_iter;
}
//last one is special case, the catch all rule
++w_iter;
sprintf(dbuf,"%d",w_iter->first);
- execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j CONNMARK --set-mark " + dbuf);
+ // execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j CONNMARK --set-mark " + dbuf);
+ execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j ISP_" + dbuf);
execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -j CONNMARK --restore-mark");
++iter;
}