diff options
-rw-r--r-- | src/lbdecision.cc | 12 |
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; } |