idnits 2.17.1 draft-irtf-dtnrg-tcp-clayer-06.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document 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 (May 17, 2013) is 3998 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Missing Reference: 'L1' is mentioned on line 326, but not defined == Missing Reference: 'L2' is mentioned on line 326, but not defined == Missing Reference: 'L3' is mentioned on line 331, but not defined == Missing Reference: 'RFCXXXX' is mentioned on line 924, but not defined ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) Summary: 1 error (**), 0 flaws (~~), 5 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Delay Tolerant Networking Research Group M.J. Demmer 3 Internet-Draft UC Berkeley 4 Intended status: Experimental J. Ott 5 Expires: November 18, 2013 Helsinki University of Technology 6 S. Perreault 7 Viagenie 8 May 17, 2013 10 Delay Tolerant Networking TCP Convergence Layer Protocol 11 draft-irtf-dtnrg-tcp-clayer-06.txt 13 Abstract 15 This document describes the protocol for the TCP-based Convergence 16 Layer for Delay Tolerant Networking (DTN). 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at http://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on November 18, 2013. 35 Copyright Notice 37 Copyright (c) 2013 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (http://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 Table of Contents 52 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 53 2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 4 54 2.1. Definitions Relating to the Bundle Protocol . . . . . . . 4 55 2.2. Definitions specific to the TCPCL Protocol . . . . . . . 4 56 3. General Protocol Description . . . . . . . . . . . . . . . . 5 57 3.1. Bidirectional Use of TCP Connection . . . . . . . . . . . 7 58 3.2. Example message exchange . . . . . . . . . . . . . . . . 7 59 4. Connection Establishment . . . . . . . . . . . . . . . . . . 8 60 4.1. Contact Header . . . . . . . . . . . . . . . . . . . . . 9 61 4.2. Validation and parameter negotiation . . . . . . . . . . 11 62 5. Established Connection Operation . . . . . . . . . . . . . . 12 63 5.1. Message Type Codes . . . . . . . . . . . . . . . . . . . 12 64 5.2. Bundle Data Transmission . . . . . . . . . . . . . . . . 13 65 5.3. Bundle Acknowledgments . . . . . . . . . . . . . . . . . 14 66 5.4. Bundle Refusal . . . . . . . . . . . . . . . . . . . . . 15 67 5.5. Bundle Length . . . . . . . . . . . . . . . . . . . . . . 16 68 5.6. Keepalive Messages . . . . . . . . . . . . . . . . . . . 17 69 6. Connection Termination . . . . . . . . . . . . . . . . . . . 17 70 6.1. Shutdown Message . . . . . . . . . . . . . . . . . . . . 18 71 6.2. Idle Connection Shutdown . . . . . . . . . . . . . . . . 19 72 7. Security Considerations . . . . . . . . . . . . . . . . . . . 19 73 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 74 8.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 20 75 8.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 20 76 8.3. Message Types . . . . . . . . . . . . . . . . . . . . . . 21 77 8.4. REFUSE Reason Codes . . . . . . . . . . . . . . . . . . . 21 78 8.5. SHUTDOWN Reason Codes . . . . . . . . . . . . . . . . . . 21 79 9. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21 80 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 81 10.1. Normative References . . . . . . . . . . . . . . . . . . 21 82 10.2. Informative References . . . . . . . . . . . . . . . . . 22 83 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 85 1. Introduction 87 This document describes the TCP-based convergence layer protocol for 88 Delay Tolerant Networking (TCPCL). Delay Tolerant Networking is an 89 end-to-end architecture providing communications in and/or through 90 highly stressed environments, including those with intermittent 91 connectivity, long and/or variable delays, and high bit error rates. 92 More detailed descriptions of the rationale and capabilities of these 93 networks can be found in the Delay-Tolerant Network Architecture 94 [refs.dtnarch] RFC. 96 An important goal of the DTN architecture is to accommodate a wide 97 range of networking technologies and environments. The protocol used 98 for DTN communications is the Bundling Protocol (BP) 99 [refs.bundleproto], an application-layer protocol that is used to 100 construct a store-and-forward overlay network. As described in the 101 bundle protocol specification, it requires the services of a 102 "convergence layer adapter" (CLA) to send and receive bundles using 103 the service of some "native" link, network, or internet protocol. 104 This document describes one such convergence layer adapter that uses 105 the well-known Transmission Control Protocol (TCP). This convergence 106 layer is referred to as TCPCL. 108 The locations of the TCPCL and the BP in the Internet model protocol 109 stack are shown in Figure 1. In particular, when BP is using TCP as 110 its bearer with TCPCL as its convergence layer, both BP and TCPCL 111 reside at the application layer of the Internet model. 113 +-------------------------+ 114 | DTN Application | -\ 115 +-------------------------| | 116 | Bundle Protocol (BP) | -> Application Layer 117 +-------------------------+ | 118 | TCP Conv. Layer (TCPCL) | -/ 119 +-------------------------+ 120 | TCP | ---> Transport Layer 121 +-------------------------+ 122 | IP | ---> Network Layer 123 +-------------------------+ 124 | Link-Layer Protocol | ---> Link Layer 125 +-------------------------+ 126 | Physical Medium | ---> Physical Layer 127 +-------------------------+ 129 Figure 1: The locations of the bundle protocol and the TCP 130 convergence layer protocol in the Internet protocol stack 132 This document describes the format of the protocol data units passed 133 between entities participating in TCPCL communications. This 134 document does not address: 136 The format of protocol data units of the bundling protocol, as 137 those are defined elsewhere [refs.bundleproto]. 139 Mechanisms for locating or identifying other bundle nodes within 140 an internet. 142 Note that this document describes version 3 of the protocol. 143 Versions 0, 1, and 2 were never specified in any Internet Draft, RFC, 144 or any other public document. These prior versions of the protocol 145 were, however, implemented in the DTN reference implementation 146 [refs.dtnimpl], in prior releases, hence the current version number 147 reflects the existence of those prior versions. 149 2. Definitions 151 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 152 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 153 document are to be interpreted as described in [RFC2119]. 155 2.1. Definitions Relating to the Bundle Protocol 157 The following set of definitions are abbreviated versions of those 158 which appear in the Bundle Protocol Specification [refs.bundleproto]. 159 To the extent in which terms appear in both documents, they are 160 intended to have the same meaning. 162 Bundle -- A bundle is a protocol data unit of the DTN bundle 163 protocol. 165 Bundle payload -- A bundle payload (or simply "payload") is the 166 application data whose conveyance to the bundle's destination is 167 the purpose for the transmission of a given bundle. 169 Fragment -- A fragment is a bundle whose payload contains a 170 contiguous subset of bytes from another bundle's payload. 172 Bundle node -- A bundle node (or simply a "node") is any entity that 173 can send and/or receive bundles. The particular instantiation 174 of this entity is deliberately unconstrained, allowing for 175 implementations in software libraries, long-running processes, 176 or even hardware. One component of the bundle node is the 177 implementation of a convergence layer adapter. 179 Convergence layer adapter -- A convergence layer adapter (CLA) sends 180 and receives bundles utilizing the services of some 'native' 181 link, network, or internet protocol. This document describes 182 the manner in which a CLA sends and receives bundles when using 183 the TCP protocol for inter-node communication. 185 Self Describing Numeric Value -- A self describing numeric value 186 (SDNV) is a variable length encoding for integer values, defined 187 in [refs.bundleproto] and further explained in [RFC6256]. 189 2.2. Definitions specific to the TCPCL Protocol 190 This section contains definitions that are interpreted to be specific 191 to the operation of the TCPCL protocol, as described below. 193 TCP Connection -- A TCP connection refers to a transport connection 194 using TCP as the transport protocol. 196 TCPCL Connection -- A TCPCL connection (as opposed to a TCP 197 connection) is a TCPCL communication relationship between two 198 bundle nodes. The lifetime of a TCPCL connection is one-to-one 199 with the lifetime of an underlying TCP connection. Therefore a 200 TCPCL connection is initiated when a bundle node initiates a TCP 201 connection to be established for the purposes of bundle 202 communication. A TCPCL connection is terminated when the TCP 203 connection ends, due either to one or both nodes actively 204 terminating the TCP connection or due to network errors causing 205 a failure of the TCP connection. For the remainder of this 206 document, the term "connection" without the prefix "TCPCL" shall 207 refer to a TCPCL connection. 209 Connection parameters -- The connection parameters are a set of 210 values used to affect the operation of the TCPCL for a given 211 connection. The manner in which these parameters are conveyed 212 to the bundle node and thereby to the TCPCL is implementation- 213 dependent. However, the mechanism by which two bundle nodes 214 exchange and negotiate the values to be used for a given session 215 is described in Section Section 4.2. 217 Transmission -- Transmission refers to the procedures and mechanisms 218 (described below) for conveyance of a bundle from one node to 219 another. 221 3. General Protocol Description 223 This protocol provides bundle conveyance over a TCP connection and 224 specifies the encapsulation of bundles as well as procedures for TCP 225 connection setup and teardown. The general operation of the protocol 226 is as follows: 228 First one node establishes a TCPCL connection to the other by 229 initiating a TCP connection. After setup of the TCP connection is 230 complete, an initial contact header is exchanged in both directions 231 to set parameters of the TCPCL connection and exchange a singleton 232 endpoint identifier for each node (not the singleton EID of any 233 application running on the node), to denote the bundle-layer identity 234 of each DTN node. This is used to assist in routing and forwarding 235 messages, e.g., to prevent loops. 237 Once the TCPCL connection is established and configured in this way, 238 bundles can be transmitted in either direction. Each bundle is 239 transmitted in one or more logical segments of formatted bundle data. 240 Each logical data segment consists of a DATA_SEGMENT message header, 241 an SDNV containing the length of the segment, and finally the byte 242 range of the bundle data. The choice of the length to use for 243 segments is an implementation matter. The first segment for a bundle 244 must set the 'start' flag and the last one must set the 'end' flag in 245 the DATA_SEGMENT message header. 247 An optional feature of the protocol is for the receiving node to send 248 acknowledgments as bundle data segments arrive (ACK_SEGMENT). The 249 rationale behind these acknowledgments is to enable the sender node 250 to determine how much of the bundle has been received, so that in 251 case the connection is interrupted, it can perform reactive 252 fragmentation to avoid re-sending the already transmitted part of the 253 bundle. 255 When acknowledgments are enabled, then for each data segment that is 256 received, the receiving node sends an ACK_SEGMENT code followed by an 257 SDNV containing the cumulative length of the bundle that has been 258 received. 260 Another optional feature is that a receiver may interrupt the 261 transmission of a bundle at any point in time by replying with a 262 REFUSE_BUNDLE message which causes the sender to stop transmission of 263 the current bundle, after completing transmission of a partially sent 264 data segment. Note: This enables a cross-layer optimization in that 265 it allows a receiver that detects that it already has received a 266 certain bundle to interrupt transmission as early as possible and 267 thus save transmission capacity for other bundles. 269 For connections that are idle, a KEEPALIVE message may optionally be 270 sent at a negotiated interval. This is used to convey liveness 271 information. 273 Finally, before connections close, a SHUTDOWN message is sent on the 274 channel. After sending a SHUTDOWN message, the sender of this 275 message may send further acknowledgments (ACK_SEGMENT or 276 REFUSE_BUNDLE) but no further data messages (DATA_SEGMENT). A 277 SHUTDOWN message may also be used to refuse a connection setup by a 278 peer. 280 3.1. Bidirectional Use of TCP Connection 282 Since each message type used in the TCPCL protocol in association 283 with sending a bundle is only sent in a specific direction 284 (DATA_SEGMENT and LENGTH from bundle sender to receiver, ACK_SEGMENT 285 and REFUSE_BUNDLE from receiver to sender) with the remaining 286 messages (KEEPALIVE and SHUTDOWN) being associated with the 287 connection rather than a particular bundle, a single TCP connection 288 can be used bidirectionally to send bundles concurrently from either 289 end to the other. 291 Note that in the case of concurrent bidirectional transmission, ack 292 segments may be interleaved with data segments. 294 3.2. Example message exchange 296 The following figure visually depicts the protocol exchange for a 297 simple session, showing the connection establishment, and the 298 transmission of a single bundle split into three data segments (of 299 lengths L1, L2, and L3) from Node A to Node B. 301 Note that the sending node may transmit multiple DATA_SEGMENT 302 messages without necessarily waiting for the corresponding 303 ACK_SEGMENT responses. This enables pipelining of messages on a 304 channel. Although this example only demonstrates a single bundle 305 transmission, it is also possible to pipeline multiple DATA_SEGMENT 306 messages for different bundles without necessarily waiting for 307 ACK_SEGMENT messages to be returned for each one. However, 308 interleaving data segments from different bundles is not allowed. 310 No errors or rejections are shown in this example. 312 Node A Node B 313 ====== ====== 315 +-------------------------+ +-------------------------+ 316 | Contact Header | -> <- | Contact Header | 317 +-------------------------+ +-------------------------+ 319 +-------------------------+ 320 | DATA_SEGMENT (start) | -> 321 | SDNV length [L1] | -> 322 | Bundle Data 0..L1 | -> 323 +-------------------------+ 324 +-------------------------+ +-------------------------+ 325 | DATA_SEGMENT | -> <- | ACK_SEGMENT | 326 | SDNV length [L2] | -> <- | SDNV length [L1] | 327 | Bundle Data L1..L2 | -> +-------------------------+ 328 +-------------------------+ 329 +-------------------------+ +-------------------------+ 330 | DATA_SEGMENT (end) | -> <- | ACK_SEGMENT | 331 | SDNV length [L3] | -> <- | SDNV length [L1+L2] | 332 | Bundle Data L2..L3 | -> +-------------------------+ 333 +-------------------------+ 334 +-------------------------+ 335 <- | ACK_SEGMENT | 336 <- | SDNV length [L1+L2+L3] | 337 +-------------------------+ 339 +-------------------------+ +-------------------------+ 340 | SHUTDOWN | -> <- | SHUTDOWN | 341 +-------------------------+ +-------------------------+ 343 Figure 2: A simple visual example of the flow of protocol messages on 344 a single TCP session between two nodes (A and B) 346 4. Connection Establishment 348 For bundle transmissions to occur using the TCPCL, a TCPCL connection 349 must first be established between communicating nodes. The manner in 350 which a bundle node makes the decision to establish such a connection 351 is implementation-dependent. For example, some connections may be 352 opened proactively and maintained for as long as is possible given 353 the network conditions, while other connections may be opened only 354 when there is a bundle that is queued for transmission and the 355 routing algorithm selects a certain next hop node. 357 To establish a TCPCL connection, a node must first establish a TCP 358 connection with the intended peer node, typically by using the 359 services provided by the operating system. Port number 4556 has been 360 assigned by IANA as the well-known port number for the TCP 361 convergence layer. Other port numbers MAY be used per local 362 configuration. Determining a peer's port number (if different from 363 the well-known TCPCL port) is up to the implementation. 365 If the node is unable to establish a TCP connection for any reason, 366 then it is an implementation matter to determine how to handle the 367 connection failure. A node MAY decide to re-attempt to establish the 368 connection, perhaps. If it does so, it MUST NOT overwhelm its target 369 with repeated connection attempts. Therefore, the node MUST retry 370 the connection setup only after some delay and it SHOULD use a 371 (binary) exponential backoff mechanism to increase this delay in case 372 of repeated failures. In case a SHUTDOWN message specifying a 373 reconnection delay is received, that delay is used as the initial 374 delay. The default initial delay SHOULD be at least 1 second but 375 SHOULD be configurable since it will be application and network type 376 dependent. 378 The node MAY declare failure after one or more connection attempts 379 and MAY attempt to find an alternate route for bundle data. Such 380 decisions are up to the higher layer (i.e., the BP). 382 Once a TCP connection is established, each node MUST immediately 383 transmit a contact header over the TCP connection. The format of the 384 contact header is described in Section 4.1). 386 Upon receipt of the contact header, both nodes perform the validation 387 and negotiation procedures defined in Section 4.2 389 After receiving the contact header from the other node, either node 390 MAY also refuse the connection by sending a SHUTDOWN message. If 391 connection setup is refused a reason MUST be included in the SHUTDOWN 392 message. 394 4.1. Contact Header 396 Once a TCP connection is established, both parties exchange a contact 397 header. This section describes the format of the contact header and 398 the meaning of its fields. 400 The format for the Contact Header is as follows: 402 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 403 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 404 +---------------+---------------+---------------+---------------+ 405 | magic='dtn!' | 406 +---------------+---------------+---------------+---------------+ 407 | version | flags | keepalive_interval | 408 +---------------+---------------+---------------+---------------+ 409 | local EID length (SDNV) | 410 +---------------+---------------+---------------+---------------+ 411 | | 412 + local EID (variable) + 413 | | 414 +---------------+---------------+---------------+---------------+ 416 Figure 3: Contact Header Format 418 The fields of the contact header are: 420 magic: A four byte field that always contains the byte sequence 0x64 421 0x74 0x6e 0x21, i.e., the text string "dtn!". 423 version: A one byte field value containing the current version of 424 the protocol. 426 flags: A one byte field containing optional connection flags. The 427 first four bits are unused and MUST be set to zero upon 428 transmission and MUST be ignored upon reception. The last four 429 bits are interpreted as shown in table Table 1 below. 431 keepalive_interval: A two byte integer field containing the number 432 of seconds between exchanges of keepalive messages on the 433 connection (see Section 5.6). This value is in network byte 434 order, as are all other multi-byte fields described in this 435 protocol. 437 local eid length: A variable length SDNV field containing the length 438 of the endpoint identifier (EID) for some singleton endpoint in 439 which the sending node is a member. A four byte SDNV is 440 depicted for clarity of the figure. 442 local EID: An octet string containing the EID of some singleton 443 endpoint in which the sending node is a member, in the canonical 444 format of :. A eight byte 445 EID is shown the clarity of the figure. 447 +-------------+-----------------------------------------------------+ 448 | Value | Meaning | 449 +-------------+-----------------------------------------------------+ 450 | 00000001 | Request acknowledgment of bundle segments. | 451 | 00000010 | Request enabling of reactive fragmentation. | 452 | 00000100 | Indicate support for bundle refusal. This flag MUST | 453 | | NOT be set to '1' unless support for | 454 | | acknowledgments is also indicated. | 455 | 00001000 | Request sending of LENGTH messages. | 456 +-------------+-----------------------------------------------------+ 458 Table 1: Contact Header Flags 460 The manner in which values are configured and chosen for the various 461 flags and parameters in the contact header is implementation 462 dependent. 464 4.2. Validation and parameter negotiation 466 Upon reception of the contact header, each node follows the following 467 procedures for ensuring the validity of the TCPCL connection and to 468 negotiate values for the connection parameters. 470 If the magic string is not present or is not valid, the connection 471 MUST be terminated. The intent of the magic string is to provide 472 some protection against an inadvertent TCP connection by a different 473 protocol than the one described in this document. To prevent a flood 474 of repeated connections from a misconfigured application, a node MAY 475 elect to hold an invalid connection open and idle for some time 476 before closing it. 478 If a node receives a contact header containing a version that is 479 greater than the current version of the protocol that the node 480 implements, then the node SHOULD interpret all fields and messages as 481 it would normally. If a node receives a contact header with a 482 version that is lower than the version of the protocol that the node 483 implements, the node may either terminate the connection due to the 484 version mismatch, or may adapt its operation to conform to the older 485 version of the protocol. This decision is an implementation matter. 487 A node calculates the parameters for a TCPCL connection by 488 negotiating the values from its own preferences (conveyed by the 489 contact header it sent) with the preferences of the peer node 490 (expressed in the contact header that it received). This negotiation 491 MUST proceed in the following manner: 493 The segment acknowledgments enabled parameter is set to true iff 494 the corresponding flag is set in both contact headers. 496 The reactive fragmentation enabled parameter is set to true iff 497 the corresponding flag is set in both contact headers. 499 The bundle refusal capability may only be used iff both peers 500 indicate support for it in their contact header and segment 501 acknowledgement has been enabled. 503 The keepalive_interval parameter is set to the minimum value 504 from both contact headers. If one or both contact headers 505 contains the value zero, then the keepalive feature (described 506 in Section 5.6) is disabled. 508 Once this process of parameter negotiation is completed, the protocol 509 defines no additional mechanism to change the parameters of an 510 established connection; to effect such a change, the connection MUST 511 be terminated and a new connection established. 513 5. Established Connection Operation 515 This section describes the protocol operation for the duration of an 516 established connection, including the mechanisms for transmitting 517 bundles over the connection. 519 5.1. Message Type Codes 521 After the initial exchange of a contact header, all messages 522 transmitted over the connection are identified by a one octet header 523 with the following structure: 525 0 1 2 3 4 5 6 7 526 +-+-+-+-+-+-+-+-+ 527 | type | flags | 528 +-+-+-+-+-+-+-+-+ 530 type: Indicates the type of the message as per Table 2 below 532 flags: Optional flags defined on a per message type basis. 534 The types and values for the message type code are as follows. 536 +-----------------+-----------+-------------------------------------+ 537 | Type | Code | Comment | 538 +-----------------+-----------+-------------------------------------+ 539 | | 0x0 | Reserved. | 540 | | | | 541 | DATA_SEGMENT | 0x1 | Indicates the transmission of a | 542 | | | segment of bundle data, described | 543 | | | in Section 5.2. | 544 | | | | 545 | ACK_SEGMENT | 0x2 | Acknowledges reception of a data | 546 | | | segment, described in Section 5.3 | 547 | | | | 548 | REFUSE_BUNDLE | 0x3 | Indicates that the transmission of | 549 | | | the current bundle shall be | 550 | | | stopped, described in Section 5.4. | 551 | | | | 552 | KEEPALIVE | 0x4 | Keepalive message for the | 553 | | | connection, described in Section | 554 | | | 5.6. | 555 | | | | 556 | SHUTDOWN | 0x5 | Indicates that one of the nodes | 557 | | | participating in the connection | 558 | | | wishes to cleanly terminate the | 559 | | | connection, described in Section 6. | 560 | | | | 561 | LENGTH | 0x6 | Contains the length (in bytes) of | 562 | | | the next bundle, described in | 563 | | | Section 5.5. | 564 | | | | 565 | | 0x7-0xf | Unassigned. | 566 | | | | 567 +-----------------+-----------+-------------------------------------+ 569 Table 2: TCPCL Header Types 571 5.2. Bundle Data Transmission 573 Each bundle is transmitted in one or more data segments. The format 574 of a data segment message follows: 576 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 577 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 578 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 579 | 0x1 |0|0|S|E| length ... | contents.... | 580 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 582 Figure 4: Format of bundle data segment messages 584 The type portion of the message header contains the value 0x1. 586 The flags portion of the message header octet contains two optional 587 values in the two low-order bits, denoted 'S' and 'E' above. The 'S' 588 bit MUST be set to one iff it precedes the transmission of the first 589 segment of a new bundle. The 'E' bit MUST be set to one when 590 transmitting the last segment of a bundle. 592 Determining the size of the segment is an implementation matter. In 593 particular, a node may, based on local policy or configuration, only 594 ever transmit bundle data in a single segment, in which case both the 595 'S' and 'E' bits MUST be set to one. However, a node MUST be able to 596 receive a bundle that has been transmitted in any segment size. 598 In the bundle protocol specification, a single bundle comprises a 599 primary bundle block, a payload block, and zero or more additional 600 bundle blocks. The relationship between the protocol blocks and the 601 convergence layer segments is an implementation-specific decision. 602 In particular, a segment MAY contain more than one protocol block; 603 alternatively, a single protocol block (such as the payload) MAY be 604 split into multiple segments. 606 However, a single segment MUST NOT contain data of more than a single 607 bundle. 609 Once a transmission of a bundle has commenced, the node MUST only 610 send segments containing sequential portions of that bundle until it 611 sends a segment with the 'E' bit set. 613 Following the message header, the length field is an SDNV containing 614 the number of bytes of bundle data that are transmitted in this 615 segment. Following this length is the actual data contents. 617 5.3. Bundle Acknowledgments 619 Although the TCP transport provides reliable transfer of data between 620 transport peers, the typical BSD sockets interface provides no means 621 to inform a sending application of when the receiving application has 622 processed some amount of transmitted data. Thus after transmitting 623 some data, a bundle protocol agent needs an additional mechanism to 624 determine whether the receiving agent has successfully received the 625 segment. 627 To this end, the TCPCL protocol offers an optional feature whereby a 628 receiving node transmits acknowledgments of reception of data 629 segments. This feature is enabled if and only if during the exchange 630 of contact headers, both parties set the flag to indicate that 631 segment acknowledgments are enabled (see Section 4.1). If so, then 632 the receiver MUST transmit a bundle acknowledgment header when it 633 successfully receives each data segment. 635 The format of a bundle acknowledgment is as follows: 637 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 638 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 639 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 640 | 0x2 |0|0|0|0| acknowledged length ... | 641 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 642 Figure 5: Format of bundle acknowledgement messages 644 To transmit an acknowledgment, a node first transmits a message 645 header with the ACK_SEGMENT type code and all flags set to zero, then 646 transmits an SDNV containing the cumulative length of the received 647 segment(s) of the current bundle. The length MUST fall on a segment 648 boundary. That is, only full segments can be acknowledged. 650 For example, suppose the sending node transmits four segments of 651 bundle data with lengths 100, 200, 500, and 1000 respectively. After 652 receiving the first segment, the node sends an acknowledgment of 653 length 100. After the second segment is received, the node sends an 654 acknowledgment of length 300. The third and fourth acknowledgments 655 are of length 800 and 1800 respectively. 657 5.4. Bundle Refusal 659 As bundles may be large, the TCPCL supports an optional mechanisms by 660 which a receiving node may indicate to the sender that it does not 661 want to receive the corresponding bundle. 663 To do so, upon receiving a DATA_SEGMENT message, the node MAY 664 transmit a REFUSE_BUNDLE message. As data segments and 665 acknowledgments may cross on the wire, the bundle that is being 666 refused is implicitly identified by the sequence in which 667 acknowledgements and refusals are received. 669 The format of the REFUSE_BUNDLE message is as follows: 671 0 1 2 3 4 5 6 7 672 +-+-+-+-+-+-+-+-+ 673 | 0x3 | RCode | 674 +-+-+-+-+-+-+-+-+ 676 Figure 6: Format of REFUSE_BUNDLE message 678 The RCode field, which stands for "reason code", contains a value 679 indicating why the bundle was refused. The following table contains 680 semantics for some values. Other values may be registered with IANA, 681 as defined in Section 8. 683 +-----------+-------------------------------------------------------+ 684 | RCode | Semantics | 685 +-----------+-------------------------------------------------------+ 686 | 0x0 | Reason for refusal is unknown or not specified. | 687 | 0x1 | The receiver now has the complete bundle. The sender | 688 | | may now consider the bundle as completely received. | 689 | 0x2 | The receiver's resources are exhausted. The sender | 690 | | SHOULD apply reactive bundle fragmentation before | 691 | | retrying. | 692 | 0x3 | The receiver has encountered a problem that requires | 693 | | the bundle to be retransmitted in its entirety. | 694 | 0x4-0x7 | Unassigned. | 695 | 0x8-0xf | Reserved for future usage. | 696 +-----------+-------------------------------------------------------+ 698 Table 3: REFUSE_BUNDLE Reason Codes 700 The receiver MUST, for each bundle preceding the one to be refused, 701 have either acknowledged all DATA_SEGMENTs or refused the bundle. 702 This allows the sender to identify the bundles accepted and refused 703 by means of a simple FIFO list of segments and acknowledgments. 705 The bundle refusal MAY be sent before the entire data segment is 706 received. If a sender receives a REFUSE_BUNDLE message, the sender 707 MUST complete the transmission of any partially-sent DATA_SEGMENT 708 message (so that the receiver stays in sync). The sender MUST NOT 709 commence transmission of any further segments of the rejected bundle 710 subsequently. Note, however, that this requirement does not ensure 711 that a node will not receive another DATA_SEGMENT for the same bundle 712 after transmitting a REFUSE_BUNDLE message since messages may cross 713 on the wire; if this happens, subsequent segments of the bundle 714 SHOULD be refused with a REFUSE_BUNDLE message, too. 716 Note: If a bundle transmission if aborted in this way, the receiver 717 may not receive a segment with the 'E' flag set to '1' for the 718 aborted bundle. The beginning of the next bundle is identified by 719 the 'S' bit set to '1', indicating the start of a new bundle. 721 5.5. Bundle Length 723 The format of the LENGTH message is as follows: 725 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 726 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 727 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 728 | 0x6 |0|0|0|0| total bundle length ... | 729 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 731 Figure 7: Format of LENGTH messages 733 The LENGTH message contains the total length, in bytes, of the next 734 bundle, formatted as an SDNV. Its purpose is to allow nodes to 735 preemptively refuse bundles that would exceed their resources. It is 736 an optimization. 738 LENGTH messages MUST NOT be sent unless the corresponding flag bit is 739 set in the contact header. If the flag bit is set, LENGTH messages 740 MAY be sent, at the sender's discretion. LENGTH messages MUST NOT be 741 sent unless the next DATA_SEGMENT message has the S bit set to 1 742 (i.e., just before the start of a new bundle). 744 A receiver MAY send a BUNDLE_REFUSE message as soon as it receives a 745 LENGTH message, without waiting for the next DATA_SEGMENT message. 746 The receiver MUST be prepared for this and MUST associate the refusal 747 with the right bundle. 749 5.6. Keepalive Messages 751 The protocol includes a provision for transmission of keepalive 752 messages over the TCP connection to help determine if the connection 753 has been disrupted. 755 As described in Section 4.1, one of the parameters in the contact 756 header is the keepalive_interval. Both sides populate this field 757 with their requested intervals (in seconds) between keepalive 758 messages. 760 The format of a keepalive message is a one byte message type code of 761 KEEPALIVE (as described in Table 2, with no additional data. Both 762 sides SHOULD send a keepalive message whenever the negotiated 763 interval has elapsed with no transmission of any message (keepalive 764 or other). 766 If no message (keepalive or other) has been received for at least 767 twice the keepalive interval, then either party may terminate the 768 session by transmitting a one byte message type code of SHUTDOWN (as 769 described in Table 2) and closing the TCP connection. 771 Note: The keepalive interval should not be chosen too short as TCP 772 retransmissions may occur in case of packet loss. Those will have to 773 be triggered by a timeout (TCP RTO) which is dependent on the 774 measured RTT for the TCP connection so that keepalive message may 775 experience noticeable latency. 777 6. Connection Termination 779 This section describes the procedures for ending a TCPCL connection. 781 6.1. Shutdown Message 783 To cleanly shut down a connection, a SHUTDOWN message MUST be 784 transmitted by either node at any point following complete 785 transmission of any other message. In case acknowledgments have been 786 negotiated, it is advisable to acknowledge all received data segments 787 first and then shut down the connection. 789 The format of the shutdown message is as follows: 791 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 792 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 793 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 794 | 0x5 |0|0|R|D| reason (opt) | reconnection delay (opt) | 795 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 797 Figure 8: Format of bundle shutdown messages 799 It is possible for a node to convey additional information regarding 800 the reason for connection termination. To do so, the node MUST set 801 the 'R' bit in the message header flags, and transmit a one-byte 802 reason code immediately following the message header. The specified 803 values of the reason code are: 805 +---------------+---------------+-----------------------------------+ 806 | Code | Meaning | Comment | 807 +---------------+---------------+-----------------------------------+ 808 | 0x00 | Idle timeout | The connection is being closed | 809 | | | due to idleness. | 810 | | | | 811 | 0x01 | Version | The node cannot conform to the | 812 | | mismatch | specified TCPCL protocol version. | 813 | | | | 814 | 0x02 | Busy | The node is too busy to handle | 815 | | | the current connection. | 816 | 0x03-0xff | | Unassigned. | 817 +---------------+---------------+-----------------------------------+ 819 Table 4: Shutdown Reason Codes 821 It is also possible to convey a requested reconnection delay to 822 indicate how long the other node must wait before attempting 823 connection re-establishment. To do so, the node sets the 'D' bit in 824 the message header flags, then transmits an SDNV specifying the 825 requested delay, in seconds, following the message header (and 826 optionally the shutdown reason code). The value 0 SHALL be 827 interpreted as an infinite delay, i.e., that the connecting node MUST 828 NOT re-establish the connection. In contrast, if the node does not 829 wish to request a delay, it SHOULD omit the delay field (and set the 830 'D' bit to zero). Note that in the figure above, a two octet SDNV is 831 shown for convenience of the presentation. 833 A connection shutdown MAY occur immediately after TCP connection 834 establishment or reception of a contact header (and prior to any 835 further data exchange). This may, for example, be used to notify 836 that the node is currently not capable of or willing to communicate. 837 However, a node MUST always send the contact header to its peer 838 before sending a SHUTDOWN message. 840 If either node terminates a connection prematurely in this manner, it 841 SHOULD send a SHUTDOWN message and MUST indicate a reason code unless 842 the incoming connection did not include the magic string. If a node 843 does not want its peer to re-open the connection immediately, it 844 SHOULD set the 'D' bit in the flags and include a reconnection delay 845 to indicate when the peer is allowed to attempt another connection 846 setup. 848 If a connection is to be terminated before another protocol message 849 has completed, then the node MUST NOT transmit the SHUTDOWN message 850 but still SHOULD close the TCP connection. In particular, if the 851 connection is to be closed (for whatever reason) while a node is in 852 the process of transmitting a bundle data segment, receiving node is 853 still expecting segment data and might erroneously interpret the 854 SHUTDOWN message to be part of the data segment. 856 6.2. Idle Connection Shutdown 858 The protocol includes a provision for clean shutdown of idle TCP 859 connections. Determining the length of time to wait before closing 860 idle connections, if they are to be closed at all, is an 861 implementation and configuration matter. 863 If there is a configured time to close idle links, then if no bundle 864 data (other than keepalive messages) has been received for at least 865 that amount of time, then either node MAY terminate the connection by 866 transmitting a SHUTDOWN message indicating the reason code of 'idle 867 timeout' (as described above). After receiving a SHUTDOWN message in 868 response, both sides may close the TCP connection. 870 7. Security Considerations 872 One security consideration for this protocol relates to the fact that 873 nodes present their endpoint identifier as part of the connection 874 header exchange. It would be possible for a node to fake this value 875 and present the identity of a singleton endpoint in which the node is 876 not a member, essentially masquerading as another DTN node. If this 877 identifier is used without further verification as a means to 878 determine which bundles are transmitted over the connection, then the 879 node that has falsified its identity may be able to obtain bundles 880 that it should not have. 882 These concerns may be mitigated through the use of the Bundle 883 Security Protocols [refs.dtnsecurity]. In particular, the Bundle 884 Authentication Header defines mechanism for secure exchange of 885 bundles between DTN nodes. Thus an implementation could delay 886 trusting the presented endpoint identifier until the node can 887 securely validate that its peer is in fact the only member of the 888 given singleton endpoint. 890 Another consideration for this protocol relates to denial of service 891 attacks. A node may send a large amount of data over a TCP 892 connection, requiring the receiving node to either handle the data, 893 attempt to stop the flood of data by sending a REFUSE_BUNDLE message, 894 or forcibly terminate the connection. This burden could cause denial 895 of service on other, well-behaving connections. There is also 896 nothing to prevent a malicious node from continually establishing 897 connections and repeatedly trying to send copious amounts of bundle 898 data. A listening node MAY take counter-measures such as ignoring 899 TCP SYN messages, closing TCP connections as soon as they are 900 established, waiting before sending the contact header, sending a 901 SHUTDOWN message quickly or with a delay, etc. 903 8. IANA Considerations 905 In this section, registration procedures are as defined in [RFC5226]. 907 8.1. Port Number 909 Port number 4556 has been assigned as the default port for the TCP 910 convergence layer. 912 8.2. Protocol Versions 914 IANA is asked to create a registry titled "Bundle Protocol TCP 915 Convergence Layer Version Numbers" and initialize it with the 916 following: 918 +-------+-----------+ 919 | Value | Reference | 920 +-------+-----------+ 921 | 0 | [RFCXXXX] | 922 | 1 | [RFCXXXX] | 923 | 2 | [RFCXXXX] | 924 | 3 | [RFCXXXX] | 925 +-------+-----------+ 927 (NOTE TO THE EDITOR: in the above, replace XXXX with this RFC number) 929 The registration procedure shall be RFC Required. 931 8.3. Message Types 933 IANA is asked to create a registry titled "Bundle Protocol TCP 934 Convergence Layer Message Types" and initialize it with the contents 935 of Table 2. The registration procedure shall be RFC Required. 937 8.4. REFUSE Reason Codes 939 IANA is asked to create a registry titled "Bundle Protocol TCP 940 Convergence Layer REFUSE Reason Codes" and initialize it with the 941 contents of Table 3. The registration procedure shall be RFC 942 Required. 944 8.5. SHUTDOWN Reason Codes 946 IANA is asked to create a registry titled "Bundle Protocol TCP 947 Convergence Layer SHUTDOWN Reason Codes" and initialize it with the 948 contents of Table 4. The registration procedure shall be RFC 949 Required. 951 9. Acknowledgements 953 The authors would like to thank the following individuals who have 954 participated in the drafting, review, and discussion of this memo: 955 Alex McMahon, Brenton Walker, Darren Long, Elwyn Davies, Jean- 956 Philippe Dionne, Joseph Ishac, Keith Scott, Kevin Fall, Lloyd Wood, 957 Marc Blanchet, Peter Lovell, Scott Burleigh, Stephen Farrell, Vint 958 Cerf, and William Ivancic. 960 10. References 962 10.1. Normative References 964 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 965 Requirement Levels", RFC 2119, March 1997. 967 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 968 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 969 May 2008. 971 [refs.bundleproto] 972 Scott, K. and S. Burleigh, "Bundle Protocol 973 Specification", RFC 5050, November 2007. 975 10.2. Informative References 977 [RFC6256] Eddy, W. and E. Davies, "Using Self-Delimiting Numeric 978 Values in Protocols", RFC 6256, May 2011. 980 [refs.dtnarch] 981 Cerf et al, V., "Delay-Tolerant Network Architecture", RFC 982 4838, April 2007. 984 [refs.dtnimpl] 985 DTNRG, , "Delay Tolerant Networking Reference 986 Implementation", , . 988 [refs.dtnsecurity] 989 Symington, S., Farrell, S., and H. Weiss, "Bundle Security 990 Protocol Specification", Internet Draft, work in progress 991 draft-irtf-dtnrg-bundle-security-03.txt, April 2007. 993 Authors' Addresses 995 Michael J. Demmer 996 University of California, Berkeley 997 Computer Science Division 998 445 Soda Hall 999 Berkeley, CA 94720-1776 1000 US 1002 Email: demmer@cs.berkeley.edu 1004 Joerg Ott 1005 Helsinki University of Technology 1006 Department of Communications and Networking 1007 PO Box 3000 1008 TKK 02015 1009 Finland 1011 Email: jo@netlab.tkk.fi 1012 Simon Perreault 1013 Viagenie 1014 246 Aberdeen 1015 Quebec, QC G1R 2E1 1016 Canada 1018 Phone: +1 418 656 9254 1019 Email: simon.perreault@viagenie.ca