summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Larson <slioch@eng-140.vyatta.com>2008-06-06 18:02:00 -0700
committerMichael Larson <slioch@eng-140.vyatta.com>2008-06-06 18:02:00 -0700
commit46f998d055ee8247847b4043d30037973c6f5650 (patch)
tree73306b3e5fd496c56fbd774dee148d61ab48947f /src
parent60a196fa007e776558d12610a231d3f274bd9bdc (diff)
downloadvyatta-wanloadbalance-46f998d055ee8247847b4043d30037973c6f5650.tar.gz
vyatta-wanloadbalance-46f998d055ee8247847b4043d30037973c6f5650.zip
added contract entry for state NEW for initial interface. Also add parameter to specify nexthop via interface in
interface-health. This will be mandatory, but currently it is optional in the absence of a migration script.
Diffstat (limited to 'src')
-rw-r--r--src/lbdata.hh1
-rw-r--r--src/lbdatafactory.cc3
-rw-r--r--src/lbdecision.cc4
3 files changed, 6 insertions, 2 deletions
diff --git a/src/lbdata.hh b/src/lbdata.hh
index 627507c..857c25a 100644
--- a/src/lbdata.hh
+++ b/src/lbdata.hh
@@ -89,6 +89,7 @@ class LBHealth {
int _failure_ct;
string _ping_target;
int _ping_resp_time;
+ string _nexthop;
LBHealthHistory _hresults;
bool _is_active;
bool _state_changed;
diff --git a/src/lbdatafactory.cc b/src/lbdatafactory.cc
index 1cfcd34..877c78e 100644
--- a/src/lbdatafactory.cc
+++ b/src/lbdatafactory.cc
@@ -198,6 +198,9 @@ LBDataFactory::process_health_interface(const string &key, const string &value)
syslog(LOG_ERR, "wan_lb: illegal ping-resp specified in configuration file: %s", value.c_str());
}
}
+ else if (key == "nexthop") {
+ _health_iter->second._nexthop = value;
+ }
else if (key == "health") {
//nothing
}
diff --git a/src/lbdecision.cc b/src/lbdecision.cc
index 66f458b..005726b 100644
--- a/src/lbdecision.cc
+++ b/src/lbdecision.cc
@@ -108,7 +108,7 @@ if so then this stuff goes here!
//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);
+ execute(string("ip route replace table ") + buf + " default dev " + iface + " via " + iter->second._nexthop);
execute(string("ip rule add fwmark ") + buf + " table " + buf);
_iface_mark_coll.insert(pair<string,int>(iface,ct));
@@ -176,7 +176,7 @@ LBDecision::run(LBData &lb_data)
//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 + " -j ISP_" + dbuf);
+ execute(string("iptables -t mangle -A PREROUTING ") + app_cmd + " -m state --state NEW -j ISP_" + dbuf);
++iter;
}
}