diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-07-15 15:33:11 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-07-15 15:34:24 -0700 |
commit | f759ad558ca04657a34ce02df51c2df87adae86f (patch) | |
tree | 60e32dcd3fcb55bcf8d5c56e392fe1c086a71aad | |
parent | 8b0d17af359589f380de0043471de7c725098f67 (diff) | |
download | vyatta-wanloadbalance-f759ad558ca04657a34ce02df51c2df87adae86f.tar.gz vyatta-wanloadbalance-f759ad558ca04657a34ce02df51c2df87adae86f.zip |
fix for bug 4730
-rw-r--r-- | src/lbdecision.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/lbdecision.cc b/src/lbdecision.cc index 683045d..4b64ee4 100644 --- a/src/lbdecision.cc +++ b/src/lbdecision.cc @@ -173,26 +173,26 @@ void LBDecision::update_paths(LBData &lbdata) { string stdout; - if (lbdata._disable_source_nat == false) { - //first let's remove the entry - LBData::InterfaceHealthIter iter = lbdata._iface_health_coll.begin(); - while (iter != lbdata._iface_health_coll.end()) { - if (iter->second._is_active == true) { - string iface = iter->first; - string new_addr = fetch_iface_addr(iface); - char buf[20]; - sprintf(buf,"%d",iter->second._interface_index); - - //now let's update the nexthop here in the route table - if (iter->second._nexthop == "dhcp") { - if (iter->second._dhcp_nexthop.empty() == false) { - insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._dhcp_nexthop, iter->second._interface_index); - } - } - else { - insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop, iter->second._interface_index); + //first let's remove the entry + LBData::InterfaceHealthIter iter = lbdata._iface_health_coll.begin(); + while (iter != lbdata._iface_health_coll.end()) { + if (iter->second._is_active == true) { + string iface = iter->first; + string new_addr = fetch_iface_addr(iface); + char buf[20]; + sprintf(buf,"%d",iter->second._interface_index); + + //now let's update the nexthop here in the route table + if (iter->second._nexthop == "dhcp") { + if (iter->second._dhcp_nexthop.empty() == false) { + insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._dhcp_nexthop, iter->second._interface_index); } - + } + else { + insert_default(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop, iter->second._interface_index); + } + + if (lbdata._disable_source_nat == false) { if (new_addr != iter->second._address) { execute(string("iptables -t nat -D WANLOADBALANCE -m connmark --mark ") + buf + " -j SNAT --to-source " + iter->second._address, stdout); execute(string("iptables -t nat -A WANLOADBALANCE -m connmark --mark ") + buf + " -j SNAT --to-source " + new_addr, stdout); @@ -200,8 +200,8 @@ LBDecision::update_paths(LBData &lbdata) } } - ++iter; } + ++iter; } } |