From: German Service Network Date: Sun, 13 Oct 2024 21:00:51 +0000 (+0200) Subject: Chane ICMP Timestamp format when per_recv_flag true X-Git-Url: https://git.gsnw.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf57371b810344e996552c8ce9888e647d6a2558;p=fping.git Chane ICMP Timestamp format when per_recv_flag true --- diff --git a/ci/test-05-options-c-e.pl b/ci/test-05-options-c-e.pl index f8ca25a..fc1d387 100755 --- a/ci/test-05-options-c-e.pl +++ b/ci/test-05-options-c-e.pl @@ -84,12 +84,8 @@ if($^O eq 'darwin') { } my $cmd = Test::Command->new(cmd => "fping -4 --icmp-timestamp -c 2 127.0.0.1"); $cmd->exit_is_num(0); -$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) -ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+ -ICMP timestamp RTT tsrtt=\d+ -127\.0\.0\.1 : \[1\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\) -ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+ -ICMP timestamp RTT tsrtt=\d+ +$cmd->stdout_like(qr{127\.0\.0\.1 : \[0\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\), ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+ +127\.0\.0\.1 : \[1\], 20 bytes, \d\.\d+ ms \(\d\.\d+ avg, 0% loss\), ICMP timestamp: Originate=\d+ Receive=\d+ Transmit=\d+ }); $cmd->stderr_like(qr{127\.0\.0\.1 : xmt/rcv/%loss = 2/2/0%, min/avg/max = \d\.\d+/\d\.\d+/\d\.\d+ diff --git a/src/fping.c b/src/fping.c index 569a04d..55dabef 100644 --- a/src/fping.c +++ b/src/fping.c @@ -2404,7 +2404,6 @@ int wait_for_reply(int64_t wait_time) long ip_header_otime_ms = -1; long ip_header_rtime_ms = -1; long ip_header_ttime_ms = -1; - int tsrtt; /* Receive packet */ result = receive_packet(wait_time, /* max. wait time, in ns */ @@ -2610,18 +2609,16 @@ int wait_for_reply(int64_t wait_time) fprintf(stderr, " [<- %s]", buf); } - printf("\n"); - if (icmp_request_typ == 13) { if(ip_header_otime_ms != -1 && ip_header_rtime_ms != -1 && ip_header_ttime_ms != -1) { - printf("ICMP timestamp: Originate=%lu Receive=%lu Transmit=%lu\n", ip_header_otime_ms, ip_header_rtime_ms, ip_header_ttime_ms); - tsrtt = (ip_header_ttime_ms - ip_header_otime_ms) + (this_reply - (ip_header_rtime_ms - ip_header_otime_ms)); - printf("ICMP timestamp RTT tsrtt=%d\n", tsrtt); + printf(", ICMP timestamp: Originate=%lu Receive=%lu Transmit=%lu", ip_header_otime_ms, ip_header_rtime_ms, ip_header_ttime_ms); } else { - printf("ICMP timestamp: unknown\n"); + printf(", ICMP timestamp: unknown"); } } + + printf("\n"); } return 1;