summaryrefslogtreecommitdiff
path: root/src/lbtest_icmp.cc
diff options
context:
space:
mode:
authorMichael Larson <mike@vyatta.com>2011-03-30 12:09:58 -0700
committerMichael Larson <mike@vyatta.com>2011-03-30 12:09:58 -0700
commit25eef8bfb91c2c57907ab79f4ba6bcd9fe0064cb (patch)
tree53f6756f29c645fcec455bfec6a1bf8bdb53e50d /src/lbtest_icmp.cc
parent55cab2fbbf2ee75d6939a9210ddcaa5c72ed6981 (diff)
downloadvyatta-wanloadbalance-25eef8bfb91c2c57907ab79f4ba6bcd9fe0064cb.tar.gz
vyatta-wanloadbalance-25eef8bfb91c2c57907ab79f4ba6bcd9fe0064cb.zip
check in for Bug 6959
Add the ability to run a user defined script to determine wan load-balancing interface health includes sample http test (scripts/http_test.pl). Configuration will look as follows: wan { interface-health eth0 { nexthop 10.3.0.1 test 1 { test-script /tmp/http_test.pl type user-defined } } interface-health eth1 { nexthop 10.3.0.1 test 1 { test-script /tmp/http_test.pl type user-defined } } With corresponding output: vyatta@vyatta# run show wan-load-balance Interface: eth0 Status: active Last Status Change: Wed Mar 30 19:03:59 2011 +Test: user Script: /tmp/http_test.pl Last Interface Success: 0s Last Interface Failure: n/a # Interface Failure(s): 0 Interface: eth1 Status: failed Last Status Change: Wed Mar 30 19:03:59 2011 -Test: user Script: /tmp/http_test.pl Last Interface Success: n/a Last Interface Failure: 0s # Interface Failure(s): 52 Scripts returns 0 for success, non-zero for failure.
Diffstat (limited to 'src/lbtest_icmp.cc')
-rw-r--r--src/lbtest_icmp.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lbtest_icmp.cc b/src/lbtest_icmp.cc
index 6393b3e..d887d53 100644
--- a/src/lbtest_icmp.cc
+++ b/src/lbtest_icmp.cc
@@ -49,11 +49,17 @@ LBTestICMP::send(LBHealth &health)
}
}
+ //set the status line to be used when the show command is invoked
+ _status_line = name() + "\t" + string("Target: ") + target;
+
//don't have target yet...
if (target.empty()) {
return;
}
- _packet_id = ++_packet_id % 32767;
+
+ //instead of prefix to avoid this compilier warning:
+ //warning: operation on ‘LBTest::_packet_id’ may be undefined
+ _packet_id = int((_packet_id + 1) % int(32767));
if (_debug) {
cout << "ICMPEngine::start(): sending ping test for: " << health._interface << " for " << target << " id: " << _packet_id << endl;
}
@@ -195,3 +201,5 @@ LBTestICMP::dump()
sprintf(buf,"%u",_resp_time);
return (string("target: ") + _target + ", resp_time: " + buf);
}
+
+