From 9eb3e9ccd4d3d9fa6494a4e543d2948ceacf3639 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Wed, 30 Dec 2009 16:04:14 +0000 Subject: add support for TOS setting in fping --- lib/Smokeping/probes/FPing.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Smokeping/probes/FPing.pm b/lib/Smokeping/probes/FPing.pm index fc56ae5..66f9a07 100644 --- a/lib/Smokeping/probes/FPing.pm +++ b/lib/Smokeping/probes/FPing.pm @@ -65,6 +65,7 @@ sub new($$$) my $testhost = $self->testhost; my $return = `$binary -C 1 $testhost 2>&1`; $self->{enable}{S} = (`$binary -h 2>&1` =~ /\s-S\s/); + $self->{enable}{O} = (`$binary -h 2>&1` =~ /\s-O\s/); croak "ERROR: fping ('$binary -C 1 $testhost') could not be run: $return" if $return =~ m/not found/; croak "ERROR: FPing must be installed setuid root or it will not work\n" @@ -124,6 +125,11 @@ sub ping ($){ } push @params, "-S$self->{properties}{sourceaddress}" if $self->{properties}{sourceaddress} and $self->{enable}{S}; + if ($self->rounds_count == 1 and $self->{properties}{tos} and not $self->{enable}{O}){ + $self->do_log("WARNING: your fping binary doesn't support type of service setting (-O), I will ignore any tos configurations."); + } + push @params, "-O$self->{properties}{tos}" if $self->{properties}{tos} and $self->{enable}{O}; + my $pings = $self->pings; if (($self->{properties}{blazemode} || '') eq 'true'){ $pings++; @@ -227,6 +233,15 @@ DOC The fping "-S" parameter . From fping(1): Set source address. +DOC + }, + tos => { + _re => '\d+|0x[0-9a-zA-Z]+', + _example => '0x20', + _doc => <