diff --git a/ChangeLog b/ChangeLog index 655f342..6c0326c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ Unreleased * (bugfix) Fix option -m to return all IPs of a hostname * (bugfix) Fix compatibility issue with AIX (#69, @blentzgh) * (bugfix) Fix -q not suppressing some ICMP error messages (#83) + * (bugfix) Fix -M expecting an argument, when it shouldn't 2017-01-11 David Schweikert * Version 3.15 diff --git a/ci/test-07-options-i-m.pl b/ci/test-07-options-i-m.pl index e4529d9..9a22d13 100755 --- a/ci/test-07-options-i-m.pl +++ b/ci/test-07-options-i-m.pl @@ -1,10 +1,11 @@ #!/usr/bin/perl -w -use Test::Command tests => 4; +use Test::Command tests => 7; # -i n interval between sending ping packets (in millisec) (default 25) # -l loop sending pings forever # -m ping multiple interfaces on target host +# -M don't fragment # fping -i n { @@ -22,4 +23,12 @@ $cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 84 bytes, 0\.\d+ ms \(0.\d+ avg, 0% l }); } +# fping -M +{ +my $cmd = Test::Command->new(cmd => "fping -M 127.0.0.1"); +$cmd->exit_is_num(0); +$cmd->stdout_is_eq("127.0.0.1 is alive\n"); +$cmd->stderr_is_eq(""); +} + # fping -m -> test-14-internet-hosts diff --git a/ci/test-14-ping-internet-hosts.pl b/ci/test-14-ping-internet-hosts.pl index 4677bf3..12dfe5f 100755 --- a/ci/test-14-ping-internet-hosts.pl +++ b/ci/test-14-ping-internet-hosts.pl @@ -9,7 +9,7 @@ if(!gethostbyname("www.google.com")) { exit 0; } -plan tests => 18; +plan tests => 21; my $re_num = qr{\d+(?:\.\d+)?}; @@ -70,3 +70,11 @@ $cmd->exit_is_num(0); $cmd->stdout_is_eq("google-public-dns-a.google.com is alive\n"); $cmd->stderr_is_eq(""); } + +# fping -M +{ +my $cmd = Test::Command->new(cmd => "fping -r 0 -b 10000 -M 8.8.8.8"); +$cmd->exit_is_num(1); +$cmd->stdout_is_eq("8.8.8.8 is unreachable\n"); +$cmd->stderr_is_eq("8.8.8.8: error while sending ping: Message too long\n"); +} diff --git a/src/fping.c b/src/fping.c index 88a10b7..0713241 100644 --- a/src/fping.c +++ b/src/fping.c @@ -385,7 +385,7 @@ int main( int argc, char **argv ) /* get command line options */ - while( ( c = getopt( argc, argv, "gedhlmnNqusaAvDRz:t:H:i:p:f:r:c:b:C:Q:B:S:I:T:O:M:o" ) ) != EOF ) + while( ( c = getopt( argc, argv, "ADMNRadeghlmnoqsuvzB:C:H:I:O:Q:S:T:b:c:f:i:p:r:t:" ) ) != EOF ) { switch( c ) {