Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ntp): version 4 encoded incorrectly (#4773)
This fixes an issue where version 4 was actually serialized as version 5 due to some binary math issues. It also fixes the fact the leap value was incorrect, it should have been set to unknown.
- Loading branch information
1 parent
091f871
commit b815521
Showing
4 changed files
with
31 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
package ntp | ||
|
||
const ( | ||
ntpClientModeValue uint8 = 3 // 00000011. | ||
ntpLeapEnabledValue uint8 = 64 // 01000000. | ||
ntpVersion3Value uint8 = 24 // 00011000. | ||
ntpVersion4Value uint8 = 40 // 00101000. | ||
) | ||
|
||
const ntpEpochOffset = 2208988800 | ||
|
||
const ( | ||
ntpV3 ntpVersion = iota | ||
ntpV4 | ||
) | ||
|
||
const ( | ||
maskMode = 0xf8 | ||
maskVersion = 0xc7 | ||
maskLeap = 0x3f | ||
) | ||
|
||
const ( | ||
modeClient = 3 | ||
) | ||
|
||
const ( | ||
version3 = 3 | ||
version4 = 4 | ||
) | ||
|
||
const ( | ||
leapUnknown = 3 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters