diff options
author | slioch <slioch@eng-140.vyatta.com> | 2009-06-17 15:07:06 -0700 |
---|---|---|
committer | slioch <slioch@eng-140.vyatta.com> | 2009-06-17 15:12:25 -0700 |
commit | 0d5777b96fec7e16dbcf2a96b285dc0ed493a34c (patch) | |
tree | 4cd560ba337a09ca72d1c978239bf910ea601bb1 | |
parent | 02c414300e38d2c354bc74353328f7b456be2e24 (diff) | |
download | vyatta-wanloadbalance-0d5777b96fec7e16dbcf2a96b285dc0ed493a34c.tar.gz vyatta-wanloadbalance-0d5777b96fec7e16dbcf2a96b285dc0ed493a34c.zip |
ping target is now optional. nexthop will be used in place of ping target if ping target is not specified. this is also true of dhcp configurations.
-rw-r--r-- | scripts/vyatta-wanloadbalance.pl | 4 | ||||
-rw-r--r-- | src/lboutput.cc | 7 | ||||
-rw-r--r-- | src/lbpathtest.cc | 9 |
3 files changed, 15 insertions, 5 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl index edc9232..38ed5b5 100644 --- a/scripts/vyatta-wanloadbalance.pl +++ b/scripts/vyatta-wanloadbalance.pl @@ -54,7 +54,6 @@ sub write_health { $option = $config->returnValue("$ethNode ping"); if (defined $option) { print FILE_LCK "\t\ttarget " . $option . "\n"; - $valid = "true"; } $option = $config->returnValue("$ethNode resp-time"); @@ -70,6 +69,7 @@ sub write_health { $option = $config->returnValue("$ethNode nexthop"); if (defined $option) { print FILE_LCK "\t\tnexthop " . $option . "\n"; + $valid = "true"; } else { print "nexthop must be specified\n"; @@ -80,7 +80,7 @@ sub write_health { print FILE_LCK "}\n\n"; if ($valid eq "false") { - print "A valid WAN load-balance configuration requires an interface with a ping target\n"; + print "A valid WAN load-balance configuration requires an interface with a nexthop\n"; } return $valid; } diff --git a/src/lboutput.cc b/src/lboutput.cc index a20a72e..ff915ec 100644 --- a/src/lboutput.cc +++ b/src/lboutput.cc @@ -60,7 +60,12 @@ LBOutput::write(const LBData &lbdata) line += space + string("Last Status Change: ") + string(tbuf); - line += space + string("Target: Ping ") + iter->second._ping_target + "\n"; + string target = iter->second._ping_target; + if (target.empty()) { + target = iter->second._nexthop; + } + + line += space + string("Target: Ping ") + target + "\n"; char btmp[256]; string time_buf; diff --git a/src/lbpathtest.cc b/src/lbpathtest.cc index df29921..ebe55cd 100644 --- a/src/lbpathtest.cc +++ b/src/lbpathtest.cc @@ -101,11 +101,16 @@ LBPathTest::start(LBData &lb_data) //iterate over packets and send LBData::InterfaceHealthIter iter = lb_data._iface_health_coll.begin(); while (iter != lb_data._iface_health_coll.end()) { + string target = iter->second._ping_target; + if (target.empty()) { + target = iter->second._nexthop; + } + if (_debug) { - cout << "LBPathTest::start(): sending ping test for: " << iter->first << " for " << iter->second._ping_target << endl; + cout << "LBPathTest::start(): sending ping test for: " << iter->first << " for " << target << endl; } _packet_id = ++_packet_id % 32767; - send(iter->first, iter->second._ping_target, _packet_id); + send(iter->first, target, _packet_id); results.insert(pair<int,PktData>(_packet_id,PktData(iter->first,-1))); ++ct; |