Skip to main content

validate_ntp_packet_length

Function validate_ntp_packet_length 

Source
pub fn validate_ntp_packet_length(
    payload: &[u8],
) -> Result<(), NtpPacketParseError>
Expand description

ยงNTP Validation Process

  1. The NTP packet must be at least 48 bytes long.
  2. The Version Number (VN) in the first byte must be between 0 and 4.
  3. The Mode field (first byte) must be in [1, 2, 3, 4, 5] (Client, Server, Broadcast, etc.).
  4. The Stratum field must be between 0 and 15 for valid servers.
  5. The Timestamps must be logically consistent.