diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-07-07 12:45:23 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-07-07 12:45:23 -0700 |
commit | 45432c0b011ba08fa1056fddcf41fbba2adec0b2 (patch) | |
tree | ba82ed9ce38c2a4e88916d5a97413cb9d3839078 | |
parent | 9a0717eedce98f37e2962da6104d83ceaee1f73a (diff) | |
download | vyatta-wanloadbalance-45432c0b011ba08fa1056fddcf41fbba2adec0b2.tar.gz vyatta-wanloadbalance-45432c0b011ba08fa1056fddcf41fbba2adec0b2.zip |
fix for bug 4658. Move enable-source-based-routing to per rule basis from global setting.
Conflicts:
src/lbdecision.cc
-rw-r--r-- | scripts/vyatta-wanloadbalance.pl | 8 | ||||
-rw-r--r-- | src/lbdata.hh | 9 | ||||
-rw-r--r-- | src/lbdatafactory.cc | 18 | ||||
-rw-r--r-- | src/lbdatafactory.hh | 6 | ||||
-rw-r--r-- | templates/load-balancing/wan/rule/node.tag/enable-source-based-routing/node.def (renamed from templates/load-balancing/wan/enable-source-based-routing/node.def) | 0 |
5 files changed, 21 insertions, 20 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl index 1333be1..6016f33 100644 --- a/scripts/vyatta-wanloadbalance.pl +++ b/scripts/vyatta-wanloadbalance.pl @@ -29,10 +29,6 @@ sub write_health { print FILE_LCK "disable-source-nat\n"; } - if ($config->exists("load-balancing wan enable-source-based-routing")) { - print FILE_LCK "enable-source-based-routing\n"; - } - if ($config->exists("load-balancing wan flush-connections")) { print FILE_LCK "flush-conntrack\n"; } @@ -108,6 +104,10 @@ sub write_rules { print FILE_LCK "\tfailover\n"; } + if ($config->exists("$rule enable-source-based-routing")) { + print FILE_LCK "\tenable-source-based-routing\n"; + } + if ($config->exists("$rule failover") && $config->exists("$rule exclude")) { print "failover cannot be configured with exclude\n"; exit 1; diff --git a/src/lbdata.hh b/src/lbdata.hh index 3bfdf76..3f90b1e 100644 --- a/src/lbdata.hh +++ b/src/lbdata.hh @@ -25,8 +25,8 @@ class LBRule { LBRule() : _proto("all"), _exclude(false), - _failover(false) - {} + _failover(false), + _enable_source_based_routing(false) {} public: string _proto; @@ -41,6 +41,8 @@ class LBRule { bool _exclude; bool _failover; + bool _enable_source_based_routing; + string _in_iface; InterfaceDistColl _iface_dist_coll; }; @@ -116,7 +118,7 @@ class LBData { typedef map<string,LBHealth>::iterator InterfaceHealthIter; typedef map<string,LBHealth>::const_iterator InterfaceHealthConstIter; - LBData() : _disable_source_nat(false),_enable_source_based_routing(false),_flush_conntrack(false) {} + LBData() : _disable_source_nat(false),_flush_conntrack(false) {} bool error() {return false;} @@ -140,7 +142,6 @@ class LBData { InterfaceHealthColl _iface_health_coll; bool _disable_source_nat; - bool _enable_source_based_routing; bool _flush_conntrack; }; diff --git a/src/lbdatafactory.cc b/src/lbdatafactory.cc index 17b4260..a6c117c 100644 --- a/src/lbdatafactory.cc +++ b/src/lbdatafactory.cc @@ -123,9 +123,6 @@ LBDataFactory::process(const vector<string> &path, int depth, const string &key, if (path[0] == "disable-source-nat") { process_disablesourcenat(l_key,l_value); } - else if (path[0] == "enable-source-based-routing") { - process_enablesourcebasedrouting(l_key,l_value); - } else if (path[0] == "flush-conntrack") { process_flushconntrack(l_key,l_value); } @@ -159,6 +156,9 @@ LBDataFactory::process(const vector<string> &path, int depth, const string &key, else if (depth > 0 && path[1] == "failover") { process_rule_failover(l_key,l_value); } + else if (depth > 0 && path[1] == "enable-source-based-routing") { + process_rule_enablesourcebasedrouting(l_key,l_value); + } else { process_rule(l_key,l_value); } @@ -177,12 +177,6 @@ LBDataFactory::process_flushconntrack(const string &key, const string &value) _lb_data._flush_conntrack = true; } -void -LBDataFactory::process_enablesourcebasedrouting(const string &key, const string &value) -{ - _lb_data._enable_source_based_routing = true; -} - void LBDataFactory::process_health(const string &key, const string &value) @@ -315,6 +309,12 @@ LBDataFactory::process_rule_failover(const string &key, const string &value) } void +LBDataFactory::process_rule_enablesourcebasedrouting(const string &key, const string &value) +{ + _rule_iter->second._enable_source_based_routing = true; +} + +void LBDataFactory::process_rule_source(const string &key, const string &value) { if (key == "address") { diff --git a/src/lbdatafactory.hh b/src/lbdatafactory.hh index 9aefda0..d11446a 100644 --- a/src/lbdatafactory.hh +++ b/src/lbdatafactory.hh @@ -47,9 +47,6 @@ private: process_flushconntrack(const string &key, const string &value); void - process_enablesourcebasedrouting(const string &key, const string &value); - - void process_health(const string &key, const string &value); void @@ -79,6 +76,9 @@ private: void process_rule_inbound_interface(const string &key, const string &value); + void + process_rule_enablesourcebasedrouting(const string &key, const string &value); + private: bool _debug; LBHealth _lb_health; diff --git a/templates/load-balancing/wan/enable-source-based-routing/node.def b/templates/load-balancing/wan/rule/node.tag/enable-source-based-routing/node.def index 6bb3fe0..6bb3fe0 100644 --- a/templates/load-balancing/wan/enable-source-based-routing/node.def +++ b/templates/load-balancing/wan/rule/node.tag/enable-source-based-routing/node.def |