]> git.gsnw.org Git - fping.git/commitdiff
test --print-tos without raw socket
authorErik Auerswald <auerswal@unix-ag.uni-kl.de>
Sun, 28 Jul 2024 17:35:46 +0000 (19:35 +0200)
committerDavid Schweikert <david@schweikert.ch>
Thu, 1 Aug 2024 17:04:06 +0000 (19:04 +0200)
The current code can only read the TOS byte when using a raw
socket.  It prints '(TOS unknown)' when a datagram socket is
used.

ci/test-11-unpriv.pl

index 9cf529d5221fb52997a4b6cbdcad3152c7a0addb..0f10a1a370f708417fa3d35a259beba85aba72f6 100755 (executable)
@@ -35,7 +35,7 @@ else {
 }
 
 sub test_unprivileged_works {
-    plan tests => 3;
+    plan tests => 6;
 
     {
         my $cmd = Test::Command->new(cmd => "/tmp/fping.copy 127.0.0.1");
@@ -43,6 +43,12 @@ sub test_unprivileged_works {
         $cmd->stdout_is_eq("127.0.0.1 is alive\n");
         $cmd->stderr_is_eq("");
     }
+    {
+        my $cmd = Test::Command->new(cmd => "/tmp/fping.copy --print-tos 127.0.0.1");
+        $cmd->exit_is_num(0);
+        $cmd->stdout_is_eq("127.0.0.1 is alive (TOS unknown)\n");
+        $cmd->stderr_is_eq("");
+    }
 }
 
 sub test_privileged_fails {