idnits 2.17.1 draft-ietf-ippm-owdp-13.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3667, Section 5.1 on line 18. -- Found old boilerplate from RFC 3978, Section 5.5 on line 2248. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 2225. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 2232. ** Found boilerplate matching RFC 3978, Section 5.4, paragraph 1 (on line 2254), which is fine, but *also* found old RFC 2026, Section 10.4C, paragraph 1 text on line 38. ** The document seems to lack an RFC 3978 Section 5.1 IPR Disclosure Acknowledgement -- however, there's a paragraph with a matching beginning. Boilerplate error? ** This document has an original RFC 3978 Section 5.4 Copyright Line, instead of the newer IETF Trust Copyright according to RFC 4748. ** This document has an original RFC 3978 Section 5.5 Disclaimer, instead of the newer disclaimer which includes the IETF Trust according to RFC 4748. ** The document seems to lack an RFC 3979 Section 5, para. 3 IPR Disclosure Invitation -- however, there's a paragraph with a matching beginning. Boilerplate error? ** The document uses RFC 3667 boilerplate or RFC 3978-like boilerplate instead of verbatim RFC 3978 boilerplate. After 6 May 2005, submission of drafts without verbatim RFC 3978 boilerplate is not accepted. The following non-3978 patterns matched text found in the document. That text should be removed or replaced: By submitting this Internet-Draft, I certify that any applicable patent or other IPR claims of which I am aware have been disclosed, or will be disclosed, and any of which I become aware will be disclosed, in accordance with RFC 3668. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 2 instances of too long lines in the document, the longest one being 2 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the RFC 3978 Section 5.4 Copyright Line does not match the current year == Line 185 has weird spacing: '...eceiver the...' == The document seems to lack the recommended RFC 2119 boilerplate, even if it appears to use RFC 2119 keywords. (The document does seem to have the reference to RFC 2119 which the ID-Checklist requires). == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: If the server rejects a Request-Session message, it SHOULD not close the TCP connection. The client MAY close it if it receives negative response to the Request-Session message. -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (December 2004) is 7071 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC 1305' is mentioned on line 1265, but not defined ** Obsolete undefined reference: RFC 1305 (Obsoleted by RFC 5905) -- Looks like a reference, but probably isn't: '1' on line 1985 -- Looks like a reference, but probably isn't: '16' on line 1893 == Missing Reference: 'Loop' is mentioned on line 1579, but not defined == Missing Reference: 'K' is mentioned on line 1906, but not defined -- Looks like a reference, but probably isn't: '4' on line 1952 -- Looks like a reference, but probably isn't: '2' on line 1983 -- Looks like a reference, but probably isn't: '0' on line 1961 -- Looks like a reference, but probably isn't: '15' on line 2025 -- Looks like a reference, but probably isn't: '1000000' on line 2114 == Unused Reference: 'RFC2026' is defined on line 2124, but no explicit reference was found in the text == Unused Reference: 'RFC2330' is defined on line 2130, but no explicit reference was found in the text == Unused Reference: 'RFC2836' is defined on line 2143, but no explicit reference was found in the text == Unused Reference: 'RIPE-NLUUG' is defined on line 2166, but no explicit reference was found in the text == Unused Reference: 'SURVEYOR-INET' is defined on line 2173, but no explicit reference was found in the text == Unused Reference: 'RFC1305' is defined on line 2178, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES' ** Downref: Normative reference to an Informational RFC: RFC 1321 ** Downref: Normative reference to an Informational RFC: RFC 2330 ** Obsolete normative reference: RFC 2679 (Obsoleted by RFC 7679) ** Obsolete normative reference: RFC 2680 (Obsoleted by RFC 7680) ** Obsolete normative reference: RFC 2836 (Obsoleted by RFC 3140) -- Obsolete informational reference (is this intentional?): RFC 1305 (Obsoleted by RFC 5905) Summary: 14 errors (**), 0 flaws (~~), 14 warnings (==), 16 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group Stanislav Shalunov 3 Internet Draft Benjamin Teitelbaum 4 Expiration Date: June 2005 Anatoly Karp 5 Jeff W. Boote 6 Matthew J. Zekauskas 7 Internet2 8 December 2004 10 A One-way Active Measurement Protocol (OWAMP) 11 13 Status of this Memo 15 By submitting this Internet-Draft, I certify that any applicable 16 patent or other IPR claims of which I am aware have been disclosed, 17 and any of which I become aware will be disclosed, in accordance with 18 RFC 3668. 20 Internet-Drafts are working documents of the Internet Engineering 21 Task Force (IETF), its areas, and its working groups. Note that 22 other groups may also distribute working documents as 23 Internet-Drafts. 25 Internet-Drafts are draft documents valid for a maximum of six months 26 and may be updated, replaced, or obsoleted by other documents at any 27 time. It is inappropriate to use Internet-Drafts as reference 28 material or to cite them other than as "work in progress." 30 The list of current Internet-Drafts can be accessed at 31 http://www.ietf.org/ietf/1id-abstracts.txt 33 The list of Internet-Draft Shadow Directories can be accessed at 34 http://www.ietf.org/shadow.html. 36 Copyright Notice 38 Copyright (C) The Internet Society 2004. All Rights Reserved. 40 Abstract 42 With growing availability of good time sources to network nodes, it 43 becomes increasingly possible to measure one-way IP performance 44 metrics with high precision. To do so in an interoperable manner, a 45 common protocol for such measurements is required. The One-Way 46 Active Measurement Protocol (OWAMP) can measure one-way delay, as 47 well as other unidirectional characteristics, such as one-way loss. 49 Table of Contents 51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 3 52 1.1. Relationship of Test and Control Protocols . . . . . . 4 53 1.2. Logical Model . . . . . . . . . . . . . . . . . . . . 5 54 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . 6 55 3. OWAMP-Control . . . . . . . . . . . . . . . . . . . . . . . 7 56 3.1. Connection Setup . . . . . . . . . . . . . . . . . . . 7 57 3.2. Integrity Zero Padding (IZP) . . . . . . . . . . . . . 10 58 3.3. Values of the Accept Field . . . . . . . . . . . . . . 11 59 3.4. OWAMP-Control Commands . . . . . . . . . . . . . . . . 11 60 3.5. Creating Test Sessions . . . . . . . . . . . . . . . . 12 61 3.6. Send Schedules . . . . . . . . . . . . . . . . . . . . 17 62 3.7. Starting Test Sessions . . . . . . . . . . . . . . . . 18 63 3.8. Stop-Sessions . . . . . . . . . . . . . . . . . . . . 19 64 3.9. Fetch-Session . . . . . . . . . . . . . . . . . . . . 22 65 4. OWAMP-Test . . . . . . . . . . . . . . . . . . . . . . . . 27 66 4.1. Sender Behavior . . . . . . . . . . . . . . . . . . . 27 67 4.1.1. Packet Timings . . . . . . . . . . . . . . . . . 27 68 4.1.2. Packet Format and Content . . . . . . . . . . . . 28 69 4.2. Receiver Behavior . . . . . . . . . . . . . . . . . . 31 70 5. Computing Exponentially Distributed Pseudo-Random Numbers . 33 71 5.1. High-Level Description of the Algorithm . . . . . . . 33 72 5.2. Data Types, Representation, and Arithmetic . . . . . . 34 73 5.3. Uniform Random Quantities . . . . . . . . . . . . . . 35 74 6. Security Considerations . . . . . . . . . . . . . . . . . . 36 75 6.1. Introduction . . . . . . . . . . . . . . . . . . . . . 36 76 6.2. Preventing Third-Party Denial of Service . . . . . . . 37 77 6.3. Covert Information Channels . . . . . . . . . . . . . 37 78 6.4. Requirement to Include AES in Implementations . . . . 37 79 6.5. Resource Use Limitations . . . . . . . . . . . . . . . 37 80 6.6. Use of Cryptographic Primitives in OWAMP . . . . . . . 38 81 6.7. Required Properties of MD5 . . . . . . . . . . . . . . 39 82 6.8. The Use of AES-CBC-MAC . . . . . . . . . . . . . . . . 41 83 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . 42 84 8. Internationalization Considerations . . . . . . . . . . . . 42 85 9. Appendix A: Sample C Code for Exponential Deviates . . . . 42 86 10. Appendix B: Test Vectors for Exponential Deviates . . . . 47 87 11. Normative References . . . . . . . . . . . . . . . . . . . 48 88 12. Informative References . . . . . . . . . . . . . . . . . . 48 89 13. Authors' Addresses . . . . . . . . . . . . . . . . . . . . 49 91 1. Introduction 93 The IETF IP Performance Metrics (IPPM) working group has proposed 94 draft standard metrics for one-way packet delay [RFC2679] and loss 95 [RFC2680] across Internet paths. Although there are now several 96 measurement platforms that implement collection of these metrics 97 [SURVEYOR] [RIPE] [BRIX], there is not currently a standard that 98 would permit initiation of test streams or exchange of packets to 99 collect singleton metrics in an interoperable manner. 101 With the increasingly wide availability of affordable global 102 positioning systems (GPS) and CDMA-based time sources, hosts 103 increasingly have available to them very accurate time 104 sources--either directly or through their proximity to Network Time 105 Protocol (NTP) primary (stratum 1) time servers. By standardizing a 106 technique for collecting IPPM one-way active measurements, we hope to 107 create an environment where IPPM metrics may be collected across a 108 far broader mesh of Internet paths than is currently possible. One 109 particularly compelling vision is of widespread deployment of open 110 OWAMP servers that would make measurement of one-way delay as 111 commonplace as measurement of round-trip time using an ICMP-based 112 tool like ping. 114 Additional design goals of OWAMP include being hard to detect and 115 manipulate, security, logical separation of control and test 116 functionality, and support for small test packets. (Being hard to 117 detect makes interference with measurements more difficult for 118 intermediaries in the middle of the network.) 120 OWAMP test traffic is hard to detect because it is simply a stream of 121 UDP packets from and to negotiated port numbers, with potentially 122 nothing static in the packets (size is negotiated, as well). OWAMP 123 also supports an encrypted mode that further obscures the traffic, at 124 the same time making it impossible to alter timestamps undetectably. 126 Security features include optional authentication and/or encryption 127 of control and test messages. These features may be useful to 128 prevent unauthorized access to results or man-in-the-middle attackers 129 who attempt to provide special treatment to OWAMP test streams or who 130 attempt to modify sender-generated timestamps to falsify test 131 results. 133 The key words "MUST", "REQUIRED", "SHOULD", "RECOMMENDED", and "MAY" 134 in this document are to be interpreted as described in [RFC2119]. 136 1.1. Relationship of Test and Control Protocols 138 OWAMP actually consists of two inter-related protocols: OWAMP-Control 139 and OWAMP-Test. OWAMP-Control is used to initiate, start, and stop 140 test sessions and fetch their results, while OWAMP-Test is used to 141 exchange test packets between two measurement nodes. 143 Although OWAMP-Test may be used in conjunction with a control 144 protocol other than OWAMP-Control, the authors have deliberately 145 chosen to include both protocols in the same draft to encourage the 146 implementation and deployment of OWAMP-Control as a common 147 denominator control protocol for one-way active measurements. Having 148 a complete and open one-way active measurement solution that is 149 simple to implement and deploy is crucial to assuring a future in 150 which inter-domain one-way active measurement could become as 151 commonplace as ping. We neither anticipate nor recommend that 152 OWAMP-Control form the foundation of a general-purpose extensible 153 measurement and monitoring control protocol. 155 OWAMP-Control is designed to support the negotiation of one-way 156 active measurement sessions and results retrieval in a 157 straightforward manner. At session initiation, there is a negotiation 158 of sender and receiver addresses and port numbers, session start 159 time, session length, test packet size, the mean Poisson sampling 160 interval for the test stream, and some attributes of the very general 161 RFC 2330 notion of packet type, including packet size and per-hop 162 behavior (PHB) [RFC2474], which could be used to support the 163 measurement of one-way network characteristics across differentiated 164 services networks. Additionally, OWAMP-Control supports per-session 165 encryption and authentication for both test and control traffic, 166 measurement servers that can act as proxies for test stream 167 endpoints, and the exchange of a seed value for the pseudo-random 168 Poisson process that describes the test stream generated by the 169 sender. 171 We believe that OWAMP-Control can effectively support one-way active 172 measurement in a variety of environments, from publicly accessible 173 measurement beacons running on arbitrary hosts to network monitoring 174 deployments within private corporate networks. If integration with 175 Simple Network Management Protocol (SNMP) or proprietary network 176 management protocols is required, gateways may be created. 178 1.2. Logical Model 180 Several roles are logically separated to allow for broad flexibility 181 in use. Specifically, we define: 183 Session-Sender the sending endpoint of an OWAMP-Test session; 185 Session-Receiver the receiving endpoint of an OWAMP-Test session; 187 Server an end system that manages one or more OWAMP-Test 188 sessions, is capable of configuring per-session 189 state in session endpoints, and is capable of 190 returning the results of a test session; 192 Control-Client an end system that initiates requests for 193 OWAMP-Test sessions, triggers the start of a set 194 of sessions, and may trigger their termination; and 196 Fetch-Client an end system that initiates requests to fetch 197 the results of completed OWAMP-Test sessions. 199 One possible scenario of relationships between these roles is shown 200 below. 202 +----------------+ +------------------+ 203 | Session-Sender |--OWAMP-Test-->| Session-Receiver | 204 +----------------+ +------------------+ 205 ^ ^ 206 | | 207 | | 208 | | 209 | +----------------+<----------------+ 210 | | Server |<-------+ 211 | +----------------+ | 212 | ^ | 213 | | | 214 | OWAMP-Control OWAMP-Control 215 | | | 216 v v v 217 +----------------+ +-----------------+ 218 | Control-Client | | Fetch-Client | 219 +----------------+ +-----------------+ 221 (Unlabeled links in the figure are unspecified by this draft and may 222 be proprietary protocols.) 224 Different logical roles can be played by the same host. For example, 225 in the figure above, there could actually be only two hosts: one 226 playing the roles of Control-Client, Fetch-Client, and 227 Session-Sender, and the other playing the roles of Server and 228 Session-Receiver. This is shown below. 230 +-----------------+ +------------------+ 231 | Control-Client |<--OWAMP-Control-->| Server | 232 | Fetch-Client | | | 233 | Session-Sender |---OWAMP-Test----->| Session-Receiver | 234 +-----------------+ +------------------+ 236 Finally, because many Internet paths include segments that transport 237 IP over ATM, delay and loss measurements can include the effects of 238 ATM segmentation and reassembly (SAR). Consequently, OWAMP has been 239 designed to allow for small test packets that would fit inside the 240 payload of a single ATM cell (this is only achieved in 241 unauthenticated and encrypted modes). 243 2. Protocol Overview 245 As described above, OWAMP consists of two inter-related protocols: 246 OWAMP-Control and OWAMP-Test. The former is layered over TCP and is 247 used to initiate and control measurement sessions and to fetch their 248 results. The latter protocol is layered over UDP and is used to send 249 singleton measurement packets along the Internet path under test. 251 The initiator of the measurement session establishes a TCP connection 252 to a well-known port on the target point and this connection remains 253 open for the duration of the OWAMP-Test sessions. IANA will be 254 requested to allocate a well-known port number for OWAMP-Control 255 sessions. An OWAMP server SHOULD listen to this well-known port. 257 OWAMP-Control messages are transmitted only before OWAMP-Test 258 sessions are actually started and after they complete (with the 259 possible exception of an early Stop-Sessions message). 261 The OWAMP-Control and OWAMP-Test protocols support three modes of 262 operation: unauthenticated, authenticated, and encrypted. The 263 authenticated or encrypted modes require endpoints to possess a 264 shared secret. 266 All multi-octet quantities defined in this document are represented 267 as unsigned integers in network byte order unless specified 268 otherwise. 270 3. OWAMP-Control 272 Each type of OWAMP-Control message has a fixed length. The recipient 273 will know the full length of a message after examining the first 16 274 octets of it. No message is shorter than 16 octets. 276 If the full message is not received within 30 minutes after it is 277 expected, connection SHOULD be dropped. 279 3.1. Connection Setup 281 Before either a Control-Client or a Fetch-Client can issue commands 282 of a Server, it has to establish a connection to the server. 284 First, a client opens a TCP connection to the server on a well-known 285 port. The server responds with a server greeting: 287 0 1 2 3 288 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 289 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 290 | | 291 | Unused (12 octets) | 292 | | 293 |+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 294 | Modes | 295 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 296 | | 297 | Challenge (16 octets) | 298 | | 299 | | 300 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 302 The following Mode values are meaningful: 1 for unauthenticated, 2 303 for authenticated, and 4 for encrypted. The value of the Modes field 304 sent by the server is the bit-wise OR of the mode values that it is 305 willing to support during this session. Thus, the last three bits of 306 the Modes 32-bit value are used. The first 29 bits MUST be zero. A 307 client MUST ignore the values in the first 29 bits of the Modes 308 value. (This way, the bits are available for future protocol 309 extensions. This is the only intended extension mechanism.) 311 Challenge is a random sequence of octets generated by the server; it 312 is used subsequently by the client to prove possession of a shared 313 secret in a manner prescribed below. 315 If Modes value is zero, the server does not wish to communicate with 316 the client and MAY close the connection immediately. The client 317 SHOULD close the connection if it receives a greeting with Modes 318 equal to zero. The client MAY close the connection if the client's 319 desired mode is unavailable. 321 Otherwise, the client MUST respond with the following message: 323 0 1 2 3 324 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 325 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 326 | Mode | 327 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 328 | | 329 . . 330 . Username (16 octets) . 331 . . 332 | | 333 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 334 | | 335 . . 336 . Token (32 octets) . 337 . . 338 | | 339 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 340 | | 341 . . 342 . Client-IV (16 octets) . 343 . . 344 | | 345 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 347 Here Mode is the mode that the client chooses to use during this 348 OWAMP-Control session. It will also be used for all OWAMP-Test 349 sessions started under control of this OWAMP-Control session. In 350 Mode, one or zero bits MUST be set within last three bits. The first 351 29 bits of Mode MUST be zero. A server MUST ignore the values of the 352 first 29 bits. 354 In unauthenticated mode, Username, Token, and Client-IV are unused. 356 Otherwise, Username is a 16-octet indicator that tells the server 357 which shared secret the client wishes to use to authenticate or 358 encrypt, while Token is the concatenation of a 16-octet challenge and 359 a 16-octet Session-key, encrypted using the AES (Advanced Encryption 360 Standard) [AES] in Cipher Block Chaining (CBC). Encryption MUST be 361 performed using an Initialization Vector (IV) of zero and a key value 362 that is the shared secret associated with Username. (Both the server 363 and the client use the same mappings from user names to secret keys. 364 The server, being prepared to conduct sessions with more than one 365 client, uses user names to choose the appropriate secret key; a 366 client would typically have different secret keys for different 367 servers. The situation is analogous to that of passwords, except 368 that secret keys, rather than being the typical low-entropy 369 passwords, are suitable for use as AES keys.) The shared secret will 370 typically be provided as a passphrase; in this case, the MD5 sum 371 [RFC1321] of the passphrase (without possible newline character(s) at 372 the end of the passphrase) MUST be used as a key for encryption by 373 the client and decryption by the server (the passphrase also MUST NOT 374 contain newlines in the middle). 376 Session-key and Client-IV are generated randomly by the client. 377 Session-key MUST be generated with sufficient entropy not to reduce 378 the security of the underlying cipher. Client-IV merely needs to be 379 unique (i.e., it MUST never be repeated for different sessions using 380 the same secret key; a simple way to achieve that without the use of 381 cumbersome state is to generate the Client-IV strings using a 382 cryptographically secure pseudo-random number source: if this is 383 done, the first repetition is unlikely to occur before 2^64 sessions 384 with the same secret key are conducted). 386 The server MUST respond with the following message: 388 0 1 2 3 389 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 390 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 391 | | 392 | MBZ (15 octets) | 393 | | 394 | +-+-+-+-+-+-+-+-+ 395 | | Accept | 396 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 397 | | 398 | Server-IV (16 octets) | 399 | | 400 | | 401 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 402 | Uptime (Timestamp) | 403 | | 404 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 405 | IZP (8 octets) | 406 | | 407 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 409 The MBZ 15-octet part MUST be zero. The client MUST ignore its 410 value. MBZ (MUST be zero) fields here and hereafter have the same 411 semantics: the party that sends the message MUST set the field to a 412 string of zero bits; the party that interprets the message MUST 413 ignore the value. (This way the field could be used for future 414 extensions.) 416 Server-IV is generated randomly by the server. In unauthenticated 417 mode, Server-IV is unused. 419 The Accept field indicates the server's willingness to continue 420 communication. A zero value in the Accept field means that the 421 server accepts the authentication and is willing to conduct further 422 transactions. Non-zero values indicate that the server does not 423 accept the authentication or, for some other reason, is not willing 424 to conduct further transactions in this OWAMP-Control session. The 425 full list of available Accept values is described in the ``Values of 426 the Accept Field'' section. 428 If a negative (non-zero) response is sent, the server MAY and the 429 client SHOULD close the connection after this message. 431 Uptime is a timestamp representing the time when the current 432 instantiation of the server started operating. (For example, in a 433 multi-user general purpose operating system (OS), it could be the 434 time when the server process was started.) If Accept is non-zero, 435 Uptime SHOULD be set to a string of zeros. In authenticated and 436 encrypted modes, Uptime is encrypted as described in the next 437 section, unless Accept is non-zero. (Authenticated and encrypted mode 438 cannot be entered unless the control connection can be initialized.) 440 Timestamp format is described in ``Sender Behavior'' section below. 441 The same instantiation of the server SHOULD report the same exact 442 Uptime value to each client in each session. 444 Integrity Zero Padding (IZP) is treated the same way as IZP in the 445 next section and beyond. 447 The previous transactions constitute connection setup. 449 3.2. Integrity Zero Padding (IZP) 451 IZP MUST be all zeros in all messages that use IZP. The recipient of 452 a message where IZP is not zero MUST reject the message, as it is an 453 indication of tampering with the content of the message by an 454 intermediary (or brokenness). If the message is part of 455 OWAMP-Control, the session MUST be terminated and results 456 invalidated. If the message is part of OWAMP-Test, it MUST be 457 silently ignored. This will ensure data integrity. In 458 unauthenticated mode, IZP is nothing more than a simple check. In 459 authenticated and encrypted modes, however, it ensures, in 460 conjunction with properties of CBC chaining mode, that everything 461 received before was not tampered with. For this reason, it is 462 important to check the IZP field as soon as possible, so that bad 463 data doesn't get propagated. 465 3.3. Values of the Accept Field 467 Accept values are used throughout the OWAMP-Control protocol to 468 communicate the server response to client requests. The full set of 469 valid Accept field values are: 471 0 OK. 473 1 Failure, reason unspecified (catch-all). 475 2 Internal error. 477 3 Some aspect of request is not supported. 479 4 Cannot perform request due to permanent resource limitations. 481 5 Cannot perform request due to temporary resource limitations. 483 All other values are reserved. The sender of the message MAY use the 484 value of 1 for all non-zero Accept values. A message sender SHOULD 485 use the correct Accept value if it is going to use other values. The 486 message receiver MUST interpret all values of Accept other than these 487 reserved values as 1. This way, other values are available for 488 future extensions. 490 3.4. OWAMP-Control Commands 492 In authenticated or encrypted mode (which are identical as far as 493 OWAMP-Control is concerned, and only differ in OWAMP-Test) all 494 further communications are encrypted with the Session-key, using CBC 495 mode. The client encrypts its stream using Client-IV. The server 496 encrypts its stream using Server-IV. 498 The following commands are available for the client: Request-Session, 499 Start-Sessions, Stop-Sessions, and Fetch-Session. The command 500 Stop-Sessions is available to both the client and the server. (The 501 server can also send other messages in response to commands it 502 receives.) 504 After the client sends the Start-Sessions command and until it both 505 sends and receives (in an unspecified order) the Stop-Sessions 506 command, it is said to be conducting active measurements. Similarly, 507 the server is said to be conducting active measurements after it 508 receives the Start-Sessions command and until it both sends and 509 receives (in an unspecified order) the Stop-Sessions command. 511 While conducting active measurements, the only command available is 512 Stop-Sessions. 514 These commands are described in detail below. 516 3.5. Creating Test Sessions 518 Individual one-way active measurement sessions are established using 519 a simple request/response protocol. An OWAMP client MAY issue zero or 520 more Request-Session messages to an OWAMP server, which MUST respond 521 to each with an Accept-Session message. An Accept-Session message 522 MAY refuse a request. 524 The format of Request-Session message is as follows: 526 0 1 2 3 527 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 528 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 529 | 1 | MBZ | IPVN | Conf-Sender | Conf-Receiver | 530 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 531 | Number of Schedule Slots | 532 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 533 | Number of Packets | 534 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 535 | Sender Port | Receiver Port | 536 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 537 | Sender Address | 538 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 539 | | 540 | Sender Address (cont.) or MBZ (12 octets) | 541 | | 542 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 543 | Receiver Address | 544 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 545 | | 546 | Receiver Address (cont.) or MBZ (12 octets) | 547 | | 548 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 549 | | 550 | SID (16 octets) | 551 | | 552 | | 553 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 554 | Padding Length | 555 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 556 | Start Time | 557 | | 558 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 559 | Timeout, (8 octets) | 560 | | 561 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 562 | Type-P Descriptor | 563 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 564 | MBZ (8 octets) | 565 | | 566 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 567 | | 568 | IZP (16 octets) | 569 | | 570 | | 571 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 573 This is immediately followed by one or more schedule slot 574 descriptions (the number of schedule slots is specified in the 575 `Number of Schedule Slots' field above): 577 0 1 2 3 578 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 579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 580 | Slot Type | | 581 +-+-+-+-+-+-+-+-+ MBZ (15 octets) | 582 | | 583 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 584 | Slot Parameter (Timestamp) | 585 | | 586 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 588 These are immediately followed by IZP: 590 0 1 2 3 591 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 592 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 593 | | 594 | IZP (16 octets) | 595 | | 596 | | 597 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 599 All these messages comprise one logical message: the Request-Session 600 command. 602 Above, the first octet (1) indicates that this is Request-Session 603 command. 605 IPVN is the IP version numbers for Sender and Receiver. When the IP 606 version number is 4, 12 octets follow the 4-octet IPv4 address stored 607 in Sender Address and Receiver Address. These octets MUST be set to 608 zero by the client and MUST be ignored by the server. Currently 609 meaningful IPVN values are 4 and 6. 611 Conf-Sender and Conf-Receiver MUST be set to 0 or 1 by the client. 612 The server MUST interpret any non-zero value as 1. If the value is 613 1, the server is being asked to configure the corresponding agent 614 (sender or receiver). In this case, the corresponding Port value 615 SHOULD be disregarded by the server. At least one of Conf-Sender and 616 Conf-Receiver MUST be 1. (Both can be set, in which case the server 617 is being asked to perform a session between two hosts it can 618 configure.) 620 Number of Schedule Slots, as mentioned before, specifies the number 621 of slot records that go between the two blocks of IZP. It is used by 622 the sender to determine when to send test packets (see next section). 624 Number of Packets is the number of active measurement packets to be 625 sent during this OWAMP-Test session (note that both server and client 626 can abort the session early). 628 If Conf-Sender is not set, Sender Port is the UDP port from which 629 OWAMP-Test packets will be sent. If Conf-Receiver is not set, 630 Receiver Port is the UDP port OWAMP-Test to which packets are 631 requested to be sent. 633 The Sender Address and Receiver Address fields contain, respectively, 634 the sender and receiver addresses of the end points of the Internet 635 path over which an OWAMP test session is requested. 637 SID is the session identifier. It can be used in later sessions as 638 an argument for the Fetch-Session command. It is meaningful only if 639 Conf-Receiver is 0. This way, the SID is always generated by the 640 receiving side. See the end of the section for information on how 641 the SID is generated. 643 Padding length is the number of octets to be appended to the normal 644 OWAMP-Test packet (see more on padding in discussion of OWAMP-Test). 646 Start Time is the time when the session is to be started (but not 647 before Start-Sessions command is issued). This timestamp is in the 648 same format as OWAMP-Test timestamps. 650 Timeout (or a loss threshold) is an interval of time (expressed as a 651 timestamp). A packet belonging to the test session that is being set 652 up by the current Request-Session command will be considered lost if 653 it is not received during Timeout seconds after it is sent. 655 Type-P Descriptor covers only a subset of (very large) Type-P space. 656 If the first two bits of the Type-P Descriptor are 00, then 657 subsequent six bits specify the requested Differentiated Services 658 Codepoint (DSCP) value of sent OWAMP-Test packets, as defined in 659 RFC 2474. If the first two bits of Type-P descriptor are 01, then 660 the subsequent 16 bits specify the requested PHB Identification Code 661 (PHB ID), as defined in RFC 2836. 663 Therefore, the value of all zeros specifies the default best-effort 664 service. 666 If Conf-Sender is set, the Type-P Descriptor is to be used to 667 configure the sender to send packets according to its value. If 668 Conf-Sender is not set, the Type-P Descriptor is a declaration of how 669 the sender will be configured. 671 If Conf-Sender is set and the server does not recognize the Type-P 672 Descriptor, or it cannot or does not wish to set the corresponding 673 attributes on OWAMP-Test packets, it SHOULD reject the session 674 request. If Conf-Sender is not set, the server SHOULD accept or 675 reject the session paying no attention to the value of the Type-P 676 Descriptor. 678 To each Request-Session message, an OWAMP server MUST respond with an 679 Accept-Session message: 681 0 1 2 3 682 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 683 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 684 | Accept | MBZ | Port | 685 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| 686 | | 687 | SID (16 octets) | 688 | | 689 | | 690 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 691 | | 692 | IZP (12 octets) | 693 | | 694 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 696 In this message, zero in the Accept field means that the server is 697 willing to conduct the session. A non-zero value indicates rejection 698 of the request. The full list of available Accept values is 699 described in the ``Values of the Accept Field'' section. 701 If the server rejects a Request-Session message, it SHOULD not close 702 the TCP connection. The client MAY close it if it receives negative 703 response to the Request-Session message. 705 The meaning of Port in the response depends on the values of 706 Conf-Sender and Conf-Receiver in the query that solicited the 707 response. If both were set, the Port field is unused. If only 708 Conf-Sender was set, Port is the port from which to expect OWAMP-Test 709 packets. If only Conf-Receiver was set, Port is the port to which 710 OWAMP-Test packets are sent. 712 If only Conf-Sender was set, the SID field in the response is unused. 713 Otherwise, SID is a unique server-generated session identifier. It 714 can be used later as handle to fetch the results of a session. 716 SIDs SHOULD be constructed by concatenation of the 4-octet IPv4 IP 717 number belonging to the generating machine, an 8-octet timestamp, and 718 a 4-octet random value. To reduce the probability of collisions, if 719 the generating machine has any IPv4 addresses (with the exception of 720 loopback), one of them SHOULD be used for SID generation, even if all 721 communication is IPv6-based. If it has no IPv4 addresses at all, the 722 last four octets of an IPv6 address MAY be used instead. Note that 723 SID is always chosen by the receiver. If truly random values are not 724 available, it is important that the SID be made unpredictable, as 725 knowledge of the SID might be used for access control. 727 3.6. Send Schedules 729 The sender and the receiver both need to know the same send schedule. 730 This way, when packets are lost, the receiver knows when they were 731 supposed to be sent. It is desirable to compress common schedules 732 and still to be able to use an arbitrary one for the test sessions. 733 In many cases, the schedule will consist of repeated sequences of 734 packets: this way, the sequence performs some test, and the test is 735 repeated a number of times to gather statistics. 737 To implement this, we have a schedule with a given number of slots. 738 Each slot has a type and a parameter. Two types are supported: 739 exponentially distributed pseudo-random quantity (denoted by a code 740 of 0) and a fixed quantity (denoted by a code of 1). The parameter 741 is expressed as a timestamp and specifies a time interval. For a 742 type 0 slot (exponentially distributed pseudo-random quantity) this 743 interval is the mean value (or 1/lambda if the distribution density 744 function is expressed as lambda*exp(-lambda*x) for positive values of 745 x). For a type 1 (fixed quantity) slot, the parameter is the delay 746 itself. The sender starts with the beginning of the schedule, and 747 executes the instructions in the slots: for a slot of type 0, wait an 748 exponentially distributed time with a mean of the specified parameter 749 and then send a test packet (and proceed to the next slot); for a 750 slot of type 1, wait the specified time and send a test packet (and 751 proceed to the next slot). The schedule is circular: when there are 752 no more slots, the sender returns to the first slot. 754 The sender and the receiver need to be able to reproducibly execute 755 the entire schedule (so, if a packet is lost, the receiver can still 756 attach a send timestamp to it). Slots of type 1 are trivial to 757 reproducibly execute. To reproducibly execute slots of type 0, we 758 need to be able to generate pseudo-random exponentially distributed 759 quantities in a reproducible manner. The way this is accomplished is 760 discussed later. 762 Using this mechanism one can easily specify common testing scenarios. 763 Some examples include: 765 + Poisson stream: a single slot of type 0; 767 + Periodic stream: a single slot of type 1; 769 + Poisson stream of back-to-back packet pairs: two slots -- type 0 770 with a non-zero parameter and type 1 with a zero parameter. 772 Further, a completely arbitrary schedule can be specified (albeit 773 inefficiently) by making the number of test packets equal to the 774 number of schedule slots. In this case, the complete schedule is 775 transmitted in advance of an OWAMP-Test session. 777 3.7. Starting Test Sessions 779 Having requested one or more test sessions and received affirmative 780 Accept-Session responses, an OWAMP client MAY start the execution of 781 the requested test sessions by sending a Start-Sessions message to 782 the server. 784 The format of this message is as follows: 786 0 1 2 3 787 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 788 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 789 | 2 | | 790 +-+-+-+-+-+-+-+-+ | 791 | MBZ (15 octets) | 792 | | 793 | | 794 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 795 | | 796 | IZP (16 octets) | 797 | | 798 | | 799 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 801 The server MUST respond with an Start-Ack message (which SHOULD be 802 sent as quickly as possible). Start-Ack messages have the following 803 format: 805 0 1 2 3 806 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 807 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 808 | Accept | | 809 +-+-+-+-+-+-+-+-+ | 810 | MBZ (15 octets) | 811 | | 812 | | 813 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 814 | | 815 | IZP (16 octets) | 816 | | 817 | | 818 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 820 If Accept is non-zero, the Start-Sessions request was rejected; zero 821 means that the command was accepted. The full list of available 822 Accept values is described in the ``Values of the Accept Field'' 823 section. The server MAY, and the client SHOULD, close the connection 824 in the case of a rejection. 826 The server SHOULD start all OWAMP-Test streams immediately after it 827 sends the response or immediately after their specified start times, 828 whichever is later. If the client represents a Sender, the client 829 SHOULD start its OWAMP-Test streams immediately after it sees the 830 Start-Ack response from the Server (if the Start-Sessions command was 831 accepted) or immediately after their specified start times, whichever 832 is later. See more on OWAMP-Test sender behavior in a separate 833 section below. 835 3.8. Stop-Sessions 837 The Stop-Sessions message may be issued by either the Control-Client 838 or the Server. The format of this command is as follows: 840 0 1 2 3 841 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 842 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 843 | 3 | Accept | MBZ | 844 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 845 | Number of Sessions | 846 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 847 | MBZ (8 octets) | 848 | | 849 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 851 This is immediately followed by zero or more session description 852 records (the number of session description records is specified in 853 the ``Number of Sessions'' field above). The session description 854 record is used to indicate which packets were actually sent by the 855 sender process (rather than skipped). The header of the session 856 description record is as follows: 858 0 1 2 3 859 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 860 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| 861 | | 862 | SID (16 octets) | 863 | | 864 | | 865 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 866 | Next Seqno | 867 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 868 | Number of Skip Ranges | 869 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 871 This is immediately followed by zero or more Skip Range descriptions 872 as specified by the ``Number of Skip Ranges'' field above. Skip 873 Ranges are simply two sequence numbers that, together, indicate a 874 range of packets that were not sent: 876 0 1 2 3 877 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 878 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| 879 | First Seqno Skipped | 880 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 881 | Last Seqno Skipped | 882 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 884 Skip Ranges MUST be in order. The last (possibly full, possibly 885 incomplete) block (16 octets) of data MUST be padded with zeros, if 886 necessary. This ensures that the next session description record 887 starts on a block boundary. 889 Finally, a single block (16 octets) of IZP is concatenated on the end 890 to complete the Stop-Sessions message. 892 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 893 | | 894 | IZP (16 octets) | 895 | | 896 | | 897 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 899 All these records comprise one logical message: the Stop-Sessions 900 command. 902 Above, the first octet (3) indicates that this is the Stop-Sessions 903 command. 905 Non-zero Accept values indicate a failure of some sort. Zero values 906 indicate normal (but possibly premature) completion. The full list 907 of available Accept values is described in the ``Values of the Accept 908 Field'' section. 910 If Accept had a non-zero value (from either party), results of all 911 OWAMP-Test sessions spawned by this OWAMP-Control session SHOULD be 912 considered invalid, even if a Fetch-Session with SID from this 913 session works for a different OWAMP-Control session. If Accept was 914 not transmitted at all (for whatever reason, including the TCP 915 connection used for OWAMP-Control breaking), the results of all 916 OWAMP-Test sessions spawned by this OWAMP-control session MAY be 917 considered invalid. 919 Number of Sessions indicates the number of session description 920 records that immediately follow the Stop-Sessions header. 922 Number of Sessions MUST contain the number of send sessions started 923 by the local side of the control connection that have not been 924 previously terminated by a Stop-Sessions command (i.e., the 925 Control-Client MUST account for each accepted Request-Session where 926 Conf-Receiver was set; the Control-Server MUST account for each 927 accepted Request-Session where Conf-Sender was set). If the 928 Stop-Sessions message does not account for exactly the send sessions 929 controlled by that side, then it is to be considered invalid and the 930 connection SHOULD be closed and any results obtained considered 931 invalid. 933 Each session description record represents one OWAMP-Test session. 935 SID is the session identifier (SID) used to indicate which send 936 session is being described. 938 Next Seqno indicates the next sequence number that would have been 939 sent from this send session. For completed sessions, this will equal 940 NumPackets from the Request-Session. 942 Number of Skip Ranges indicates the number of holes that actually 943 occurred in the sending process. This is a range of packets that were 944 never actually sent by the sending process. For example, if a send 945 session is started too late for the first 10 packets to be sent and 946 this is the only hole in the schedule, then ``Number of Skip Ranges'' 947 would be 1. The single Skip Range description will have First Seqno 948 Skipped equal to 0 and Last Seqno Skipped equal to 9. This is 949 described further in the ``Sender Behavior'' section. 951 If the OWAMP-Control connection breaks when the Stop-Sessions command 952 is sent, the receiver MAY not completely invalidate the session 953 results. It MUST discard all record of packets that follow (in other 954 words, have greater sequence number than) the last packet that was 955 actually received before before any lost packet records. This will 956 help differentiate between packet losses that occurred in the network 957 and packets the sending process may have never sent. 959 If a receiver of an OWAMP-Test session learns, through an OWAMP- 960 Control Stop-Sessions message, that the OWAMP-Test sender's last 961 sequence number is lower than any sequence number actually received, 962 the results of the complete OWAMP-Test session MUST be invalidated. 964 A receiver of an OWAMP-Test session, upon receipt of an OWAMP-Control 965 Stop-Sessions command, MUST discard any packet records -- including 966 lost packet records -- with a (computed) send time that falls between 967 the current time minus Timeout and the current time. This ensures 968 statistical consistency for the measurement of loss and duplicates in 969 the event that the Timeout is greater than the time it takes for the 970 Stop-Sessions command to take place. 972 To effect complete sessions, each side of the control connection 973 SHOULD wait until all sessions are complete before sending the 974 Stop-Sessions message. The completed time of each sessions is 975 determined as Timeout after the scheduled time for the last sequence 976 number. Endpoints MAY add a small increment to the computed 977 completed time for send endpoints to ensure the Stop-Sessions message 978 reaches the receiver endpoint after Timeout. 980 To effect a premature stop of sessions, the party that initiates this 981 command MUST stop its OWAMP-Test send streams to send the Session 982 Packets Sent values before sending this command. That party SHOULD 983 wait until receiving the response Stop-Sessions message before 984 stopping the receiver streams so that it can use the values from the 985 received Stop-Sessions message to validate the data. 987 3.9. Fetch-Session 989 The format of this client command is as follows: 991 0 1 2 3 992 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 993 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 994 | 4 | | 995 +-+-+-+-+-+-+-+-+ | 996 | MBZ (7 octets) | 997 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 998 | Begin Seq | 999 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1000 | End Seq | 1001 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1002 | | 1003 | SID (16 octets) | 1004 | | 1005 | | 1006 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1007 | | 1008 | IZP (16 octets) | 1009 | | 1010 | | 1011 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1013 Begin Seq is the sequence number of the first requested packet. End 1014 Seq is the sequence number of the last requested packet. If Begin 1015 Seq is all zeros and End Seq is all ones, complete session is said to 1016 be requested. 1018 If a complete session is requested and the session is still in 1019 progress, or has terminated in any way other than normal, the request 1020 to fetch session results MUST be denied. If an incomplete session is 1021 requested, all packets received so far that fall into the requested 1022 range SHOULD be returned. Note that, since no commands can be issued 1023 between Start-Sessions and Stop-Sessions, incomplete requests can 1024 only happen on a different OWAMP-Control connection (from the same or 1025 different host as Control-Client). 1027 The server MUST respond with a Fetch-Ack message. The format of this 1028 server response is as follows: 1030 0 1 2 3 1031 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 1032 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1033 | Accept | Finished | MBZ (2 octets) | 1034 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1035 | Next Seqno | 1036 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1037 | Number of Skip Ranges | 1038 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1039 | Number of Records | 1040 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1041 | | 1042 | IZP (16 octets) | 1043 | | 1044 | | 1045 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1047 Again, non-zero in the Accept field means a rejection of command. 1048 The server MUST specify zero for all remaining fields if Accept is 1049 non-zero. The client MUST ignore all remaining fields (except for the 1050 IZP) if Accept is non-zero. The full list of available Accept values 1051 is described in the ``Values of the Accept Field'' section. 1053 Finished is non-zero if the OWAMP-Test session has terminated. 1055 Next Seqno indicates the next sequence number that would have been 1056 sent from this send session. For completed sessions, this will equal 1057 NumPackets from the Request-Session. This information is only 1058 available if the session has terminated. If Finished is zero, then 1059 Next Seqno MUST be set to zero by the server. 1061 Number of Skip Ranges indicates the number of holes that actually 1062 occurred in the sending process. This information is only available 1063 if the session has terminated. If Finished is zero, then Skip Ranges 1064 MUST be set to zero by the server. 1066 Number of Records is the number of packet records that fall within 1067 the requested range. This number might be less than the Number of 1068 Packets in the reproduction of the Request-Session command because of 1069 a session that ended prematurely or it might be greater because of 1070 duplicates. 1072 If Accept was non-zero, this concludes the response to the Fetch- 1073 Session message. If Accept was 0, the server then MUST immediately 1074 send the OWAMP-Test session data in question. 1076 The OWAMP-Test session data consists of the following (concatenated): 1078 + A reproduction of the Request-Session command that was used to 1079 start the session; it is modified so that actual sender and 1080 receiver port numbers that were used by the OWAMP-Test session 1081 always appear in the reproduction. 1083 + Zero or more (as specified) Skip Range descriptions. The last 1084 (possibly full, possibly incomplete) block (16 octets) of Skip 1085 Range descriptions is padded with zeros if necessary. (These 1086 zeros are simple padding and should be distinguished from the 16 1087 octets of IZP that follow.) 1089 + 16 octets of IZP. 1091 + Zero or more (as specified) packet records. The last (possibly 1092 full, possibly incomplete) block (16 octets) of data is padded 1093 with zeros if necessary. (These zeros are simple padding and 1094 should be distinguished from the 16 octets of IZP that follow.) 1096 + 16 octets of IZP. 1098 Skip Range descriptions are simply two sequence numbers that, 1099 together, indicate a range of packets that were not sent: 1101 0 1 2 3 1102 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 1103 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-| 1104 | First Seqno Skipped | 1105 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1106 | Last Seqno Skipped | 1107 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1109 Skip Range descriptions should be sent out in order, as sorted by 1110 First Seqno. If any Skip Ranges overlap, or are out of order, the 1111 session data is to be considered invalid and the connection SHOULD be 1112 closed and any results obtained considered invalid. 1114 Each packet record is 25 octets, and includes 4 octets of sequence 1115 number, 8 octets of send timestamp, 2 octets of send timestamp error 1116 estimate, 8 octets of receive timestamp, 2 octets of receive 1117 timestamp error estimate, and 1 octet of Time To Live (TTL), or Hop 1118 Limit in IPv6: 1120 0 1 2 3 1121 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 1122 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1123 00| Seq Number | 1124 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1125 04| Send Error Estimate | Receive Error Estimate | 1126 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1127 08| Send Timestamp | 1128 12| | 1129 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1130 16| Receive Timestamp | 1131 20| | 1132 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1133 24| TTL | 1134 +-+-+-+-+-+-+-+-+ 1136 Packet records are sent out in the same order the actual packets were 1137 received. Therefore, the data is in arrival order. 1139 Note that lost packets (if any losses were detected during the 1140 OWAMP-Test session) MUST appear in the sequence of packets. They can 1141 appear either at the point when the loss was detected or at any later 1142 point. Lost packet records are distinguished as follows: 1144 + A send timestamp filled with the presumed send time (as computed 1145 by the send schedule). 1147 + A send error estimate filled with Multiplier=1, Scale=64, and S=0 1148 (see the OWAMP-Test description for definition of these quantities 1149 and explanation of timestamp format and error estimate format). 1151 + A normal receive error estimate as determined by the error of the 1152 clock being used to declare the packet lost. (It is declared lost 1153 if it is not received by the Timeout after the presumed send time, 1154 as determined by the receiver's clock.) 1156 + A receive timestamp consisting of all zero bits. 1158 + A TTL value of 255. 1160 4. OWAMP-Test 1162 This section describes OWAMP-Test protocol. It runs over UDP using 1163 sender and receiver IP and port numbers negotiated during the 1164 Request-Session exchange. 1166 As with OWAMP-Control, OWAMP-Test has three modes: unauthenticated, 1167 authenticated, and encrypted. All OWAMP-Test sessions that are 1168 spawned by an OWAMP-Control session inherit its mode. 1170 OWAMP-Control client, OWAMP-Control server, OWAMP-Test sender, and 1171 OWAMP-Test receiver can potentially all be different machines. (In a 1172 typical case, we expect that there will be only two machines.) 1174 4.1. Sender Behavior 1176 4.1.1. Packet Timings 1178 Send schedules based on slots, described previously, in conjunction 1179 with scheduled session start time, enable the sender and the receiver 1180 to compute the same exact packet sending schedule independently of 1181 each other. These sending schedules are independent for different 1182 OWAMP-Test sessions, even if they are governed by the same 1183 OWAMP-Control session. 1185 Consider any OWAMP-Test session. Once Start-Sessions exchange is 1186 complete, the sender is ready to start sending packets. Under normal 1187 OWAMP use circumstances, the time to send the first packet is in the 1188 near future (perhaps a fraction of a second away). The sender SHOULD 1189 send packets as close as possible to their scheduled time, with the 1190 following exception: if the scheduled time to send is in the past, 1191 and separated from the present by more than Timeout time, the sender 1192 MUST NOT send the packet. (Indeed, such a packet would be considered 1193 lost by the receiver anyway.) The sender MUST keep track of which 1194 packets it does not send. It will use this to tell the receiver what 1195 packets were not sent by setting Skip Ranges in the Stop-Sessions 1196 message from the sender to the receiver upon completion of the test. 1197 The Skip Ranges are also sent to a Fetch-Client as part of the 1198 session data results. These holes in the sending schedule can happen 1199 if a time in the past was specified in the Request-Session command, 1200 or if the Start-Sessions exchange took unexpectedly long, or if the 1201 sender could not start serving the OWAMP-Test session on time due to 1202 internal scheduling problems of the OS. Packets in the past, but 1203 separated from the present by less than Timeout value, SHOULD be sent 1204 as quickly as possible. With normal test rates and timeout values, 1205 the number of packets in such a burst is limited. Nevertheless, 1206 hosts SHOULD NOT intentionally schedule sessions so that such bursts 1207 of packets occur. 1209 Regardless of any scheduling delays, each packet that is actually 1210 sent MUST have the best possible approximation of its real time of 1211 departure as its timestamp (in the packet). 1213 4.1.2. Packet Format and Content 1215 The sender sends the receiver a stream of packets with the schedule 1216 specified in the Request-Session command. The sender SHOULD set the 1217 TTL in IPv4 (or Hop Limit in IPv6) in the UDP packet to 255. The 1218 format of the body of a UDP packet in the stream depends on the mode 1219 being used. 1221 For unauthenticated mode: 1223 0 1 2 3 1224 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 1225 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1226 | Sequence Number | 1227 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1228 | Timestamp | 1229 | | 1230 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1231 | Error Estimate | | 1232 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 1233 | | 1234 . . 1235 . Packet Padding . 1236 . . 1237 | | 1238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1240 For authenticated and encrypted modes: 1242 0 1 2 3 1243 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 1244 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1245 | Sequence Number | 1246 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1247 | | 1248 | IZP (12 octets) | 1249 | | 1250 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1251 | Timestamp | 1252 | | 1253 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1254 | Error Estimate | | 1255 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 1256 | IZP (6 octets) | 1257 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1258 | | 1259 . . 1260 . Packet Padding . 1261 . . 1262 | | 1263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1265 The format of the timestamp is the same as in [RFC 1305] and is as 1266 follows: first 32 bits represent the unsigned integer number of 1267 seconds elapsed since 0h on 1 January 1900; next 32 bits represent 1268 the fractional part of a second that has elapsed since then. 1270 So, Timestamp is represented as follows: 1271 0 1 2 3 1272 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 1273 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1274 | Integer part of seconds | 1275 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1276 | Fractional part of seconds | 1277 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1279 The Error Estimate specifies the estimate of the error and 1280 synchronization. It has the following format: 1282 0 1 1283 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 1284 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1285 |S|Z| Scale | Multiplier | 1286 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 1288 The first bit S SHOULD be set if the party generating the timestamp 1289 has a clock that is synchronized to UTC using an external source 1290 (e.g., the bit should be set if GPS hardware is used and it indicates 1291 that it has acquired current position and time or if NTP is used and 1292 it indicates that it has synchronized to an external source, which 1293 includes stratum 0 source, etc.); if there is no notion of external 1294 synchronization for the time source, the bit SHOULD NOT be set. The 1295 next bit has the same semantics as MBZ fields elsewhere: it MUST be 1296 set to zero by the sender and ignored by everyone else. The next six 1297 bits, Scale, form an unsigned integer; Multiplier is an unsigned 1298 integer as well. They are interpreted as follows: the error estimate 1299 is equal to Multiplier*2^(-32)*2^Scale (in seconds). [Notation 1300 clarification: 2^Scale is two to the power of Scale.] Multiplier 1301 MUST NOT be set to zero. If Multiplier is zero, the packet SHOULD be 1302 considered corrupt and discarded. 1304 Sequence numbers start with zero and are incremented by one for each 1305 subsequent packet. 1307 The minimum data segment length is, therefore, 14 octets in 1308 unauthenticated mode, and 32 octets in both authenticated mode and 1309 encrypted modes. 1311 The OWAMP-Test packet layout is the same in authenticated and 1312 encrypted modes. The encryption operations are, however, different. 1313 The difference is that in encrypted mode both the sequence number and 1314 the timestamp are encrypted to provide maximum data integrity 1315 protection while in authenticated mode the sequence number is 1316 encrypted and the timestamp is sent in clear text. Sending the 1317 timestamp in clear text in authenticated mode allows one to reduce 1318 the time between when a timestamp is obtained by a sender and when 1319 the packet is shipped out. In encrypted mode, the sender has to 1320 fetch the timestamp, encrypt it, and send it; in authenticated mode, 1321 the middle step is removed, potentially improving accuracy (the 1322 sequence number can be encrypted before the timestamp is fetched). 1324 In authenticated mode, the first block (16 octets) of each packet is 1325 encrypted using AES Electronic Cookbook (ECB) mode. 1327 The key to use is obtained as follows: the 16-octet session 1328 identifier (SID) is encrypted with the same session key as is used 1329 for the corresponding OWAMP-Control session (where it is used in a 1330 different chaining mode); this is a single-block ECB encryption; its 1331 result is the key to use in encrypting (and decrypting) the packets 1332 of the particular OWAMP-Test session. 1334 ECB mode used for encrypting the first block of OWAMP-Test packets in 1335 authenticated mode does not involve any actual chaining; this way, 1336 lost, duplicated, or reordered packets do not cause problems with 1337 deciphering any packet in an OWAMP-Test session. 1339 In encrypted mode, the first two blocks (32 octets) are encrypted 1340 using AES CBC mode. The key to use is obtained in the same way as 1341 the key for authenticated mode. Each OWAMP-Test packet is encrypted 1342 as a separate stream, with just one chaining operation; chaining does 1343 not span multiple packets so that lost, duplicated, or reordered 1344 packets do not cause problems. The initialization vector for the CBC 1345 encryption is a string of zeros. 1347 Implementation note: Naturally, the key schedule for each OWAMP-Test 1348 session need only be set up once per session, not once per packet. 1350 In unauthenticated mode, no encryption is applied. 1352 Packet Padding in OWAMP-Test SHOULD be pseudo-random (it MUST be 1353 generated independently of any other pseudo-random numbers mentioned 1354 in this document). However, implementations MUST provide a 1355 configuration parameter, an option, or a different means of making 1356 Packet Padding consist of all zeros. 1358 The time elapsed between packets is computed according to the slot 1359 schedule as mentioned in Request-Session command description. At 1360 that point, we skipped over the issue of computing exponentially 1361 distributed pseudo-random numbers in a reproducible fashion. It is 1362 discussed later in a separate section. 1364 4.2. Receiver Behavior 1366 The receiver knows when the sender will send packets. The following 1367 parameter is defined: Timeout (from Request-Session). Packets that 1368 are delayed by more than Timeout are considered lost (or `as good as 1369 lost'). Note that there is never an actual assurance of loss by the 1370 network: a `lost' packet might still be delivered at any time. The 1371 original specification for IPv4 required that packets be delivered 1372 within TTL seconds or never (with TTL having a maximum value of 255). 1373 To the best of the authors' knowledge, this requirement was never 1374 actually implemented (and, of course, only a complete and universal 1375 implementation would ensure that packets do not travel for longer 1376 than TTL seconds). In fact, in IPv6, the name of this field has 1377 actually been changed to Hop Limit. Further, IPv4 specification 1378 makes no claims about the time it takes the packet to traverse the 1379 last link of the path. 1381 The choice of a reasonable value of Timeout is a problem faced by a 1382 user of OWAMP protocol, not by an implementor. A value such as two 1383 minutes is very safe. Note that certain applications (such as 1384 interactive `one-way ping') might wish to obtain the data faster than 1385 that. 1387 As packets are received, 1389 + Timestamp the received packet. 1391 + In authenticated or encrypted mode, decrypt the first block (16 1392 octets) of the packet body. 1394 + Store the packet sequence number, send time, receive time, and the 1395 TTL for IPv4 (or Hop Limit for IPv6) from the packet IP header for 1396 the results to be transferred. 1398 + Packets not received within the Timeout are considered lost. They 1399 are recorded with their true sequence number, presumed send time, 1400 receive time consisting of a string of zero bits, and TTL (or Hop 1401 Limit) of 255. 1403 Implementations SHOULD fetch the TTL/Hop Limit value from the IP 1404 header of the packet. If an implementation does not fetch the actual 1405 TTL value (the only good reason to not do so is inability to access 1406 the TTL field of arriving packets), it MUST record the TTL value as 1407 255. 1409 Packets that are actually received are recorded in the order of 1410 arrival. Lost packet records serve as indications of the send times 1411 of lost packets. They SHOULD be placed either at the point where the 1412 receiver learns about the loss or at any later point; in particular, 1413 one MAY place all the records that correspond to lost packets at the 1414 very end. 1416 Packets that have send time in the future MUST be recorded normally, 1417 without changing their send timestamp, unless they have to be 1418 discarded. (Send timestamps in the future would normally indicate 1419 clocks that differ by more than the delay. Some data -- such as 1420 jitter -- can be extracted even without knowledge of time difference. 1421 For other kinds of data, the adjustment is best handled by the data 1422 consumer on the basis of the complete information in a measurement 1423 session, as well as, possibly, external data.) 1425 Packets with a sequence number that was already observed (duplicate 1426 packets) MUST be recorded normally. (Duplicate packets are sometimes 1427 introduced by IP networks. The protocol has to be able to measure 1428 duplication.) 1430 If any of the following is true, the packet MUST be discarded: 1432 + Send timestamp is more than Timeout in the past or in the future. 1434 + Send timestamp differs by more than Timeout from the time when the 1435 packet should have been sent according to its sequence number. 1437 + In authenticated or encrypted mode, any of the bits of zero 1438 padding inside the first 16 octets of packet body is non-zero. 1440 5. Computing Exponentially Distributed Pseudo-Random Numbers 1442 Here we describe the way exponential random quantities used in the 1443 protocol are generated. While there is a fair number of algorithms 1444 for generating exponential random variables, most of them rely on 1445 having logarithmic function as a primitive, resulting in potentially 1446 different values, depending on the particular implementation of the 1447 math library. We use algorithm 3.4.1.S in [KNUTH], which is free 1448 of the above-mentioned problem, and guarantees the same output on any 1449 implementation. The algorithm belongs to the ziggurat family 1450 developed in the 1970s by G. Marsaglia, M. Sibuya and J. H. Ahrens 1451 [ZIGG]. It replaces the use of logarithmic function by clever bit 1452 manipulation, still producing the exponential variates on output. 1454 5.1. High-Level Description of the Algorithm 1456 For ease of exposition, the algorithm is first described with all 1457 arithmetic operations being interpreted in their natural sense. 1458 Later, exact details on data types, arithmetic, and generation of the 1459 uniform random variates used by the algorithm are given. It is an 1460 almost verbatim quotation from [KNUTH], p.133. 1462 Algorithm S: Given a real positive number 'mu', produce an 1463 exponential random variate with mean 'mu'. 1465 First, the constants 1467 Q[k] = (ln2)/(1!) + (ln2)^2/(2!) + ... + (ln2)^k/(k!), 1 <= k <= 11 1469 are computed in advance. The exact values which MUST be used by all 1470 implementations are given in the reference code (see Appendix A). 1471 This is necessary to insure that exactly the same pseudo-random 1472 sequences are produced by all implementations. 1474 S1. [Get U and shift.] Generate a 32-bit uniform random binary 1475 fraction 1477 U = (.b0 b1 b2 ... b31) [note the binary point] 1479 Locate the first zero bit b_j, and shift off the leading (j+1) bits, 1480 setting U <- (.b_{j+1} ... b31) 1482 Note: In the rare case that the zero has not been found, it is 1483 prescribed that the algorithm return (mu*32*ln2). 1485 S2. [Immediate acceptance?] If U < ln2, set X <- mu*(j*ln2 + U) and 1486 terminate the algorithm. (Note that Q[1] = ln2.) 1488 S3. [Minimize.] Find the least k >= 2 such that U < Q[k]. Generate k 1489 new uniform random binary fractions U1,...,Uk and set V <- 1490 min(U1,...,Uk). 1492 S4. [Deliver the answer.] Set X <- mu*(j + V)*ln2. 1494 5.2. Data Types, Representation, and Arithmetic 1496 The high-level algorithm operates on real numbers -- typically 1497 represented as floating point numbers. This specification prescribes 1498 that unsigned 64-bit integers be used instead. 1500 u_int64_t integers are interpreted as real numbers by placing the 1501 decimal point after the first 32 bits. In other words, conceptually, 1502 the interpretation is given by the map: 1504 u_int64_t u; 1506 u |--> (double)u / (2**32) 1508 The algorithm produces a sequence of such u_int64_t integers that, 1509 for any given value of SID, is guaranteed to be the same on any 1510 implementation. 1512 We specify that the u_int64_t representations of the first 11 values 1513 of the Q array in the high-level algorithm be as follows: 1515 #1 0xB17217F8, 1516 #2 0xEEF193F7, 1517 #3 0xFD271862, 1518 #4 0xFF9D6DD0, 1519 #5 0xFFF4CFD0, 1520 #6 0xFFFEE819, 1521 #7 0xFFFFE7FF, 1522 #8 0xFFFFFE2B, 1523 #9 0xFFFFFFE0, 1524 #10 0xFFFFFFFE, 1525 #11 0xFFFFFFFF 1527 For example, Q[1] = ln2 is indeed approximated by 0xB17217F8/(2**32) 1528 = 0.693147180601954; for j > 11, Q[j] is 0xFFFFFFFF. 1530 Small integer j in the high-level algorithm is represented as 1531 u_int64_t value j * (2**32). 1533 Operation of addition is done as usual on u_int64_t numbers; however, 1534 the operation of multiplication in the high-level algorithm should be 1535 replaced by 1537 (u, v) |---> (u * v) >> 32. 1539 Implementations MUST compute the product (u * v) exactly. For 1540 example, a fragment of unsigned 128-bit arithmetic can be implemented 1541 for this purpose (see sample implementation below). 1543 5.3. Uniform Random Quantities 1545 The procedure for obtaining a sequence of 32-bit random numbers (such 1546 as U in algorithm S) relies on using AES encryption in counter mode. 1547 To describe the exact working of the algorithm, we introduce two 1548 primitives from Rijndael. Their prototypes and specification are 1549 given below, and they are assumed to be provided by the supporting 1550 Rijndael implementation, such as [RIJN]. 1552 + A function that initializes a Rijndael key with bytes from seed 1553 (the SID will be used as the seed): 1555 void KeyInit(unsigned char seed[16]); 1557 + A function that encrypts the 16-octet block inblock with the 1558 specified key, returning a 16-octet encrypted block. Here 1559 keyInstance is an opaque type used to represent Rijndael keys: 1561 void BlockEncrypt(keyInstance key, unsigned char inblock[16]); 1563 Algorithm Unif: given a 16-octet quantity seed, produce a sequence of 1564 unsigned 32-bit pseudo-random uniformly distributed integers. In 1565 OWAMP, the SID (session ID) from Control protocol plays the role of 1566 seed. 1568 U1. [Initialize Rijndael key] key <- KeyInit(seed) [Initialize an 1569 unsigned 16-octet (network byte order) counter] c <- 0 U2. [Need 1570 more random bytes?] Set i <- c mod 4. If (i == 0) set s <- 1571 BlockEncrypt(key, c) 1573 U3. [Increment the counter as unsigned 16-octet quantity] c <- c + 1 1575 U4. [Do output] Output the i_th quartet of octets from s starting 1576 from high-order octets, converted to native byte order and 1577 represented as OWPNum64 value (as in 3.b). 1579 U5. [Loop] Go to step U2. 1581 6. Security Considerations 1583 6.1. Introduction 1585 The goal of authenticated mode to let one passphrase-protect service 1586 provided by a particular OWAMP-Control server. One can imagine a 1587 variety of circumstances where this could be useful. Authenticated 1588 mode is designed to prohibit theft of service. 1590 An additional design objective of the authenticated mode was to make 1591 it impossible for an attacker who cannot read traffic between OWAMP- 1592 Test sender and receiver to tamper with test results in a fashion 1593 that affects the measurements, but not other traffic. 1595 The goal of encrypted mode is quite different: to make it hard for a 1596 party in the middle of the network to make results look `better' than 1597 they should be. This is especially true if one of client and server 1598 does not coincide with either sender or receiver. 1600 Encryption of OWAMP-Control using AES CBC mode with blocks of zeros 1601 after each message aims to achieve two goals: (i) to provide secrecy 1602 of exchange; (ii) to provide authentication of each message. 1604 6.2. Preventing Third-Party Denial of Service 1606 OWAMP-Test sessions directed at an unsuspecting party could be used 1607 for denial of service (DoS) attacks. In unauthenticated mode, 1608 servers SHOULD limit receivers to hosts they control or to the OWAMP- 1609 Control client. 1611 6.3. Covert Information Channels 1613 OWAMP-Test sessions could be used as covert channels of information. 1614 Environments that are worried about covert channels should take this 1615 into consideration. 1617 6.4. Requirement to Include AES in Implementations 1619 Notice that AES, in counter mode, is used for pseudo-random number 1620 generation, so implementation of AES MUST be included, even in a 1621 server that only supports unauthenticated mode. 1623 6.5. Resource Use Limitations 1625 An OWAMP server can consume resources of various kinds. The two most 1626 important kinds of resources are network capacity and memory (primary 1627 or secondary) for storing test results. 1629 Any implementation of OWAMP server MUST include technical mechanisms 1630 to limit the use of network capacity and memory. Mechanisms for 1631 managing the resources consumed by unauthenticated users and users 1632 authenticated with a username and passphrase SHOULD be separate. The 1633 default configuration of an implementation MUST enable these 1634 mechanisms and set the resource use limits to conservatively low 1635 values. 1637 One way to design the resource limitation mechanisms is as follows: 1638 assign each session to a user class. User classes are partially 1639 ordered with ``includes'' relation, with one class (``all users'') 1640 that is always present and that includes any other class. The 1641 assignment of a session to a user class can be based on the presence 1642 of authentication of the session, the user name, IP address range, 1643 time of day, and, perhaps, other factors. Each user class would have 1644 a limit for usage of network capacity (specified in units of 1645 bit/second) and memory for storing test results (specified in units 1646 of octets). Along with the limits for resource use, current use 1647 would be tracked by the server. When a session is requested by a 1648 user in a specific user class, the resources needed for this session 1649 are computed: the average network capacity use (based on the sending 1650 schedule) and the maximum memory use (based on the number of packets 1651 and number of octets each packet would need to be stored internally 1652 -- note that outgoing sessions would not require any memory use). 1653 These resource use numbers are added to the current resource use 1654 numbers for the given user class; if such addition would take the 1655 resource use outside of the limits for the given user class, the 1656 session is rejected. When resources are reclaimed, corresponding 1657 measures are subtracted from the current use. Network capacity is 1658 reclaimed as soon as the session ends. Memory is reclaimed when the 1659 data is deleted. For unauthenticated sessions, memory consumed by an 1660 OWAMP-Test session SHOULD be reclaimed after the OWAMP-Control 1661 connection that initiated the session is closed (gracefully or 1662 otherwise). For authenticated sessions, the administrator who 1663 configures the service should be able to decide the exact policy, but 1664 useful policy mechanisms that MAY be implemented are the ability to 1665 automatically reclaim memory when the data is retrieved and the 1666 ability to reclaim memory after a certain configurable (based on user 1667 class) period of time passes after the OWAMP-Test session terminates. 1669 6.6. Use of Cryptographic Primitives in OWAMP 1671 At an early stage in designing the protocol, we considered using 1672 Transport Layer Security (TLS) and IPsec as cryptographic security 1673 mechanisms for OWAMP. The disadvantages of those are as follows (not 1674 an exhaustive list): 1676 Regarding TLS: 1678 + While TLS could be used to secure TCP-based OWAMP-Control, but 1679 difficult to use to secure UDP-based OWAMP-Test: OWAMP-Test 1680 packets, if lost, are not resent, so packets have to be 1681 (optionally) encrypted and authenticated while retaining 1682 individual usability. Stream-based TLS is not conducive of this. 1684 + Dealing with streams, does not authenticate individual messages 1685 (even in OWAMP-Control). The easiest way out would be to add some 1686 known-format padding to each message and verify that the format of 1687 the padding is intact before using the message. The solution 1688 would thus lose some of its appeal (``just use TLS''); it would 1689 also be much more difficult to evaluate the security of this 1690 scheme with the various modes and options of TLS -- it would 1691 almost certainly not be secure with all. The capacity of an 1692 attacker to replace parts of messages (namely, the end) with 1693 random garbage could have serious security implications and would 1694 need to be analyzed carefully: suppose, for example, that a 1695 parameter that is used in some form to control the rate were 1696 replaced by random garbage -- chances are the result (an unsigned 1697 integer) would be quite large. 1699 + Dependent on the mode of use, one can end up with a requirement 1700 for certificates for all users and a PKI. Even if one is to 1701 accept that PKI is desirable, there just isn't a usable one today. 1703 + TLS requires a fairly large implementation. OpenSSL, for example, 1704 is larger than our implementation of OWAMP as a whole. This can 1705 matter for embedded implementations. 1707 Regarding IPsec: 1709 + What we now call authenticated mode would not be possible (in 1710 IPsec you can't authenticate part of a packet). 1712 + The deployment paths of IPsec and OWAMP could be separate if OWAMP 1713 does not depend on IPsec. After nine years of IPsec, only 0.05% 1714 of traffic on an advanced backbone network such as Abilene uses 1715 IPsec (for comparison purposes with encryption above layer 4, SSH 1716 use is at 2-4% and HTTPS use is at 0.2-0.6%). It is desirable to 1717 be able to deploy OWAMP on as large of a number of different 1718 platforms as possible. 1720 + The deployment problems of a protocol dependent on IPsec would be 1721 especially acute in the case of lightweight embedded devices. 1722 Ethernet switches, DSL ``modems,'' and other such devices mostly 1723 do not support IPsec. 1725 + The API for manipulation IPsec from an application is currently 1726 poorly understood. Writing a program that needs to encrypt some 1727 packets, authenticate some packets, and leave some open -- for the 1728 same destination -- would become more of an exercise in IPsec 1729 rather than IP measurement. 1731 For the enumerated reasons, we decided to use a simple cryptographic 1732 protocol (based on a block cipher in CBC mode) that is different from 1733 TLS and IPsec. 1735 6.7. Required Properties of MD5 1737 The protocol makes use of the MD5 hash function to convert a 1738 user-supplied passphrase into a key that will be used to encrypt a 1739 short piece of random data (the session key). 1741 In this document we use cryptographic terminology of [MENEZES]. 1743 It has long been suspected, and has been conclusively shown recently 1744 that MD5 is not a collision-resistant hash function. Since collision 1745 resistance was one of design goals of MD5, this casts strong 1746 suspicion on the other design goals of MD5, namely preimage 1747 resistance and 2nd preimage resistance. 1749 OWAMP does not rely on any of these properties. 1751 The properties of MD5 that are necessary are as follows: (1) it is a 1752 function that maps arbitrary length inputs into 128-bit outputs 1753 [fixed-length hash function], (2) a change in any bit of the input 1754 usually results in a change of a few bits of output [weakened 1755 avalanche property], (3) many 128-bit strings have preimages [almost 1756 surjective], and (4) the visible special structure of 1757 natural-language text possibly present in the passphrase is concealed 1758 after application of the function. These are very weak requirements 1759 that many functions satisfy. Something resembling CRC-128 would work 1760 just as well. 1762 We chose MD5 here because it has the required properties and is 1763 widely implemented, understood, and documented. Alternatives would 1764 include (1) a non-cryptographic primitive, such as CRC-128, (2) SHA-1 1765 truncated to 128 bits, or (3) a hash function based on AES (using 1766 Matyas-Meyer-Oseas, Davies-Meyer, or Miyaguchi-Preneel constructions; 1767 we would probably gravitate towards the last one if a block-cipher- 1768 based cryptographically secure hash function were required). Note 1769 that option 1 would not have any cryptographically relevant 1770 properties. We chose not to use it because of lack of 1771 well-documented 128-bit checksums; this specification would incur an 1772 unnecessary burden precisely defining one, providing test vectors, 1773 etc., with no advantage over MD5. Option 2, SHA-1, belongs to the 1774 MD4 family that appears to be under suspicion in light of recent 1775 developments. To avoid creating an impression that any potential 1776 future changes in the status of SHA-1 can affect the status of OWAMP 1777 we chose not to use it. Option 3 would result in a hash function 1778 that, with the current state of knowledge, would probably be one of 1779 the most cryptographically sound. Our requirements 1-4 from the 1780 preceding paragraph, however, do not call for a cryptographically 1781 sound hash function. Just as with CRC-128, this specification would 1782 need to define the hash function and provide test vectors (and 1783 perhaps sample code); we see no advantage in this approach versus 1784 using MD5. (Note that the performance advantages of MD5 are 1785 irrelevant for this application, as the hash is computed on a 1786 relatively short human-supplied string only once per OWAMP-Control 1787 session, so if the Miyaguchi-Preneel construction were documented in 1788 an RFC, we might just as well have used that.) 1790 6.8. The Use of AES-CBC-MAC 1792 OWAMP relies on AES-CBC-MAC for message authentication. Random IV 1793 choice is important for prevention of a codebook attack on the first 1794 block; it is unimportant for the purposes of CBC-MAC authentication 1795 (it should also be noted that, with its 128-bit block size, AES is 1796 more resistant to codebook attacks than ciphers with shorter blocks; 1797 we use random IV anyway). 1799 IZP, when decrypted, MUST be zero. It is crucial to check for this 1800 before using the message, otherwise existential forgery becomes 1801 possible. The complete message for which IZP is decrypted to non- 1802 zero MUST be discarded (for both short messages consisting of a few 1803 blocks and potentially long messages, such as a response to the 1804 Fetch-Session command). 1806 Since OWAMP messages can have different numbers of blocks, the 1807 existential forgery attack described in example 9.62 of [MENEZES] 1808 becomes a concern. To prevent it (and to simplify implementation), 1809 the length of any message becomes known after decrypting the first 1810 block of it. 1812 A special case is the first (fixed-length) message sent by the 1813 client. There, the token is a concatenation of the 128-bit challenge 1814 (transmitted by the server in the clear) and a 128-bit session key 1815 (generated randomly by the client, encrypted with AES-CBC with IV=0. 1816 Since IV=0, the challenge (a single cipher block) is simply encrypted 1817 with the secret key. Therefore, we rely on resistance of AES to 1818 chosen plaintext attacks (as the challenge could be substituted by an 1819 attacker). It should be noted that the number of blocks of chosen 1820 plaintext an attacker can have encrypted with the secret key is 1821 limited by the number of sessions the client wants to initiate. An 1822 attacker who knows the encryption of a server's challenge can produce 1823 an existential forgery of the session key and thus disrupt the 1824 session; however, any attacker can disrupt a session by corrupting 1825 the protocol messages in an arbitrary fashion, therefore no new 1826 threat is created here; nevertheless, we require that the server 1827 never issues the same challenge twice (if challenges are generated 1828 randomly, a repetition would occur, on average, after 2^64 sessions; 1829 we deem this satisfactory as this is enough even for an implausibly 1830 busy server that participates in 1,000,000 sessions per second to go 1831 without repetitions for more than 500 centuries). With respect to 1832 the second part of the token, an attacker can produce an existential 1833 forgery of the session key by modifying the second half of the 1834 client's token while leaving the first part intact. This forgery, 1835 however, would be immediately discovered by the client when the IZP 1836 on the server's next message (acceptance or rejection of the 1837 connection) does not verify. 1839 7. IANA Considerations 1841 IANA is requested to allocate a well-known TCP port number for the 1842 OWAMP-Control part of the OWAMP protocol. 1844 8. Internationalization Considerations 1846 The protocol does not carry any information in a natural language. 1848 9. Appendix A: Sample C Code for Exponential Deviates 1850 The values in array Q[] are the exact values that MUST be used by all 1851 implementations. The rest of this appendix only serves for 1852 illustrative purposes. 1854 /* 1855 ** Example usage: generate a stream of exponential (mean 1) 1856 ** random quantities (ignoring error checking during initialization). 1857 ** If a variate with some mean mu other than 1 is desired, the output 1858 ** of this algorithm can be multiplied by mu according to the rules 1859 ** of arithmetic we described. 1861 ** Assume that a 16-octet 'seed' has been initialized 1862 ** (as the shared secret in OWAMP, for example) 1863 ** unsigned char seed[16]; 1865 ** OWPrand_context next; 1867 ** (initialize state) 1868 ** OWPrand_context_init(&next, seed); 1870 ** (generate a sequence of exponential variates) 1871 ** while (1) { 1872 ** u_int64_t num = OWPexp_rand64(&next); 1873 1874 ... 1875 ** } 1876 */ 1878 #include 1880 typedef u_int64_t u_int64_t; 1882 /* (K - 1) is the first k such that Q[k] > 1 - 1/(2^32). */ 1883 #define K 12 1884 #define BIT31 0x80000000UL /* See if first bit in the lower 1885 32 bits is zero. */ 1886 #define MASK32(n) ((n) & 0xFFFFFFFFUL) 1888 #define EXP2POW32 0x100000000ULL 1890 typedef struct OWPrand_context { 1891 unsigned char counter[16]; /* Counter (network byte order). */ 1892 keyInstance key; /* Key to encrypt the counter. */ 1893 unsigned char out[16]; /* The encrypted block. */ 1894 } OWPrand_context; 1896 /* 1897 ** The array has been computed according to the formula: 1898 ** 1899 ** Q[k] = (ln2)/(1!) + (ln2)^2/(2!) + ... + (ln2)^k/(k!) 1900 ** 1901 ** as described in algorithm S. (The values below have been 1902 ** multiplied by 2^32 and rounded to the nearest integer.) 1903 ** These exact values MUST be used so that different implementation 1904 ** produce the same sequences. 1905 */ 1906 static u_int64_t Q[K] = { 1907 0, /* Placeholder - so array indices start from 1. */ 1908 0xB17217F8, 1909 0xEEF193F7, 1910 0xFD271862, 1911 0xFF9D6DD0, 1912 0xFFF4CFD0, 1913 0xFFFEE819, 1914 0xFFFFE7FF, 1915 0xFFFFFE2B, 1916 0xFFFFFFE0, 1917 0xFFFFFFFE, 1918 0xFFFFFFFF 1919 }; 1921 /* this element represents ln2 */ 1922 #define LN2 Q[1] 1924 /* 1925 ** Convert an unsigned 32-bit integer into a u_int64_t number. 1926 */ 1927 u_int64_t 1928 OWPulong2num64(u_int32_t a) 1929 { 1930 return ((u_int64_t)1 << 32) * a; 1931 } 1932 /* 1933 ** Arithmetic functions on u_int64_t numbers. 1934 */ 1936 /* 1937 ** Addition. 1938 */ 1939 u_int64_t 1940 OWPnum64_add(u_int64_t x, u_int64_t y) 1941 { 1942 return x + y; 1943 } 1945 /* 1946 ** Multiplication. Allows overflow. Straightforward implementation 1947 ** of Algorithm 4.3.1.M (p.268) from [KNUTH]. 1948 */ 1949 u_int64_t 1950 OWPnum64_mul(u_int64_t x, u_int64_t y) 1951 { 1952 unsigned long w[4]; 1953 u_int64_t xdec[2]; 1954 u_int64_t ydec[2]; 1956 int i, j; 1957 u_int64_t k, t, ret; 1959 xdec[0] = MASK32(x); 1960 xdec[1] = MASK32(x>>32); 1961 ydec[0] = MASK32(y); 1962 ydec[1] = MASK32(y>>32); 1964 for (j = 0; j < 4; j++) 1965 w[j] = 0; 1967 for (j = 0; j < 2; j++) { 1968 k = 0; 1969 for (i = 0; ; ) { 1970 t = k + (xdec[i]*ydec[j]) + w[i + j]; 1971 w[i + j] = t%EXP2POW32; 1972 k = t/EXP2POW32; 1973 if (++i < 2) 1974 continue; 1975 else { 1976 w[j + 2] = k; 1977 break; 1978 } 1979 } 1981 } 1983 ret = w[2]; 1984 ret <<= 32; 1985 return w[1] + ret; 1986 } 1988 /* 1989 ** Seed the random number generator using a 16-byte quantity 'seed' 1990 ** (== the session ID in OWAMP). This function implements step U1 1991 ** of algorithm Unif. 1992 */ 1994 void 1995 OWPrand_context_init(OWPrand_context *next, unsigned char *seed) 1996 { 1997 int i; 1999 /* Initialize the key */ 2000 rijndaelKeyInit(next->key, seed); 2002 /* Initialize the counter with zeros */ 2003 memset(next->out, 0, 16); 2004 for (i = 0; i < 16; i++) 2005 next->counter[i] = 0UL; 2006 } 2008 /* 2009 ** Random number generating functions. 2010 */ 2012 /* 2013 ** Generate and return a 32-bit uniform random string (saved in the less 2014 ** significant half of the u_int64_t). This function implements steps 2015 ** U2-U4 of the algorithm Unif. 2016 */ 2017 u_int64_t 2018 OWPunif_rand64(OWPrand_context *next) 2019 { 2020 int j; 2021 u_int8_t *buf; 2022 u_int64_t ret = 0; 2024 /* step U2 */ 2025 u_int8_t i = next->counter[15] & (u_int8_t)3; 2026 if (!i) 2027 rijndaelEncrypt(next->key, next->counter, next->out); 2029 /* Step U3. Increment next.counter as a 16-octet single 2030 quantity in network byte order for AES counter mode. */ 2031 for (j = 15; j >= 0; j--) 2032 if (++next->counter[j]) 2033 break; 2035 /* Step U4. Do output. The last 4 bytes of ret now contain the 2036 random integer in network byte order */ 2037 buf = &next->out[4*i]; 2038 for (j=0; j<4; j++) { 2039 ret <<= 8; 2040 ret += *buf++; 2041 } 2042 return ret; 2043 } 2045 /* 2046 ** Generate an exponential deviate with mean 1. 2047 */ 2048 u_int64_t 2049 OWPexp_rand64(OWPrand_context *next) 2050 { 2051 unsigned long i, k; 2052 u_int32_t j = 0; 2053 u_int64_t U, V, J, tmp; 2055 /* Step S1. Get U and shift */ 2056 U = OWPunif_rand64(next); 2058 while ((U & BIT31) && (j < 32)) { /* Shift until first 0. */ 2059 U <<= 1; 2060 j++; 2061 } 2062 /* Remove the 0 itself. */ 2063 U <<= 1; 2065 U = MASK32(U); /* Keep only the fractional part. */ 2066 J = OWPulong2num64(j); 2068 /* Step S2. Immediate acceptance? */ 2069 if (U < LN2) /* return (j*ln2 + U) */ 2070 return OWPnum64_add(OWPnum64_mul(J, LN2), U); 2072 /* Step S3. Minimize. */ 2073 for (k = 2; k < K; k++) 2074 if (U < Q[k]) 2075 break; 2076 V = OWPunif_rand64(next); 2077 for (i = 2; i <= k; i++) { 2078 tmp = OWPunif_rand64(next); 2079 if (tmp < V) 2080 V = tmp; 2081 } 2083 /* Step S4. Return (j+V)*ln2 */ 2084 return OWPnum64_mul(OWPnum64_add(J, V), LN2); 2085 } 2087 10. Appendix B: Test Vectors for Exponential Deviates 2089 It is important that the test schedules generated by different 2090 implementations from identical inputs be identical. The non-trivial 2091 part is the generation of pseudo-random exponentially distributed 2092 deviates. To aid implementors in verifying interoperability, several 2093 test vectors are provided. For each of the four given 128-bit values 2094 of SID represented as hexadecimal numbers, 1,000,000 exponentially 2095 distributed 64-bit deviates are generated as described above. As 2096 they are generated, they are all added to each other. The sum of all 2097 1,000,000 deviates is given as a hexadecimal number for each SID. An 2098 implementation MUST produce exactly these hexadecimal numbers. To 2099 aid in the verification of the conversion of these numbers to values 2100 of delay in seconds, approximate values are given (assuming 2101 lambda=1). An implementation SHOULD produce delay values in seconds 2102 that are close to the ones given below. 2104 SID = 0x2872979303ab47eeac028dab3829dab2 2105 SUM[1000000] = 0x000f4479bd317381 (1000569.739036 seconds) 2107 SID = 0x0102030405060708090a0b0c0d0e0f00 2108 SUM[1000000] = 0x000f433686466a62 (1000246.524512 seconds) 2110 SID = 0xdeadbeefdeadbeefdeadbeefdeadbeef 2111 SUM[1000000] = 0x000f416c8884d2d3 (999788.533277 seconds) 2113 SID = 0xfeed0feed1feed2feed3feed4feed5ab 2114 SUM[1000000] = 0x000f3f0b4b416ec8 (999179.293967 seconds) 2116 11. Normative References 2118 [AES] Advanced Encryption Standard (AES), 2119 http://csrc.nist.gov/encryption/aes/ 2121 [RFC1321] R. Rivest, `The MD5 Message-Digest Algorithm', RFC 1321, 2122 April 1992. 2124 [RFC2026] S. Bradner, `The Internet Standards Process -- Revision 3', 2125 RFC 2026, October 1996. 2127 [RFC2119] S. Bradner, `Key words for use in RFCs to Indicate 2128 Requirement Levels', RFC 2119, March 1997. 2130 [RFC2330] V. Paxon, G. Almes, J. Mahdavi, M. Mathis, `Framework for 2131 IP Performance Metrics' RFC 2330, May 1998. 2133 [RFC2474] K. Nichols, S. Blake, F. Baker, D. Black, `Definition of 2134 the Differentiated Services Field (DS Field) in the IPv4 and 2135 IPv6 Headers', RFC 2474, December 1998. 2137 [RFC2679] G. Almes, S. Kalidindi, and M. Zekauskas, `A One-way Delay 2138 Metric for IPPM', RFC 2679, September 1999. 2140 [RFC2680] G. Almes, S. Kalidindi, and M. Zekauskas, `A One-way Packet 2141 Loss Metric for IPPM', RFC 2680, September 1999. 2143 [RFC2836] S. Brim, B. Carpenter, F. Le Faucheur, `Per Hop Behavior 2144 Identification Codes', RFC 2836, May 2000. 2146 12. Informative References 2148 [BRIX] Brix Networks, http://www.brixnet.com/ 2150 [ZIGG] G. Marsaglia, M. Sibuya, and J. H. Ahrens, Communications of 2151 ACM, 15 (1972), 876-877. 2153 [MENEZES] A. J. Menezes, P. C. van Oorschot, and S. A. Vanstone, 2154 Handbook of Applied Cryptography, CRC Press, revised reprint 2155 with updates, 1997. 2157 [KNUTH] D. Knuth, The Art of Computer Programming, vol.2, 3rd 2158 edition, 1998. 2160 [RIJN] Reference ANSI C Implementation of Rijndael 2161 http://www.esat.kuleuven.ac.be/~rijmen/rijndael/rijndaelref.zip 2163 [RIPE] RIPE NCC Test-Traffic Measurements home, 2164 http://www.ripe.net/test-traffic/. 2166 [RIPE-NLUUG] H. Uijterwaal and O. Kolkman, `Internet Delay 2167 Measurements Using Test-Traffic', Spring 1998 Dutch Unix User 2168 Group Meeting, 2169 http://www.ripe.net/test-traffic/Talks/9805_nluug.ps.gz. 2171 [SURVEYOR] Surveyor Home Page, http://www.advanced.org/surveyor/. 2173 [SURVEYOR-INET] S. Kalidindi and M. Zekauskas, `Surveyor: An 2174 Infrastructure for Network Performance Measurements', 2175 Proceedings of INET'99, June 1999. 2176 http://www.isoc.org/inet99/proceedings/4h/4h_2.htm 2178 [RFC1305] D. Mills, `Network Time Protocol (Version 3) Specification, 2179 Implementation and Analysis', RFC 1305, March 1992. 2181 13. Authors' Addresses 2183 Stanislav Shalunov 2184 Internet2 2185 1000 Oakbrook Drive, Suite 300 2186 Ann Arbor, MI 48104 2187 Email: shalunov@internet2.edu 2188 SIP: shalunov@internet2.edu 2190 Benjamin Teitelbaum 2191 Internet2 2192 1000 Oakbrook Drive, Suite 300 2193 Ann Arbor, MI 48104 2194 Email: ben@internet2.edu 2195 SIP: ben@internet2.edu 2197 Anatoly Karp 2198 4710 Regent St, Apt 81B 2199 Madison, WI 53705 2200 Telephone: +1-608-347-6255 2201 Email: ankarp@charter.net 2202 Jeff W. Boote 2203 Internet2 2204 1000 Oakbrook Drive, Suite 300 2205 Ann Arbor, MI 48104 2206 Email: boote@internet2.edu 2207 SIP: boote@internet2.edu 2209 Matthew J. Zekauskas 2210 Internet2 2211 1000 Oakbrook Drive, Suite 300 2212 Ann Arbor, MI 48104 2213 Email: matt@internet2.edu 2214 SIP: matt@internet2.edu 2216 Intellectual Property 2218 The IETF takes no position regarding the validity or scope of any 2219 Intellectual Property Rights or other rights that might be claimed to 2220 pertain to the implementation or use of the technology described in 2221 this document or the extent to which any license under such rights 2222 might or might not be available; nor does it represent that it has 2223 made any independent effort to identify any such rights. Information 2224 on the procedures with respect to rights in RFC documents can be found 2225 in BCP 78 and BCP 79. 2227 Copies of IPR disclosures made to the IETF Secretariat and any 2228 assurances of licenses to be made available, or the result of an 2229 attempt made to obtain a general license or permission for the use of 2230 such proprietary rights by implementers or users of this 2231 specification can be obtained from the IETF on-line IPR repository at 2232 http://www.ietf.org/ipr. 2234 The IETF invites any interested party to bring to its attention any 2235 copyrights, patents or patent applications, or other proprietary 2236 rights which may cover technology that may be required to implement 2237 this standard. Please address the information to the IETF at 2238 ietf-ipr@ietf.org. 2240 Disclaimer of Validity 2242 This document and the information contained herein are provided on an 2243 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 2244 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET 2245 ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, 2246 INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE 2247 INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 2248 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 2250 Copyright Statement 2252 Copyright (C) The Internet Society (2004). This document is subject 2253 to the rights, licenses and restrictions contained in BCP 78, and 2254 except as set forth therein, the authors retain all their rights. 2256 Acknowledgments 2258 We would like to thank Guy Almes, Hamid Asgari, Steven Van den 2259 Berghe, Eric Boyd, Robert Cole, Joan Cucchiara, Stephen Donnelly, 2260 Susan Evett, Kaynam Hedayat, Petri Helenius, Kitamura Yasuichi, 2261 Daniel H. T. R. Lawson, Will E. Leland, Bruce A. Mah, Allison Mankin, 2262 Al Morton, Attila Pasztor, Randy Presuhn, Matthew Roughan, Andy 2263 Scherrer, Henk Uijterwaal, and Sam Weiler for their comments, 2264 suggestions, reviews, helpful discussion and proof-reading. 2266 Expiration date: June 2005