idnits 2.17.1 draft-mlichvar-ntp-correction-field-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (October 1, 2018) is 2024 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Outdated reference: A later version (-28) exists of draft-ietf-ntp-using-nts-for-ntp-13 Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet Engineering Task Force M. Lichvar 3 Internet-Draft Red Hat 4 Intended status: Experimental October 1, 2018 5 Expires: April 4, 2019 7 NTP Correction Field 8 draft-mlichvar-ntp-correction-field-03 10 Abstract 12 This document specifies an extension field for the Network Time 13 Protocol (NTP) which improves resolution of specific fields in the 14 NTP header and allows network devices such as switches and routers to 15 modify NTP packets with corrections to improve accuracy of the 16 synchronization in the network. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at https://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on April 4, 2019. 35 Copyright Notice 37 Copyright (c) 2018 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (https://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 1. Introduction 52 Processing and queueing delays in network switches and routers may be 53 a significant source of jitter and asymmetry in network delay, which 54 has a negative impact on accuracy and stability of clocks 55 synchronized by NTP [RFC5905]. 57 If all network devices on the paths between NTP clients and servers 58 implemented NTP and supported an operation as a server and client, 59 the impact of the delays could be avoided by configuring NTP to make 60 measurements only between devices and hosts that are directly 61 connected to one another. In the Precision Time Protocol (PTP) 62 [IEEE1588], which is a different protocol for synchronization of 63 clocks in networks, such devices are called Boundary Clocks (BC). 65 A different approach supported by PTP to improve the accuracy uses 66 Transparent Clocks (TC). Instead of fully implementing PTP in order 67 to support an operation as a BC, the devices only modify a correction 68 field in forwarded PTP packets with the time that the packets had to 69 wait for transmission. The final value of the correction is included 70 in the calculation of the delay and offset, which may significantly 71 improve the accuracy and stability of the synchronization. 73 This document describes an NTP extension field which allows the 74 devices to make a similar correction in forwarded NTP packets. 76 To better support a highly accurate synchronization, the extension 77 field also improves resolution of the receive and transmit timestamps 78 from the NTP header. 80 1.1. Requirements Language 82 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 83 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 84 document are to be interpreted as described in RFC 2119 [RFC2119]. 86 2. Format of Correction Field 88 The Correction Field is an NTP extension field following RFC 7822 89 [RFC7822]. The format of the extension field is shown in Figure 1. 91 0 1 2 3 92 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 93 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 94 | Field Type | Length (28) | 95 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 96 | | 97 + Origin Correction + 98 | | 99 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 100 | Origin ID | Receive Corr. | Transmit Corr.| 101 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 102 | | 103 + Delay Correction + 104 | | 105 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 106 | Path ID | Checksum complement | 107 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 109 Figure 1: Format of Correction Field 111 The extension field has the following fields: 113 Field Type 114 The type which identifies the Correction extension field. 115 TBD 117 Length 118 The length of the extension field, which is 28 octets. 120 Origin Correction 121 A field which contains a copy of the final delay correction 122 from the previous packet in the NTP exchange. 124 Origin ID 125 A field which contains a copy of the final path ID from the 126 previous packet in the NTP exchange. 128 Receive Correction 129 An 8-bit extension of the receive timestamp in the NTP header 130 increasing its resolution. The extended receive timestamp 131 has 32 integer bits and 40 fractional bits. 133 Transmit Correction 134 An 8-bit extension of the transmit timestamp in the NTP 135 header increasing its resolution. The extended transmit 136 timestamp has 32 integer bits and 40 fractional bits. 138 Delay Correction 139 A signed fixed-point number of nanoseconds with 48 integer 140 bits and 16 fractional bits, which represents the current 141 correction of the network delay that has accumulated for this 142 packet on the path from the source to the destination. The 143 format of this field is identical to the PTP correctionField. 145 Path ID 146 A 16-bit identification number of the path where the delay 147 correction was updated. 149 Checksum Complement 150 A field which can be modified in order to keep the UDP 151 checksum of the packet valid. This allows the UDP checksum 152 to be transmitted before the Correction Field is received and 153 modified. The same field is described in RFC 7821 [RFC7821]. 155 3. Network devices 157 A network device which is forwarding a packet and supports the 158 Correction Field MUST NOT modify the packet unless all of the 159 following applies: 161 1. The packet is an IPv4 or IPv6 UDP packet. 163 2. The source port or destination port is 123. 165 3. The NTP version is 4. 167 4. The NTP mode is 1, 2, 3, 4, or 5. 169 5. The format of the packet is valid per RFC 7822. 171 6. The packet contains an extension field which has a type of TBD 172 and length of 28 octets. 174 The device SHOULD add to the current value in the delay correction 175 field the length of an interval between the reception and 176 transmission of the packet. If the packet is transmitted at the same 177 speed as it was received and the length of the packet does not change 178 (e.g. due to adding or removing a VLAN tag), the beginning and end of 179 the interval may correspond to any point of the reception and 180 transmission as long as it is consistent for all forwarded packets of 181 the same length. If the transmission speed or length of the packet 182 is different, the beginning and end of the interval SHOULD correspond 183 to the end of the reception and beginning of the transmission 184 respectively. 186 If the transmission starts before the reception ends, a negative 187 value may need to be added to the delay correction. The end of the 188 reception SHOULD be determined using the length field of the UDP 189 header and the speed at which the packet is received. 191 If the device updates the delay correction, it SHOULD also add the 192 identification numbers of the incoming and outgoing port to the path 193 ID. 195 If the device modified any field of the extension field, it MUST 196 update the checksum complement field in order to keep the current UDP 197 checksum valid, or update the UDP checksum itself. 199 4. NTP hosts 201 When an NTP client sends a request to a server and the association is 202 configured to use the Correction Field, it SHOULD add the extension 203 field to the packet. All fields of the extension field except type 204 and length SHOULD be set to zero. 206 When the server receives a packet which includes the extension field, 207 the response SHOULD also include the extension field. 209 If the server's clock has a better precision than resolution of the 210 64-bit NTP timestamp format, the server SHOULD save the additional 211 bits in the receive and transmit correction fields and set the 212 precision field to the corresponding number, which is smaller than 213 -32. Otherwise, the receive and transmit correction fields SHOULD be 214 zero. 216 The origin correction and origin ID fields SHOULD be set to the delay 217 correction and path ID from the request. The other fields of the 218 Correction Field SHOULD be zero. 220 When the client receives a response which contains the extension 221 field, it SHOULD check the value of both the origin and delay 222 correction fields. If a correction is larger than a specified 223 maximum (e.g. 1 second), the extension field SHOULD be ignored. 225 The client MAY log a warning if the origin ID and path ID are not 226 equal, which indicates the network path between the server and client 227 is not symmetric. 229 If the client's clock has a better precision than resolution of the 230 64-bit NTP format and the precision field in the response contains a 231 number smaller than -32, the client SHOULD extend the receive and 232 transmit timestamp from the NTP header with the additional bits from 233 the receive and transmit correction fields respectively. 235 When the client calculates the offset and delay using the formulas 236 from RFC 5905, the origin correction is subtracted from the receive 237 timestamp and the delay correction is added to the transmit 238 timestamp. A conversion is necessary as the corrections are in 239 different units than the timestamps (nanoseconds vs seconds). 241 An NTP peer follows the rules of both servers and clients. It 242 processes Correction Fields in received packets as a client and sends 243 Correction Fields as a server. A packet which has a zero origin 244 timestamp (i.e. it is not a response to a request) SHOULD have a zero 245 origin correction and zero origin ID in the Correction Field. 247 A broadcast server using the Correction Field SHOULD always set the 248 origin correction and origin ID fields to zero. 250 5. Acknowledgements 252 The Correction Field extension is based on the PTP correction field 253 specified in IEEE 1588-2008. 255 The author would like to thank Tal Mizrahi and Harlan Stenn for their 256 useful comments. 258 6. IANA Considerations 260 IANA is requested to allocate an Extension Field Type for the 261 Correction Field. 263 7. Security Considerations 265 NTP packets including the Correction Field cannot be authenticated by 266 a legacy MAC, because the MAC has to cover all extension fields in 267 the packet and devices which are supposed to modify the field are not 268 able to update the MAC. 270 It is recommended to authenticate NTP packets using an authentication 271 extension field, e.g. the NTS Authenticator and Encrypted Extensions 272 [I-D.ietf-ntp-using-nts-for-ntp] extension field, and add the 273 Correction Field to the packet after the authentication field. 275 A man-in-the-middle attacker can delay packets in the network in 276 order to increase the measured delay and shift the measured offset by 277 up to half of the extra delay. If the packets contain the Correction 278 Field, the attacker can reduce the delay calculated by the client or 279 peer and shift the offset even more. The maximum correction should 280 be limited (e.g. to 1 second) to prevent the attacker from injecting 281 a larger offset to the measurements. 283 8. References 285 8.1. Normative References 287 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 288 Requirement Levels", BCP 14, RFC 2119, 289 DOI 10.17487/RFC2119, March 1997, 290 . 292 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 293 "Network Time Protocol Version 4: Protocol and Algorithms 294 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 295 . 297 [RFC7822] Mizrahi, T. and D. Mayer, "Network Time Protocol Version 4 298 (NTPv4) Extension Fields", RFC 7822, DOI 10.17487/RFC7822, 299 March 2016, . 301 8.2. Informative References 303 [I-D.ietf-ntp-using-nts-for-ntp] 304 Franke, D., Sibold, D., Teichel, K., Dansarie, M., and R. 305 Sundblad, "Network Time Security for the Network Time 306 Protocol", draft-ietf-ntp-using-nts-for-ntp-13 (work in 307 progress), August 2018. 309 [IEEE1588] 310 IEEE std. 1588-2008, "IEEE Standard for a Precision Clock 311 Synchronization Protocol for Networked Measurement and 312 Control Systems", 2008. 314 [RFC7821] Mizrahi, T., "UDP Checksum Complement in the Network Time 315 Protocol (NTP)", RFC 7821, DOI 10.17487/RFC7821, March 316 2016, . 318 Author's Address 320 Miroslav Lichvar 321 Red Hat 322 Purkynova 115 323 Brno 612 00 324 Czech Republic 326 Email: mlichvar@redhat.com