Currently, --print-tos only works with IPv4. In contrast
to IPv4, IPv6 raw sockets do not provide access to the
raw IP packet. Thus the method used to access the TOS
byte value of an IPv4 packet does not work for the TC byte
value of an IPv6 packet. This results in always generating
'(TOS unknown)' for IPv6 targets.
#!/usr/bin/perl -w
-use Test::Command tests => 42;
+use Test::Command tests => 45;
+use Test::More;
# -n show targets by name (-d is equivalent)
# -O n set the type of service (tos) flag on the ICMP packets
$cmd->stderr_is_eq("");
}
+# fping --print-tos with IPv6
+SKIP: {
+ if($ENV{SKIP_IPV6}) {
+ skip 'Skip IPv6 tests', 3;
+ }
+ my $cmd = Test::Command->new(cmd => "fping --print-tos ::1");
+ $cmd->exit_is_num(0);
+ $cmd->stdout_like(qr{::1 is alive \(TOS unknown\)\n});
+ $cmd->stderr_is_eq("");
+}
+
# fping -q
{
my $cmd = Test::Command->new(cmd => "fping -q -p 100 -c 3 127.0.0.1");