[ntp:questions] Help with reference identifier for stratum 2 version 4.
postermatt at no_spam_for_me.org
Sat Dec 12 16:28:13 UTC 2009
I've written a C# class to handle communications with a SNTP server, mainly
as a learning exercise. It is working perfectly except for one aspect which
has confused me. That is the reference identifier as it is used by secondary
servers and using version 4.
Here's what RFC 2030 says:
In the 'Introduction' section:
"In Version 4 secondary servers and clients, it [the reference identifier]
contains the low order 32 bits of the last transmit timestamp received from
the synchronization source."
In the 'Operating Modes and Addressing' section:
"In NTP Version 3, the reference identifier was often used to walk-back the
synchronization subnet to the root (primary server) for management purposes.
In NTP Version 4, this feature is not available, since the addresses are
longer than 32 bits. However, the intent in the protocol design was to
provide a way to detect and avoid loops. A peer could determine that a loop
was possible by comparing the contents of this field with the IPv4
destination address in the same packet. A NTP Version 4 server can
accomplish the same thing by comparing the contents of this field with the
low order 32 bits of the originate timestamp in the same packet. There is a
small possibility of false alarm in this scheme, but the false alarm rate
can be minimized by randomizing the low order unused bits of the transmit
Here's how far I've managed to get:
In the transmit timestamp that is sent to the server in the outgoing NTP
message, randomize the low order unused bits. That's just the final byte, so
I fill that final byte with a random value in the range 0..255.
As always the NTP/SNTP server copies the incoming transmit timestamp into
the originate timestamp section of the outgoing NTP message.
Now on receipt of the NTP message from the server, as some kind of error
checking that I don't really understand, the low order 32 bits of the
originate timestamp - its final 4 bytes - can be compared with the 4 bytes
of the reference identifier.
But what exactly as I supposed to do now? Should I convert both sets of 4
bytes to a double as if they were the low order bits of a timestamp (that's
what I did at first)? I don't think so, if I'm testing for equality then I
may as well skip that and compare the values of the 2 sequences of 4 bytes.
Either way I don't get equal values. But then I'm not sure I'm supposed to.
Any help explaining this to me would be greatly appreciated.
Many thanks and regards,
More information about the questions