mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:55:07 -05:00
ntp: add special value to experimental root delay/disp
The maximum value of the new 32-bit fields is slightly less than 16, which can cause the NTP test #7 to pass for a server which has a zero root delay but maximum root dispersion. Interpret the maximum value as the maximum value of the original 32-bit fields (~65536.0 seconds) for better compatibility with NTPv4.
This commit is contained in:
@@ -515,7 +515,9 @@ test_unit(void)
|
||||
TEST_CHECK(UTI_DoubleToNtp32f28(8.0) == htonl(0x80000000));
|
||||
TEST_CHECK(UTI_DoubleToNtp32f28(16.0) == htonl(0xffffffff));
|
||||
TEST_CHECK(UTI_DoubleToNtp32f28(16.1) == htonl(0xffffffff));
|
||||
TEST_CHECK(UTI_DoubleToNtp32f28(16.1) == htonl(0xffffffff));
|
||||
|
||||
TEST_CHECK(UTI_Ntp32f28ToDouble(htonl(0xffffffff)) >= 65535.999);
|
||||
for (i = 0; i < 100000; i++) {
|
||||
UTI_GetRandomBytes(&ntp32_ts, sizeof (ntp32_ts));
|
||||
TEST_CHECK(UTI_DoubleToNtp32(UTI_Ntp32ToDouble(ntp32_ts)) == ntp32_ts);
|
||||
|
||||
Reference in New Issue
Block a user