From 788a8dcf53ec858b29fbe820a9484a94e6e6b4a2 Mon Sep 17 00:00:00 2001 From: Erik Auerswald Date: Sun, 28 Jul 2024 19:55:13 +0200 Subject: [PATCH] test --print-tos with an IPv6 target 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. --- ci/test-08-options-n-q.pl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ci/test-08-options-n-q.pl b/ci/test-08-options-n-q.pl index 5e14853..fc01012 100755 --- a/ci/test-08-options-n-q.pl +++ b/ci/test-08-options-n-q.pl @@ -1,6 +1,7 @@ #!/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 @@ -66,6 +67,17 @@ $cmd->stdout_like(qr{127\.0\.0\.1 is alive \(TOS 0\) $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"); -- 2.43.0