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