Internet Engineering Task Force | M. Lichvar |
Internet-Draft | Red Hat |
Updates: RFC7822 (if approved) | April 25, 2019 |
Intended status: Standards Track | |
Expires: October 27, 2019 |
NTPv4 Short Extension Fields
draft-mlichvar-ntp-short-extension-fields-01
This document specifies a new packet format for the Network Time Protocol version 4 (NTPv4) which is compatible with RFC 7822, but allows NTPv4 packets to contain shorter extension fields.
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."
This Internet-Draft will expire on October 27, 2019.
Copyright (c) 2019 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
RFC 7822 specifies a minimum length of extension fields in NTPv4 packets in order to prevent ambiguities in their parsing. Without these rules, an extension field in a valid NTPv4 packet could be parsed as a Message Authentication Code (MAC), or a MAC could be parsed as an extension field.
The minimum length of 28 octets forces extension fields that do not contain enough data to reach the minimum length to waste space. With multiple extension fields in a packet the wasted space accumulates.
A different issue with extension fields in NTPv4 packets is that servers/clients cannot pad a response/request to a specific length, e.g. to make their length symmetric when they contain different extension fields, or the sums of their lengths are different, unless one of the extension fields included in the request/response supports padding.
This document specifies a new NTPv4 format using three new extension fields:
Together, these extension fields allow NTPv4 packets to contain short extension fields, minimize the wasted space, and allow the packets to be padded to any length that meets the requirements of RFC 7822.
Older NTP implementations which follow RFC 7822 will parse a packet in the new format as a valid packet which contains a single unknown extension field, skipping all extension fields and/or MAC, and can respond as appropriate.
An implementation which supports the new format will parse all extension fields and/or MAC contained in the packet.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.
The Packing Field is an NTP extension field following RFC 7822, which contains one or more other extension fields. The format of the extension field is shown below.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Field Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Subfield 1 Type | Subfield 1 Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Subfield 1 Data . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Subfield N Type | Subfield N Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Subfield N Data . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 1: Format of Packing Field
The extension field has the following fields:
The Padding Field is an NTP extension field which does not contain any useful data. It does not follow the requirements from RFC 7822 and it MUST be contained in the Packing Field.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Field Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Padding . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 2: Format of Padding Field
The extension field has the following fields:
The MAC Field is an NTP extension field which contains a MAC as specified in RFC 5905. It does not follow the requirements from RFC 7822 and it MUST be contained in the Packing Field.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Field Type | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Key Identifier | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ . . . Message Digest . . . +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 3: Format of MAC Field
The extension field has the following fields:
An NTPv4 packet in the new format consists of:
The packet MUST have exactly one Packing Field and it MUST contain all other extension fields. The packet MUST NOT have a MAC outside the Packing Field. If there is not enough data to reach the minimum length of 28 octets, the Packing Field MUST include at least one Padding Field to increase the length of the Packing Field.
An implementation SHOULD check if the following applies to the UDP data before parsing it as an NTPv4 packet in the new format:
IANA is requested to allocate Extension Field Types for the Packing, Padding, and MAC Extension Fields.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC5905] | Mills, D., Martin, J., Burbank, J. and W. Kasch, "Network Time Protocol Version 4: Protocol and Algorithms Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010. |
[RFC7822] | Mizrahi, T. and D. Mayer, "Network Time Protocol Version 4 (NTPv4) Extension Fields", RFC 7822, DOI 10.17487/RFC7822, March 2016. |