idnits 2.17.1 draft-irtf-dtnrg-tcp-clayer-05.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 (January 22, 2013) is 4109 days in the past. Is this intentional? Checking references for intended status: Experimental ---------------------------------------------------------------------------- == Missing Reference: 'L1' is mentioned on line 327, but not defined == Missing Reference: 'L2' is mentioned on line 327, but not defined == Missing Reference: 'L3' is mentioned on line 332, but not defined == Missing Reference: 'RFCXXXX' is mentioned on line 922, 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 M. Demmer 3 Group UC Berkeley 4 Internet-Draft J. Ott 5 Intended status: Experimental Helsinki University of 6 Expires: July 26, 2013 Technology 7 S. Perreault 8 Viagenie 9 January 22, 2013 11 Delay Tolerant Networking TCP Convergence Layer Protocol 12 draft-irtf-dtnrg-tcp-clayer-05.txt 14 Abstract 16 This document describes the protocol for the TCP-based Convergence 17 Layer for Delay Tolerant Networking (DTN). 19 Status of this Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on July 26, 2013. 36 Copyright Notice 38 Copyright (c) 2013 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 4 55 2.1. Definitions Relating to the Bundle Protocol . . . . . . . 4 56 2.2. Definitions specific to the TCPCL Protocol . . . . . . . . 5 57 3. General Protocol Description . . . . . . . . . . . . . . . . . 6 58 3.1. Bidirectional Use of TCP Connection . . . . . . . . . . . 7 59 3.2. Example message exchange . . . . . . . . . . . . . . . . . 7 60 4. Connection Establishment . . . . . . . . . . . . . . . . . . . 8 61 4.1. Contact Header . . . . . . . . . . . . . . . . . . . . . . 9 62 4.2. Validation and parameter negotiation . . . . . . . . . . . 11 63 5. Established Connection Operation . . . . . . . . . . . . . . . 12 64 5.1. Message Type Codes . . . . . . . . . . . . . . . . . . . . 12 65 5.2. Bundle Data Transmission . . . . . . . . . . . . . . . . . 13 66 5.3. Bundle Acknowledgments . . . . . . . . . . . . . . . . . . 14 67 5.4. Bundle Refusal . . . . . . . . . . . . . . . . . . . . . . 15 68 5.5. Bundle Length . . . . . . . . . . . . . . . . . . . . . . 16 69 5.6. Keepalive Messages . . . . . . . . . . . . . . . . . . . . 17 70 6. Connection Termination . . . . . . . . . . . . . . . . . . . . 18 71 6.1. Shutdown Message . . . . . . . . . . . . . . . . . . . . . 18 72 6.2. Idle Connection Shutdown . . . . . . . . . . . . . . . . . 19 73 7. Security Considerations . . . . . . . . . . . . . . . . . . . 20 74 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 75 8.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 20 76 8.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 21 77 8.3. Message Types . . . . . . . . . . . . . . . . . . . . . . 21 78 8.4. REFUSE Reason Codes . . . . . . . . . . . . . . . . . . . 21 79 8.5. SHUTDOWN Reason Codes . . . . . . . . . . . . . . . . . . 21 80 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 21 81 9.1. Normative References . . . . . . . . . . . . . . . . . . . 21 82 9.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 191 This section contains definitions that are interpreted to be specific 192 to the operation of the TCPCL protocol, as described below. 194 TCP Connection -- A TCP connection refers to a transport connection 195 using TCP as the transport protocol. 197 TCPCL Connection -- A TCPCL connection (as opposed to a TCP 198 connection) is a TCPCL communication relationship between two 199 bundle nodes. The lifetime of a TCPCL connection is one-to-one 200 with the lifetime of an underlying TCP connection. Therefore a 201 TCPCL connection is initiated when a bundle node initiates a TCP 202 connection to be established for the purposes of bundle 203 communication. A TCPCL connection is terminated when the TCP 204 connection ends, due either to one or both nodes actively 205 terminating the TCP connection or due to network errors causing 206 a failure of the TCP connection. For the remainder of this 207 document, the term "connection" without the prefix "TCPCL" shall 208 refer to a TCPCL connection. 210 Connection parameters -- The connection parameters are a set of 211 values used to affect the operation of the TCPCL for a given 212 connection. The manner in which these parameters are conveyed 213 to the bundle node and thereby to the TCPCL is implementation- 214 dependent. However, the mechanism by which two bundle nodes 215 exchange and negotiate the values to be used for a given session 216 is described in Section Section 4.2. 218 Transmission -- Transmission refers to the procedures and mechanisms 219 (described below) for conveyance of a bundle from one node to 220 another. 222 3. General Protocol Description 224 This protocol provides bundle conveyance over a TCP connection and 225 specifies the encapsulation of bundles as well as procedures for TCP 226 connection setup and teardown. The general operation of the protocol 227 is as follows: 229 First one node establishes a TCPCL connection to the other by 230 initiating a TCP connection. After setup of the TCP connection is 231 complete, an initial contact header is exchanged in both directions 232 to set parameters of the TCPCL connection and exchange a singleton 233 endpoint identifier for each node (not the singleton EID of any 234 application running on the node), to denote the bundle-layer identity 235 of each DTN node. This is used to assist in routing and forwarding 236 messages, e.g., to prevent loops. 238 Once the TCPCL connection is established and configured in this way, 239 bundles can be transmitted in either direction. Each bundle is 240 transmitted in one or more logical segments of formatted bundle data. 241 Each logical data segment consists of a DATA_SEGMENT message header, 242 an SDNV containing the length of the segment, and finally the byte 243 range of the bundle data. The choice of the length to use for 244 segments is an implementation matter. The first segment for a bundle 245 must set the 'start' flag and the last one must set the 'end' flag in 246 the DATA_SEGMENT message header. 248 An optional feature of the protocol is for the receiving node to send 249 acknowledgments as bundle data segments arrive (ACK_SEGMENT). The 250 rationale behind these acknowledgments is to enable the sender node 251 to determine how much of the bundle has been received, so that in 252 case the connection is interrupted, it can perform reactive 253 fragmentation to avoid re-sending the already transmitted part of the 254 bundle. 256 When acknowledgments are enabled, then for each data segment that is 257 received, the receiving node sends an ACK_SEGMENT code followed by an 258 SDNV containing the cumulative length of the bundle that has been 259 received. 261 Another optional feature is that a receiver may interrupt the 262 transmission of a bundle at any point in time by replying with a 263 REFUSE_BUNDLE message which causes the sender to stop transmission of 264 the current bundle, after completing transmission of a partially sent 265 data segment. Note: This enables a cross-layer optimization in that 266 it allows a receiver that detects that it already has received a 267 certain bundle to interrupt transmission as early as possible and 268 thus save transmission capacity for other bundles. 270 For connections that are idle, a KEEPALIVE message may optionally be 271 sent at a negotiated interval. This is used to convey liveness 272 information. 274 Finally, before connections close, a SHUTDOWN message is sent on the 275 channel. After sending a SHUTDOWN message, the sender of this 276 message may send further acknowledgments (ACK_SEGMENT or 277 REFUSE_BUNDLE) but no further data messages (DATA_SEGMENT). A 278 SHUTDOWN message may also be used to refuse a connection setup by a 279 peer. 281 3.1. Bidirectional Use of TCP Connection 283 Since each message type used in the TCPCL protocol in association 284 with sending a bundle is only sent in a specific direction 285 (DATA_SEGMENT and LENGTH from bundle sender to receiver, ACK_SEGMENT 286 and REFUSE_BUNDLE from receiver to sender) with the remaining 287 messages (KEEPALIVE and SHUTDOWN) being associated with the 288 connection rather than a particular bundle, a single TCP connection 289 can be used bidirectionally to send bundles concurrently from either 290 end to the other. 292 Note that in the case of concurrent bidirectional transmission, ack 293 segments may be interleaved with data segments. 295 3.2. Example message exchange 297 The following figure visually depicts the protocol exchange for a 298 simple session, showing the connection establishment, and the 299 transmission of a single bundle split into three data segments (of 300 lengths L1, L2, and L3) from Node A to Node B. 302 Note that the sending node may transmit multiple DATA_SEGMENT 303 messages without necessarily waiting for the corresponding 304 ACK_SEGMENT responses. This enables pipelining of messages on a 305 channel. Although this example only demonstrates a single bundle 306 transmission, it is also possible to pipeline multiple DATA_SEGMENT 307 messages for different bundles without necessarily waiting for 308 ACK_SEGMENT messages to be returned for each one. However, 309 interleaving data segments from different bundles is not allowed. 311 No errors or rejections are shown in this example. 313 Node A Node B 314 ====== ====== 316 +-------------------------+ +-------------------------+ 317 | Contact Header | -> <- | Contact Header | 318 +-------------------------+ +-------------------------+ 320 +-------------------------+ 321 | DATA_SEGMENT (start) | -> 322 | SDNV length [L1] | -> 323 | Bundle Data 0..L1 | -> 324 +-------------------------+ 325 +-------------------------+ +-------------------------+ 326 | DATA_SEGMENT | -> <- | ACK_SEGMENT | 327 | SDNV length [L2] | -> <- | SDNV length [L1] | 328 | Bundle Data L1..L2 | -> +-------------------------+ 329 +-------------------------+ 330 +-------------------------+ +-------------------------+ 331 | DATA_SEGMENT (end) | -> <- | ACK_SEGMENT | 332 | SDNV length [L3] | -> <- | SDNV length [L1+L2] | 333 | Bundle Data L2..L3 | -> +-------------------------+ 334 +-------------------------+ 335 +-------------------------+ 336 <- | ACK_SEGMENT | 337 <- | SDNV length [L1+L2+L3] | 338 +-------------------------+ 340 +-------------------------+ +-------------------------+ 341 | SHUTDOWN | -> <- | SHUTDOWN | 342 +-------------------------+ +-------------------------+ 344 Figure 2: A simple visual example of the flow of protocol messages on 345 a single TCP session between two nodes (A and B) 347 4. Connection Establishment 349 For bundle transmissions to occur using the TCPCL, a TCPCL connection 350 must first be established between communicating nodes. The manner in 351 which a bundle node makes the decision to establish such a connection 352 is implementation-dependent. For example, some connections may be 353 opened proactively and maintained for as long as is possible given 354 the network conditions, while other connections may be opened only 355 when there is a bundle that is queued for transmission and the 356 routing algorithm selects a certain next hop node. 358 To establish a TCPCL connection, a node must first establish a TCP 359 connection with the intended peer node, typically by using the 360 services provided by the operating system. Port number 4556 has been 361 assigned by IANA as the well-known port number for the TCP 362 convergence layer. Other port numbers MAY be used per local 363 configuration. Determining a peer's port number (if different from 364 the well-known TCPCL port) is up to the implementation. 366 If the node is unable to establish a TCP connection for any reason, 367 then it is an implementation matter to determine how to handle the 368 connection failure. A node MAY decide to re-attempt to establish the 369 connection, perhaps. If it does so, it MUST NOT overwhelm its target 370 with repeated connection attempts. Therefore, the node MUST retry 371 the connection setup only after some delay and it SHOULD use a 372 (binary) exponential backoff mechanism to increase this delay in case 373 of repeated failures. In case a SHUTDOWN message specifying a 374 reconnection delay is received, that delay is used as the initial 375 delay. The default initial delay SHOULD be at least 1 second but 376 SHOULD be configurable since it will be application and network type 377 dependent. 379 The node MAY declare failure after one or more connection attempts 380 and MAY attempt to find an alternate route for bundle data. Such 381 decisions are up to the higher layer (i.e., the BP). 383 Once a TCP connection is established, each node MUST immediately 384 transmit a contact header over the TCP connection. The format of the 385 contact header is described in Section 4.1). 387 Upon receipt of the contact header, both nodes perform the validation 388 and negotiation procedures defined in Section 4.2 390 After receiving the contact header from the other node, either node 391 MAY also refuse the connection by sending a SHUTDOWN message. If 392 connection setup is refused a reason MUST be included in the SHUTDOWN 393 message. 395 4.1. Contact Header 397 Once a TCP connection is established, both parties exchange a contact 398 header. This section describes the format of the contact header and 399 the meaning of its fields. 401 The format for the Contact Header is as follows: 403 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 404 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 405 +---------------+---------------+---------------+---------------+ 406 | magic='dtn!' | 407 +---------------+---------------+---------------+---------------+ 408 | version | flags | keepalive_interval | 409 +---------------+---------------+---------------+---------------+ 410 | local EID length (SDNV) | 411 +---------------+---------------+---------------+---------------+ 412 | | 413 + local EID (variable) + 414 | | 415 +---------------+---------------+---------------+---------------+ 417 Figure 3: Contact Header Format 419 The fields of the contact header are: 421 magic: A four byte field that always contains the byte sequence 0x64 422 0x74 0x6e 0x21, i.e. the text string "dtn!". 424 version: A one byte field value containing the current version of 425 the protocol. 427 flags: A one byte field containing optional connection flags. The 428 first four bits are unused and MUST be set to zero upon 429 transmission and MUST be ignored upon reception. The last four 430 bits are interpreted as shown in table Table 1 below. 432 keepalive_interval: A two byte integer field containing the number 433 of seconds between exchanges of keepalive messages on the 434 connection (see Section 5.6). This value is in network byte 435 order, as are all other multi-byte fields described in this 436 protocol. 438 local eid length: A variable length SDNV field containing the length 439 of the endpoint identifier (EID) for some singleton endpoint in 440 which the sending node is a member. A four byte SDNV is 441 depicted for clarity of the figure. 443 local EID: An octet string containing the EID of some singleton 444 endpoint in which the sending node is a member, in the canonical 445 format of :. A eight byte 446 EID is shown the clarity of the figure. 448 +----------+--------------------------------------------------------+ 449 | Value | Meaning | 450 +----------+--------------------------------------------------------+ 451 | 00000001 | Request acknowledgment of bundle segments. | 452 | 00000010 | Request enabling of reactive fragmentation. | 453 | 00000100 | Indicate support for bundle refusal. This flag MUST | 454 | | NOT be set to '1' unless support for acknowledgments | 455 | | is also indicated. | 456 | 00001000 | Request sending of LENGTH messages. | 457 +----------+--------------------------------------------------------+ 459 Table 1: Contact Header Flags 461 The manner in which values are configured and chosen for the various 462 flags and parameters in the contact header is implementation 463 dependent. 465 4.2. Validation and parameter negotiation 467 Upon reception of the contact header, each node follows the following 468 procedures for ensuring the validity of the TCPCL connection and to 469 negotiate values for the connection parameters. 471 If the magic string is not present or is not valid, the connection 472 MUST be terminated. The intent of the magic string is to provide 473 some protection against an inadvertent TCP connection by a different 474 protocol than the one described in this document. To prevent a flood 475 of repeated connections from a misconfigured application, a node MAY 476 elect to hold an invalid connection open and idle for some time 477 before closing it. 479 If a node receives a contact header containing a version that is 480 greater than the current version of the protocol that the node 481 implements, then the node SHOULD interpret all fields and messages as 482 it would normally. If a node receives a contact header with a 483 version that is lower than the version of the protocol that the node 484 implements, the node may either terminate the connection due to the 485 version mismatch, or may adapt its operation to conform to the older 486 version of the protocol. This decision is an implementation matter. 488 A node calculates the parameters for a TCPCL connection by 489 negotiating the values from its own preferences (conveyed by the 490 contact header it sent) with the preferences of the peer node 491 (expressed in the contact header that it received). This negotiation 492 MUST proceed in the following manner: 494 The segment acknowledgments enabled parameter is set to true iff 495 the corresponding flag is set in both contact headers. 497 The reactive fragmentation enabled parameter is set to true iff 498 the corresponding flag is set in both contact headers. 500 The bundle refusal capability may only be used iff both peers 501 indicate support for it in their contact header and segment 502 acknowledgement has been enabled. 504 The keepalive_interval parameter is set to the minimum value 505 from both contact headers. If one or both contact headers 506 contains the value zero, then the keepalive feature (described 507 in Section 5.6) is disabled. 509 Once this process of parameter negotiation is completed, the protocol 510 defines no additional mechanism to change the parameters of an 511 established connection; to effect such a change, the connection MUST 512 be terminated and a new connection established. 514 5. Established Connection Operation 516 This section describes the protocol operation for the duration of an 517 established connection, including the mechanisms for transmitting 518 bundles over the connection. 520 5.1. Message Type Codes 522 After the initial exchange of a contact header, all messages 523 transmitted over the connection are identified by a one octet header 524 with the following structure: 526 0 1 2 3 4 5 6 7 527 +-+-+-+-+-+-+-+-+ 528 | type | flags | 529 +-+-+-+-+-+-+-+-+ 531 type: Indicates the type of the message as per Table 2 below 533 flags: Optional flags defined on a per message type basis. 535 The types and values for the message type code are as follows. 537 +----------------+---------+----------------------------------------+ 538 | Type | Code | Comment | 539 +----------------+---------+----------------------------------------+ 540 | | 0x0 | Reserved. | 541 | | | | 542 | DATA_SEGMENT | 0x1 | Indicates the transmission of a | 543 | | | segment of bundle data, described in | 544 | | | Section 5.2. | 545 | | | | 546 | ACK_SEGMENT | 0x2 | Acknowledges reception of a data | 547 | | | segment, described in Section 5.3 | 548 | | | | 549 | REFUSE_BUNDLE | 0x3 | Indicates that the transmission of the | 550 | | | current bundle shall be stopped, | 551 | | | described in Section 5.4. | 552 | | | | 553 | KEEPALIVE | 0x4 | Keepalive message for the connection, | 554 | | | described in Section 5.6. | 555 | | | | 556 | SHUTDOWN | 0x5 | Indicates that one of the nodes | 557 | | | participating in the connection wishes | 558 | | | to cleanly terminate the connection, | 559 | | | described in Section 6. | 560 | | | | 561 | LENGTH | 0x6 | Contains the length (in bytes) of the | 562 | | | next bundle, described in Section 5.5. | 563 | | | | 564 | | 0x7-0xf | Unassigned. | 565 | | | | 566 +----------------+---------+----------------------------------------+ 568 Table 2: TCPCL Header Types 570 5.2. Bundle Data Transmission 572 Each bundle is transmitted in one or more data segments. The format 573 of a data segment message follows: 575 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 576 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 577 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 578 | 0x1 |0|0|S|E| length ... | contents.... | 579 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 581 Figure 4: Format of bundle data segment messages 583 The type portion of the message header contains the value 0x1. 585 The flags portion of the message header octet contains two optional 586 values in the two low-order bits, denoted 'S' and 'E' above. The 'S' 587 bit MUST be set to one iff it precedes the transmission of the first 588 segment of a new bundle. The 'E' bit MUST be set to one when 589 transmitting the last segment of a bundle. 591 Determining the size of the segment is an implementation matter. In 592 particular, a node may, based on local policy or configuration, only 593 ever transmit bundle data in a single segment, in which case both the 594 'S' and 'E' bits MUST be set to one. However, a node MUST be able to 595 receive a bundle that has been transmitted in any segment size. 597 In the bundle protocol specification, a single bundle comprises a 598 primary bundle block, a payload block, and zero or more additional 599 bundle blocks. The relationship between the protocol blocks and the 600 convergence layer segments is an implementation-specific decision. 601 In particular, a segment MAY contain more than one protocol block; 602 alternatively, a single protocol block (such as the payload) MAY be 603 split into multiple segments. 605 However, a single segment MUST NOT contain data of more than a single 606 bundle. 608 Once a transmission of a bundle has commenced, the node MUST only 609 send segments containing sequential portions of that bundle until it 610 sends a segment with the 'E' bit set. 612 Following the message header, the length field is an SDNV containing 613 the number of bytes of bundle data that are transmitted in this 614 segment. Following this length is the actual data contents. 616 5.3. Bundle Acknowledgments 618 Although the TCP transport provides reliable transfer of data between 619 transport peers, the typical BSD sockets interface provides no means 620 to inform a sending application of when the receiving application has 621 processed some amount of transmitted data. Thus after transmitting 622 some data, a bundle protocol agent needs an additional mechanism to 623 determine whether the receiving agent has successfully received the 624 segment. 626 To this end, the TCPCL protocol offers an optional feature whereby a 627 receiving node transmits acknowledgments of reception of data 628 segments. This feature is enabled if and only if during the exchange 629 of contact headers, both parties set the flag to indicate that 630 segment acknowledgments are enabled (see Section 4.1). If so, then 631 the receiver MUST transmit a bundle acknowledgment header when it 632 successfully receives each data segment. 634 The format of a bundle acknowledgment is as follows: 636 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 637 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 638 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 639 | 0x2 |0|0|0|0| acknowledged length ... | 640 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 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 722 The format of the LENGTH message is as follows: 724 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 725 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 726 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 727 | 0x6 |0|0|0|0| total bundle length ... | 728 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 730 Figure 7: Format of LENGTH messages 732 The LENGTH message contains the total length, in bytes, of the next 733 bundle, formatted as an SDNV. Its purpose is to allow nodes to 734 preemptively refuse bundles that would exceed their resources. It is 735 an optimization. 737 LENGTH messages MUST NOT be sent unless the corresponding flag bit is 738 set in the contact header. If the flag bit is set, LENGTH messages 739 MAY be sent, at the sender's discretion. LENGTH messages MUST NOT be 740 sent unless the next DATA_SEGMENT message has the S bit set to 1 741 (i.e., just before the start of a new bundle). 743 A receiver MAY send a BUNDLE_REFUSE message as soon as it receives a 744 LENGTH message, without waiting for the next DATA_SEGMENT message. 745 The receiver MUST be prepared for this and MUST associate the refusal 746 with the right bundle. 748 5.6. Keepalive Messages 750 The protocol includes a provision for transmission of keepalive 751 messages over the TCP connection to help determine if the connection 752 has been disrupted. 754 As described in Section 4.1, one of the parameters in the contact 755 header is the keepalive_interval. Both sides populate this field 756 with their requested intervals (in seconds) between keepalive 757 messages. 759 The format of a keepalive message is a one byte message type code of 760 KEEPALIVE (as described in Table 2, with no additional data. Both 761 sides SHOULD send a keepalive message whenever the negotiated 762 interval has elapsed with no transmission of any message (keepalive 763 or other). 765 If no message (keepalive or other) has been received for at least 766 twice the keepalive interval, then either party may terminate the 767 session by transmitting a one byte message type code of SHUTDOWN (as 768 described in Table 2) and closing the TCP connection. 770 Note: The keepalive interval should not be chosen too short as TCP 771 retransmissions may occur in case of packet loss. Those will have to 772 be triggered by a timeout (TCP RTO) which is dependent on the 773 measured RTT for the TCP connection so that keepalive message may 774 experience noticeable latency. 776 6. Connection Termination 778 This section describes the procedures for ending a TCPCL connection. 780 6.1. Shutdown Message 782 To cleanly shut down a connection, a SHUTDOWN message MUST be 783 transmitted by either node at any point following complete 784 transmission of any other message. In case acknowledgments have been 785 negotiated, it is advisable to acknowledge all received data segments 786 first and then shut down the connection. 788 The format of the shutdown message is as follows: 790 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 791 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 792 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 793 | 0x5 |0|0|R|D| reason (opt) | reconnection delay (opt) | 794 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 796 Figure 8: Format of bundle shutdown messages 798 It is possible for a node to convey additional information regarding 799 the reason for connection termination. To do so, the node MUST set 800 the 'R' bit in the message header flags, and transmit a one-byte 801 reason code immediately following the message header. The specified 802 values of the reason code are: 804 +-----------+------------------+------------------------------------+ 805 | Code | Meaning | Comment | 806 +-----------+------------------+------------------------------------+ 807 | 0x00 | Idle timeout | The connection is being closed due | 808 | | | to idleness. | 809 | | | | 810 | 0x01 | Version mismatch | The node cannot conform to the | 811 | | | specified TCPCL protocol version. | 812 | | | | 813 | 0x02 | Busy | The node is too busy to handle the | 814 | | | current connection. | 815 | 0x03-0xff | | Unassigned. | 816 +-----------+------------------+------------------------------------+ 817 Table 4: Shutdown Reason Codes 819 It is also possible to convey a requested reconnection delay to 820 indicate how long the other node must wait before attempting 821 connection re-establishment. To do so, the node sets the 'D' bit in 822 the message header flags, then transmits an SDNV specifying the 823 requested delay, in seconds, following the message header (and 824 optionally the shutdown reason code). The value 0 SHALL be 825 interpreted as an infinite delay, i.e. that the connecting node MUST 826 NOT re-establish the connection. In contrast, if the node does not 827 wish to request a delay, it SHOULD omit the delay field (and set the 828 'D' bit to zero). Note that in the figure above, a two octet SDNV is 829 shown for convenience of the presentation. 831 A connection shutdown MAY occur immediately after TCP connection 832 establishment or reception of a contact header (and prior to any 833 further data exchange). This may, for example, be used to notify 834 that the node is currently not capable of or willing to communicate. 835 However, a node MUST always send the contact header to its peer 836 before sending a SHUTDOWN message. 838 If either node terminates a connection prematurely in this manner, it 839 SHOULD send a SHUTDOWN message and MUST indicate a reason code unless 840 the incoming connection did not include the magic string. If a node 841 does not want its peer to re-open the connection immediately, it 842 SHOULD set the 'D' bit in the flags and include a reconnection delay 843 to indicate when the peer is allowed to attempt another connection 844 setup. 846 If a connection is to be terminated before another protocol message 847 has completed, then the node MUST NOT transmit the SHUTDOWN message 848 but still SHOULD close the TCP connection. In particular, if the 849 connection is to be closed (for whatever reason) while a node is in 850 the process of transmitting a bundle data segment, receiving node is 851 still expecting segment data and might erroneously interpret the 852 SHUTDOWN message to be part of the data segment. 854 6.2. Idle Connection Shutdown 856 The protocol includes a provision for clean shutdown of idle TCP 857 connections. Determining the length of time to wait before closing 858 idle connections, if they are to be closed at all, is an 859 implementation and configuration matter. 861 If there is a configured time to close idle links, then if no bundle 862 data (other than keepalive messages) has been received for at least 863 that amount of time, then either node MAY terminate the connection by 864 transmitting a SHUTDOWN message indicating the reason code of 'idle 865 timeout' (as described above). After receiving a SHUTDOWN message in 866 response, both sides may close the TCP connection. 868 7. Security Considerations 870 One security consideration for this protocol relates to the fact that 871 nodes present their endpoint identifier as part of the connection 872 header exchange. It would be possible for a node to fake this value 873 and present the identity of a singleton endpoint in which the node is 874 not a member, essentially masquerading as another DTN node. If this 875 identifier is used without further verification as a means to 876 determine which bundles are transmitted over the connection, then the 877 node that has falsified its identity may be able to obtain bundles 878 that it should not have. 880 These concerns may be mitigated through the use of the Bundle 881 Security Protocols [refs.dtnsecurity]. In particular, the Bundle 882 Authentication Header defines mechanism for secure exchange of 883 bundles between DTN nodes. Thus an implementation could delay 884 trusting the presented endpoint identifier until the node can 885 securely validate that its peer is in fact the only member of the 886 given singleton endpoint. 888 Another consideration for this protocol relates to denial of service 889 attacks. A node may send a large amount of data over a TCP 890 connection, requiring the receiving node to either handle the data, 891 attempt to stop the flood of data by sending a REFUSE_BUNDLE message, 892 or forcibly terminate the connection. This burden could cause denial 893 of service on other, well-behaving connections. There is also 894 nothing to prevent a malicious node from continually establishing 895 connections and repeatedly trying to send copious amounts of bundle 896 data. A listening node MAY take counter-measures such as ignoring 897 TCP SYN messages, closing TCP connections as soon as they are 898 established, waiting before sending the contact header, sending a 899 SHUTDOWN message quickly or with a delay, etc. 901 8. IANA Considerations 903 In this section, registration procedures are as defined in [RFC5226]. 905 8.1. Port Number 907 Port number 4556 has been assigned as the default port for the TCP 908 convergence layer. 910 8.2. Protocol Versions 912 IANA is asked to create a registry titled "Bundle Protocol TCP 913 Convergence Layer Version Numbers" and initialize it with the 914 following: 916 +-------+-----------+ 917 | Value | Reference | 918 +-------+-----------+ 919 | 0 | [RFCXXXX] | 920 | 1 | [RFCXXXX] | 921 | 2 | [RFCXXXX] | 922 | 3 | [RFCXXXX] | 923 +-------+-----------+ 925 (NOTE TO THE EDITOR: in the above, replace XXXX with this RFC number) 927 The registration procedure shall be RFC Required. 929 8.3. Message Types 931 IANA is asked to create a registry titled "Bundle Protocol TCP 932 Convergence Layer Message Types" and initialize it with the contents 933 of Table 2. The registration procedure shall be RFC Required. 935 8.4. REFUSE Reason Codes 937 IANA is asked to create a registry titled "Bundle Protocol TCP 938 Convergence Layer REFUSE Reason Codes" and initialize it with the 939 contents of Table 3. The registration procedure shall be RFC 940 Required. 942 8.5. SHUTDOWN Reason Codes 944 IANA is asked to create a registry titled "Bundle Protocol TCP 945 Convergence Layer SHUTDOWN Reason Codes" and initialize it with the 946 contents of Table 4. The registration procedure shall be RFC 947 Required. 949 9. References 951 9.1. Normative References 953 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 954 Requirement Levels", RFC 2119, March 1997. 956 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 957 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 958 May 2008. 960 [refs.bundleproto] 961 Scott, K. and S. Burleigh, "Bundle Protocol 962 Specification", RFC 5050, November 2007. 964 9.2. Informative References 966 [RFC6256] Eddy, W. and E. Davies, "Using Self-Delimiting Numeric 967 Values in Protocols", RFC 6256, May 2011. 969 [refs.dtnarch] 970 Cerf et al, V., "Delay-Tolerant Network Architecture", 971 RFC 4838, April 2007. 973 [refs.dtnimpl] 974 DTNRG, "Delay Tolerant Networking Reference 975 Implementation", . 977 [refs.dtnsecurity] 978 Symington, S., Farrell, S., and H. Weiss, "Bundle Security 979 Protocol Specification", Internet Draft, work in 980 progress draft-irtf-dtnrg-bundle-security-03.txt, 981 April 2007. 983 Authors' Addresses 985 Michael J. Demmer 986 University of California, Berkeley 987 Computer Science Division 988 445 Soda Hall 989 Berkeley, CA 94720-1776 990 US 992 Email: demmer@cs.berkeley.edu 994 Joerg Ott 995 Helsinki University of Technology 996 Department of Communications and Networking 997 PO Box 3000 998 TKK 02015 999 Finland 1001 Email: jo@netlab.tkk.fi 1002 Simon Perreault 1003 Viagenie 1004 246 Aberdeen 1005 Quebec, QC G1R 2E1 1006 Canada 1008 Phone: +1 418 656 9254 1009 Email: simon.perreault@viagenie.ca