Skip to content

Commit 5ba8290

Browse files
committed
LSP ping: Fix testing of TimeStamp Received.
"(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 d1b0fae 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.
1 parent f58e26a commit 5ba8290

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

print-lspping.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ lspping_print(netdissect_options *ndo,
595595
int_part=GET_BE_U_4(lspping_com_header->ts_rcvd.int_part);
596596
fraction=GET_BE_U_4(lspping_com_header->ts_rcvd.fraction);
597597
ND_PRINT("Receiver Timestamp: ");
598-
if ((int_part != 0) && (fraction != 0))
598+
if (! (int_part == 0 && fraction == 0))
599599
p_ntp_time(ndo, &lspping_com_header->ts_rcvd);
600600
else
601601
ND_PRINT("no timestamp");

tests/tok2str-oobr-2.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Return Code: unknown (65)
77
Return Subcode: (0)
88
Sender Handle: 0x00000023, Sequence: 1
9-
Sender Timestamp: 3558141471.506155999 (2012-10-02T04:37:51Z) Receiver Timestamp: no timestamp
9+
Sender Timestamp: 3558141471.506155999 (2012-10-02T04:37:51Z) Receiver Timestamp: 0.000000000
1010
Target FEC Stack TLV (1), length: 24
1111
Unknown subTLV (17), length: 20
1212
0x0000: 0000 0001 0000 0001 c0a8 0001 c0a8 0001

0 commit comments

Comments
 (0)