From 3c2ad106f30d111731d460b5274471d7cafe5cf8 Mon Sep 17 00:00:00 2001 From: Niko Tyni Date: Fri, 13 Feb 2009 07:46:16 +0000 Subject: From: Jeremy Laidman > Please consider including the patch below. It allows specifying a parameter > of "allowreject" in the Radius probe configuration. When allowreject=true, > rejected RADIUS authentications are treated as OK. This means I can test > the RTT of a RADIUS request without using a valid account. As long as the > RADIUS secret is correct, the timings should be reasonable. The default is > "false". --- lib/Smokeping/probes/Radius.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Smokeping/probes/Radius.pm b/lib/Smokeping/probes/Radius.pm index efe9429..dbbee6b 100644 --- a/lib/Smokeping/probes/Radius.pm +++ b/lib/Smokeping/probes/Radius.pm @@ -130,6 +130,11 @@ sub pingone { my $timeout = $vars->{timeout}; + my $allowreject = $vars->{allowreject}; + $self->do_debug("$host: radius allowreject is $allowreject"); + $allowreject=(defined($allowreject) + and $allowreject eq "true"); + $self->do_log("Missing RADIUS secret for $host"), return unless defined $secret; @@ -172,6 +177,7 @@ sub pingone { $result = $c; $result = "OK" if $c == &ACCESS_ACCEPT; $result = "fail" if $c == &ACCESS_REJECT; + $result = "fail-OK" if $c == &ACCESS_REJECT and $allowreject; } else { if (defined $r->get_error) { $result = "error: " . $r->strerror; @@ -181,7 +187,12 @@ sub pingone { } $elapsed = $end - $start; $self->do_debug("$host: radius query $_: $result, $elapsed"); - push @times, $elapsed if (defined $c and $c == &ACCESS_ACCEPT); + if (defined $c) { + if ( $c == &ACCESS_ACCEPT or + ($c == &ACCESS_REJECT and $allowreject) ) { + push @times, $elapsed; + } + } } return sort { $a <=> $b } @times; } @@ -242,6 +253,11 @@ sub targetvars { _re => '\d+', _example => 1645, }, + allowreject => { + _doc => 'Treat "reject" responses as OK', + _re => '(true|false)', + _example => 'true', + }, }); } -- cgit v1.2.3-24-g4f1b