NTP Protocol

196 views
Skip to first unread message

Ulf Samuelsson

unread,
Sep 24, 2012, 10:44:36 AM9/24/12
to osti...@googlegroups.com
Interested in generating NTP packets using Ostinato to test an NTP server
under development.

NTP is a 48 byte payload UDP packet
Wondering about the best approach.

Is it to have both the NTP and the UDP in the packet,
or can I rely on the current support for UDP in a way,
and only implement the NTP part?

NTP is using 64 bit entities.
I had a brief look at the different protocols, but did not find
any that use a 64 bit field.
Anyone knows of the top of their heads a good example.
Worst case, I implement them as two 32 bit fields (seconds & fractions)

Best Regards
Ulf Samuelsson

Srivats P

unread,
Sep 24, 2012, 10:18:20 PM9/24/12
to Ulf Samuelsson, osti...@googlegroups.com
Ulf,

You need to implement just NTP. You should implement the protocolId() method to return the NTP port number (123) when the input param type is ProtocolIdTcpUdp (see textproto.cpp for an example). While building the packet, stack NTP on top of UDP and everything should work fine.

You can implement it in C++ (see http://ostinato.org/wiki/ProtocolBuilderHOWTO for reference) or as a UserScript (see http://ostinato.org/wiki/UserScriptHOWTO for reference)

None of the existing protocols have a 64bit entity and hence haven't used uint64, but it is possible to use it. You can also use it as two 32-bit entries as you mentioned.

Let me know if you have any further questions.

Regards,
Srivats


--
--
Get Ostinato News and Updates on Twitter - Follow @ostinato (http://twitter.com/ostinato)
---------
You received this message because you are subscribed to the Google Groups "ostinato" group.
To post to this group, send email to osti...@googlegroups.com
To unsubscribe from this group, send email to ostinato+u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/ostinato?hl=en






--
http://ostinato.org/
@ostinato

Ulf Samuelsson

unread,
Sep 25, 2012, 5:28:09 AM9/25/12
to osti...@googlegroups.com
On 2012-09-25 04:18, Srivats P wrote:
Ulf,

You need to implement just NTP. You should implement the protocolId() method to return the NTP port number (123) when the input param type is ProtocolIdTcpUdp (see textproto.cpp for an example). While building the packet, stack NTP on top of UDP and everything should work fine.

You can implement it in C++ (see http://ostinato.org/wiki/ProtocolBuilderHOWTO for reference) or as a UserScript (see http://ostinato.org/wiki/UserScriptHOWTO for reference)

None of the existing protocols have a 64bit entity and hence haven't used uint64, but it is possible to use it. You can also use it as two 32-bit entries as you mentioned.

Let me know if you have any further questions.
One of the issues, is that NTP might add authentication as an option.
This adds 20 bytes to the standard 48 byte NTP packet.
Not 100% sure how it is detected that the Authentication is present,
but I have a feeling that it is the packet size that determines if it it present
or not, and this is in the UDP header.

Is there any way you can determine the size of your packet?
I.E: Get info about the UDP fields, from the NTP class.

BR
Ulf

Srivats P

unread,
Sep 25, 2012, 10:34:50 PM9/25/12
to Ulf Samuelsson, osti...@googlegroups.com
Its the other way round.

Since Ostinato is a traffic generator, the NTP protocol itself needs to specify (user selecting via the UI) whether the packet will contain the optional authentication. If the optional fields are not to be included in the packet, fieldData() for those fields will return a zero sized QByteArray as FieldFrameValue. UDP can then correctly calculate and put the length value in its header.

Let me know if something is not clear or I misread your question

Srivats

Ulf Samuelsson

unread,
Sep 26, 2012, 3:43:05 AM9/26/12
to osti...@googlegroups.com
On 2012-09-26 04:34, Srivats P wrote:
Its the other way round.

Since Ostinato is a traffic generator, the NTP protocol itself needs to specify (user selecting via the UI) whether the packet will contain the optional authentication. If the optional fields are not to be included in the packet, fieldData() for those fields will return a zero sized QByteArray as FieldFrameValue. UDP can then correctly calculate and put the length value in its header.

No, I just started looking at the incoming packets, and that start wireshark.
Just bad thinking on my part.
Sorry,
Ulf
Reply all
Reply to author
Forward
0 new messages