Skip to content

Commit

Permalink
more tests with reply source != target
Browse files Browse the repository at this point in the history
The tests for --check-source verify that Echo reply packets
from a source IP that was not used as the target of the Echo
request are not accepted.  It does so for default fping, for
use with -c, and for use with -C.  Test if the source address
is really printed without --check-source, but with -c or -C.
  • Loading branch information
auerswal committed Jul 28, 2024
1 parent dda470a commit 39c9d30
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion ci/test-05-options-c-e.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w

use Test::Command tests => 63;
use Test::Command tests => 69;
use Test::More;

# -c n count of pings to send to each target (default 1)
Expand Down Expand Up @@ -64,6 +64,18 @@
});
}

# fping -c n ff02::1
SKIP: {
if($ENV{SKIP_IPV6}) {
skip 'Skip IPv6 tests', 3;
}
my $cmd = Test::Command->new(cmd => "fping -c 1 ff02::1");
$cmd->exit_is_num(0);
$cmd->stdout_like(qr{ff02::1 : \[0\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)\n});
$cmd->stderr_like(qr{ \[<- .*\]
ff02::1 : xmt/rcv/%loss = 1/1/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+\n});
}

# fping -C n
{
my $cmd = Test::Command->new(cmd => "fping -4 -C 2 -p 100 localhost 127.0.0.1");
Expand Down Expand Up @@ -128,6 +140,17 @@
});
}

# fping -C n ff02::1
SKIP: {
if($ENV{SKIP_IPV6}) {
skip 'Skip IPv6 tests', 3;
}
my $cmd = Test::Command->new(cmd => "fping -C 1 ff02::1");
$cmd->exit_is_num(0);
$cmd->stdout_like(qr{ff02::1 : \[0\], 64 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\)\n});
$cmd->stderr_like(qr{ \[<- .*\]\nff02::1 : \d\.\d+\n});
}

# fping --check-source
{
my $cmd = Test::Command->new(cmd => "fping --check-source 127.0.0.1 127.0.0.2");
Expand Down

0 comments on commit 39c9d30

Please sign in to comment.