]> The Tcpdump Group git mirrors - tcpdump/commitdiff
LSP ping: Fix testing of TimeStamp Received.
authorDenis Ovsienko <[email protected]>
Sun, 20 Sep 2020 15:07:19 +0000 (16:07 +0100)
committerDenis Ovsienko <[email protected]>
Sun, 20 Sep 2020 15:33:02 +0000 (16:33 +0100)
"(int_part != 0) && (fraction != 0)" matches a value that has both
seconds and seconds fraction set to a non-zero value, hence it leaves
zero seconds (0.123) and exact seconds (123.0) out. This bug originates
in commit d1b0faed from 2004.

Fix the expression and update a test that, although prints its only
Receiver Timestamp as 0.000000000, in fact has seconds set to 0 and
seconds fraction set to 2.

print-lspping.c
tests/tok2str-oobr-2.out

index e798eeb10108f8f765b6a891460394982ef3dc2e..e4986a5e43d06057cdfb98fbdd81a7ec66317566 100644 (file)
@@ -595,7 +595,7 @@ lspping_print(netdissect_options *ndo,
     int_part=GET_BE_U_4(lspping_com_header->ts_rcvd.int_part);
     fraction=GET_BE_U_4(lspping_com_header->ts_rcvd.fraction);
     ND_PRINT("Receiver Timestamp: ");
-    if ((int_part != 0) && (fraction != 0))
+    if (! (int_part == 0 && fraction == 0))
         p_ntp_time(ndo, &lspping_com_header->ts_rcvd);
     else
         ND_PRINT("no timestamp");
index 29c40a5c59dc1302448343c38430d7fc341acc1f..b9de261c7a2f8aa7399102346855cc1ec3fc8d63 100644 (file)
@@ -6,7 +6,7 @@
          Return Code: unknown (65)
          Return Subcode: (0)
          Sender Handle: 0x00000023, Sequence: 1
-         Sender Timestamp: 3558141471.506155999 (2012-10-02T04:37:51Z) Receiver Timestamp: no timestamp
+         Sender Timestamp: 3558141471.506155999 (2012-10-02T04:37:51Z) Receiver Timestamp: 0.000000000
          Target FEC Stack TLV (1), length: 24
            Unknown subTLV (17), length: 20
              0x0000:  0000 0001 0000 0001 c0a8 0001 c0a8 0001