summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorslioch <slioch@eng-140.vyatta.com>2009-06-17 15:07:06 -0700
committerslioch <slioch@eng-140.vyatta.com>2009-06-17 15:07:06 -0700
commit701a90c4cdab06dcb95eb67453a36a4340431e2f (patch)
tree4c3461e3432172f3457ca4322e0e115b750dffb8
parentff33db22773f3d493f6c8ab035186f36679aa174 (diff)
downloadvyatta-wanloadbalance-701a90c4cdab06dcb95eb67453a36a4340431e2f.tar.gz
vyatta-wanloadbalance-701a90c4cdab06dcb95eb67453a36a4340431e2f.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.pl4
-rw-r--r--src/lboutput.cc7
-rw-r--r--src/lbpathtest.cc9
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;