From dda470af74b7fe953c64989180a392f371951b32 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 5e148534..fc010127 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->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");