idnits 2.17.1 draft-ietf-dtn-tcpclv4-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- -- The draft header indicates that this document obsoletes RFC7242, but the abstract doesn't seem to mention this, which it should. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Using lowercase 'not' together with uppercase 'MUST', 'SHALL', 'SHOULD', or 'RECOMMENDED' is not an accepted usage according to RFC 2119. Please use uppercase 'NOT' together with RFC 2119 keywords (if that is what you mean). Found 'SHOULD not' in this paragraph: Note: The Keepalive Interval SHOULD not be chosen too short as TCP retransmissions MAY occur in case of packet loss. Those will have to be triggered by a timeout (TCP retransmission timeout (RTO)), which is dependent on the measured RTT for the TCP connection so that KEEPALIVE messages MAY experience noticeable latency. -- The document date (November 13, 2017) is 2350 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'I1' is mentioned on line 338, but not defined == 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 332, but not defined == Outdated reference: A later version (-31) exists of draft-ietf-dtn-bpbis-08 ** Downref: Normative reference to an Experimental RFC: RFC 5050 ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 7525 (Obsoleted by RFC 9325) == Outdated reference: A later version (-27) exists of draft-ietf-dtn-bpsec-06 Summary: 4 errors (**), 0 flaws (~~), 8 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Delay Tolerant Networking B. Sipos 3 Internet-Draft RKF Engineering 4 Obsoletes: 7242 (if approved) M. Demmer 5 Intended status: Standards Track UC Berkeley 6 Expires: May 17, 2018 J. Ott 7 Aalto University 8 S. Perreault 9 November 13, 2017 11 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 12 draft-ietf-dtn-tcpclv4-03 14 Abstract 16 This document describes a revised protocol for the TCP-based 17 convergence layer (TCPCL) for Delay-Tolerant Networking (DTN). The 18 protocol revision is based on implementation issues in the original 19 TCPCL Version 3 and updates to the Bundle Protocol contents, 20 encodings, and convergence layer requirements in Bundle Protocl 21 Version 7. Several new IANA registries are defined for TCPCLv4 which 22 define some behaviors inherited from TCPCLv3 but with updated 23 encodings and/or semantics. 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at https://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on May 17, 2018. 42 Copyright Notice 44 Copyright (c) 2017 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (https://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 4 61 2.1. Definitions Specific to the TCPCL Protocol . . . . . . . 4 62 3. General Protocol Description . . . . . . . . . . . . . . . . 5 63 3.1. Bidirectional Use of TCPCL Sessions . . . . . . . . . . . 7 64 3.2. Example Message Exchange . . . . . . . . . . . . . . . . 7 65 4. Session Establishment . . . . . . . . . . . . . . . . . . . . 8 66 4.1. Contact Header . . . . . . . . . . . . . . . . . . . . . 10 67 4.1.1. Header Extension Items . . . . . . . . . . . . . . . 12 68 4.2. Validation and Parameter Negotiation . . . . . . . . . . 13 69 4.3. Session Security . . . . . . . . . . . . . . . . . . . . 14 70 4.3.1. TLS Handshake Result . . . . . . . . . . . . . . . . 15 71 4.3.2. Example TLS Initiation . . . . . . . . . . . . . . . 15 72 5. Established Session Operation . . . . . . . . . . . . . . . . 16 73 5.1. Message Type Codes . . . . . . . . . . . . . . . . . . . 16 74 5.2. Upkeep and Status Messages . . . . . . . . . . . . . . . 18 75 5.2.1. Session Upkeep (KEEPALIVE) . . . . . . . . . . . . . 18 76 5.2.2. Message Rejection (MSG_REJECT) . . . . . . . . . . . 18 77 5.3. Bundle Transfer . . . . . . . . . . . . . . . . . . . . . 19 78 5.3.1. Bundle Transfer ID . . . . . . . . . . . . . . . . . 20 79 5.3.2. Transfer Initialization (XFER_INIT) . . . . . . . . . 20 80 5.3.3. Data Transmission (XFER_SEGMENT) . . . . . . . . . . 21 81 5.3.4. Data Acknowledgments (XFER_ACK) . . . . . . . . . . . 22 82 5.3.5. Transfer Refusal (XFER_REFUSE) . . . . . . . . . . . 23 83 6. Session Termination . . . . . . . . . . . . . . . . . . . . . 25 84 6.1. Shutdown Message (SHUTDOWN) . . . . . . . . . . . . . . . 26 85 6.2. Idle Session Shutdown . . . . . . . . . . . . . . . . . . 28 86 7. Security Considerations . . . . . . . . . . . . . . . . . . . 29 87 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 30 88 8.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 30 89 8.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 31 90 8.3. Header Extension Types . . . . . . . . . . . . . . . . . 31 91 8.4. Message Types . . . . . . . . . . . . . . . . . . . . . . 32 92 8.5. XFER_REFUSE Reason Codes . . . . . . . . . . . . . . . . 32 93 8.6. SHUTDOWN Reason Codes . . . . . . . . . . . . . . . . . . 33 94 8.7. MSG_REJECT Reason Codes . . . . . . . . . . . . . . . . . 34 95 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 34 96 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 34 97 10.1. Normative References . . . . . . . . . . . . . . . . . . 34 98 10.2. Informative References . . . . . . . . . . . . . . . . . 35 99 Appendix A. Significant changes from RFC7242 . . . . . . . . . . 35 100 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 36 102 1. Introduction 104 This document describes the TCP-based convergence-layer protocol for 105 Delay-Tolerant Networking. Delay-Tolerant Networking is an end-to- 106 end architecture providing communications in and/or through highly 107 stressed environments, including those with intermittent 108 connectivity, long and/or variable delays, and high bit error rates. 109 More detailed descriptions of the rationale and capabilities of these 110 networks can be found in "Delay-Tolerant Network Architecture" 111 [RFC4838]. 113 An important goal of the DTN architecture is to accommodate a wide 114 range of networking technologies and environments. The protocol used 115 for DTN communications is the revised Bundle Protocol (BP) 116 [I-D.ietf-dtn-bpbis], an application-layer protocol that is used to 117 construct a store-and- forward overlay network. As described in the 118 Bundle Protocol specification [I-D.ietf-dtn-bpbis], it requires the 119 services of a "convergence- layer adapter" (CLA) to send and receive 120 bundles using the service of some "native" link, network, or Internet 121 protocol. This document describes one such convergence-layer adapter 122 that uses the well-known Transmission Control Protocol (TCP). This 123 convergence layer is referred to as TCPCL. 125 The locations of the TCPCL and the BP in the Internet model protocol 126 stack are shown in Figure 1. In particular, when BP is using TCP as 127 its bearer with TCPCL as its convergence layer, both BP and TCPCL 128 reside at the application layer of the Internet model. 130 +-------------------------+ 131 | DTN Application | -\ 132 +-------------------------| | 133 | Bundle Protocol (BP) | -> Application Layer 134 +-------------------------+ | 135 | TCP Conv. Layer (TCPCL) | -/ 136 +-------------------------+ 137 | TLS (optional) | ---> Presentation Layer 138 +-------------------------+ 139 | TCP | ---> Transport Layer 140 +-------------------------+ 141 | IP | ---> Network Layer 142 +-------------------------+ 143 | Link-Layer Protocol | ---> Link Layer 144 +-------------------------+ 145 | Physical Medium | ---> Physical Layer 146 +-------------------------+ 148 Figure 1: The Locations of the Bundle Protocol and the TCP 149 Convergence-Layer Protocol above the Internet Protocol Stack 151 This document describes the format of the protocol data units passed 152 between entities participating in TCPCL communications. This 153 document does not address: 155 o The format of protocol data units of the Bundle Protocol, as those 156 are defined elsewhere in [RFC5050] and [I-D.ietf-dtn-bpbis]. This 157 includes the concept of bundle fragmentation or bundle 158 encapsulation. The TCPCL transfers bundles as opaque data blocks. 160 o Mechanisms for locating or identifying other bundle nodes within 161 an internet. 163 2. Requirements Language 165 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 166 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 167 document are to be interpreted as described in [RFC2119]. 169 2.1. Definitions Specific to the TCPCL Protocol 171 This section contains definitions that are interpreted to be specific 172 to the operation of the TCPCL protocol, as described below. 174 TCPCL Node: A TCPCL node refers to either side of an negotiating or 175 in-service TCPCL Session. For most TCPCL behavior, the two nodes 176 are symmetric and there is no protocol distinction between them. 177 Some specific behavior, particularly during negotiation, 178 distinguishes between the connecting node and the connected-to 179 node. For the remainder of this document, the term "node" without 180 the prefix "TCPCL" refers to a TCPCL node. 182 TCP Connection: A TCP connection refers to a transport connection 183 using TCP as the transport protocol. 185 TCPCL Session: A TCPCL session (as opposed to a TCP connection) is a 186 TCPCL communication relationship between two bundle nodes. The 187 lifetime of a TCPCL session is bound to the lifetime of an 188 underlying TCP connection. Therefore, a TCPCL session is 189 initiated after a bundle node establishes a TCP connection to for 190 the purposes of bundle communication. A TCPCL session is 191 terminated when the TCP connection ends, due either to one or both 192 nodes actively terminating the TCP connection or due to network 193 errors causing a failure of the TCP connection. For the remainder 194 of this document, the term "session" without the prefix "TCPCL" 195 refers to a TCPCL session. 197 Session parameters: The session parameters are a set of values used 198 to affect the operation of the TCPCL for a given session. The 199 manner in which these parameters are conveyed to the bundle node 200 and thereby to the TCPCL is implementation dependent. However, 201 the mechanism by which two bundle nodes exchange and negotiate the 202 values to be used for a given session is described in Section 4.2. 204 Transfer Transfer refers to the procedures and mechanisms (described 205 below) for conveyance of an individual bundle from one node to 206 another. Each transfer within TCPCLv4 is identified by a Transfer 207 ID number which is unique only to a single direction within a 208 single Session. 210 3. General Protocol Description 212 The service of this protocol is the transmission of DTN bundles over 213 TCP. This document specifies the encapsulation of bundles, 214 procedures for TCP setup and teardown, and a set of messages and node 215 requirements. The general operation of the protocol is as follows. 217 First, one node establishes a TCPCL session to the other by 218 initiating a TCP connection. After setup of the TCP connection is 219 complete, an initial contact header is exchanged in both directions 220 to set parameters of the TCPCL session and exchange a singleton 221 endpoint identifier for each node (not the singleton Endpoint 222 Identifier (EID) of any application running on the node) to denote 223 the bundle-layer identity of each DTN node. This is used to assist 224 in routing and forwarding messages, e.g., to prevent loops. 226 Once the TCPCL session is established and configured in this way, 227 bundles can be transferred in either direction. Each transfer is 228 performed in one or more logical segments of data. Each logical data 229 segment consists of a XFER_SEGMENT message header and flags, a count 230 of the length of the segment, and finally the octet range of the 231 bundle data. The choice of the length to use for segments is an 232 implementation matter (but must be within the Segment MRU size of 233 Section 4.1). The first segment for a bundle MUST set the 'START' 234 flag, and the last one MUST set the 'end' flag in the XFER_SEGMENT 235 message flags. 237 If multiple bundles are transmitted on a single TCPCL connection, 238 they MUST be transmitted consecutively. Interleaving data segments 239 from different bundles is not allowed. Bundle interleaving can be 240 accomplished by fragmentation at the BP layer or by establishing 241 multiple TCPCL sessions. 243 A feature of this protocol is for the receiving node to send 244 acknowledgments as bundle data segments arrive (XFER_ACK). The 245 rationale behind these acknowledgments is to enable the sender node 246 to determine how much of the bundle has been received, so that in 247 case the session is interrupted, it can perform reactive 248 fragmentation to avoid re-sending the already transmitted part of the 249 bundle. For each data segment that is received, the receiving node 250 sends an XFER_ACK message containing the cumulative length of the 251 bundle that has been received. The sending node MAY transmit 252 multiple XFER_SEGMENT messages without necessarily waiting for the 253 corresponding XFER_ACK responses. This enables pipelining of 254 messages on a channel. In addition, there is no explicit flow 255 control on the TCPCL layer. 257 Another feature is that a receiver MAY interrupt the transmission of 258 a bundle at any point in time by replying with a XFER_REFUSE message, 259 which causes the sender to stop transmission of the current bundle, 260 after completing transmission of a partially sent data segment. 261 Note: This enables a cross-layer optimization in that it allows a 262 receiver that detects that it already has received a certain bundle 263 to interrupt transmission as early as possible and thus save 264 transmission capacity for other bundles. 266 For sessions that are idle, a KEEPALIVE message is sent at a 267 negotiated interval. This is used to convey node liveness 268 information. 270 Finally, before sessions close, a SHUTDOWN message is sent to the 271 session peer. After sending a SHUTDOWN message, the sender of this 272 message MAY send further acknowledgments (XFER_ACK or XFER_REFUSE) 273 but no further data messages (XFER_SEGMENT). A SHUTDOWN message MAY 274 also be used to refuse a session setup by a peer. 276 3.1. Bidirectional Use of TCPCL Sessions 278 There are specific messages for sending and receiving operations (in 279 addition to session setup/teardown). TCPCL is symmetric, i.e., both 280 sides can start sending data segments in a session, and one side's 281 bundle transfer does not have to complete before the other side can 282 start sending data segments on its own. Hence, the protocol allows 283 for a bi-directional mode of communication. 285 Note that in the case of concurrent bidirectional transmission, 286 acknowledgment segments MAY be interleaved with data segments. 288 3.2. Example Message Exchange 290 The following figure visually depicts the protocol exchange for a 291 simple session, showing the session establishment and the 292 transmission of a single bundle split into three data segments (of 293 lengths "L1", "L2", and "L3") from Node A to Node B. 295 Note that the sending node MAY transmit multiple XFER_SEGMENT 296 messages without necessarily waiting for the corresponding XFER_ACK 297 responses. This enables pipelining of messages on a channel. 298 Although this example only demonstrates a single bundle transmission, 299 it is also possible to pipeline multiple XFER_SEGMENT messages for 300 different bundles without necessarily waiting for XFER_ACK messages 301 to be returned for each one. However, interleaving data segments 302 from different bundles is not allowed. 304 No errors or rejections are shown in this example. 306 Node A Node B 307 ====== ====== 308 +-------------------------+ +-------------------------+ 309 | Contact Header | -> <- | Contact Header | 310 +-------------------------+ +-------------------------+ 312 +-------------------------+ 313 | XFER_INIT | -> 314 | Transfer ID [I1] | 315 | Total Length [L1] | 316 +-------------------------+ 317 +-------------------------+ 318 | XFER_SEGMENT (start) | -> 319 | Transfer ID [I1] | 320 | Length [L1] | 321 | Bundle Data 0..(L1-1) | 322 +-------------------------+ 323 +-------------------------+ +-------------------------+ 324 | XFER_SEGMENT | -> <- | XFER_ACK (start) | 325 | Transfer ID [I1] | | Transfer ID [I1] | 326 | Length [L2] | | Length [L1] | 327 |Bundle Data L1..(L1+L2-1)| +-------------------------+ 328 +-------------------------+ 329 +-------------------------+ +-------------------------+ 330 | XFER_SEGMENT (end) | -> <- | XFER_ACK | 331 | Transfer ID [I1] | | Transfer ID [I1] | 332 | Length [L3] | | Length [L1+L2] | 333 |Bundle Data | +-------------------------+ 334 | (L1+L2)..(L1+L2+L3-1)| 335 +-------------------------+ 336 +-------------------------+ 337 <- | XFER_ACK (end) | 338 | Transfer ID [I1] | 339 | Length [L1+L2+L3] | 340 +-------------------------+ 342 +-------------------------+ +-------------------------+ 343 | SHUTDOWN | -> <- | SHUTDOWN | 344 +-------------------------+ +-------------------------+ 346 Figure 2: A SL1e Visual Example of the Flow of Protocol Messages on a 347 Single TCP Session between Two Nodes (A and B) 349 4. Session Establishment 351 For bundle transmissions to occur using the TCPCL, a TCPCL session 352 MUST first be established between communicating nodes. It is up to 353 the implementation to decide how and when session setup is triggered. 355 For example, some sessions MAY be opened proactively and maintained 356 for as long as is possible given the network conditions, while other 357 sessions MAY be opened only when there is a bundle that is queued for 358 transmission and the routing algorithm selects a certain next-hop 359 node. 361 To establish a TCPCL session, a node MUST first establish a TCP 362 connection with the intended peer node, typically by using the 363 services provided by the operating system. Destination port number 364 4556 has been assigned by IANA as the well-known port number for the 365 TCP convergence layer. Other destination port numbers MAY be used 366 per local configuration. Determining a peer's destination port 367 number (if different from the well-known TCPCL port) is up to the 368 implementation. Any source port number MAY be used for TCPCL 369 sessions. Typically an operating system assigned number in the TCP 370 Ephemeral range (49152--65535) is used. 372 If the node is unable to establish a TCP connection for any reason, 373 then it is an implementation matter to determine how to handle the 374 connection failure. A node MAY decide to re-attempt to establish the 375 connection. If it does so, it MUST NOT overwhelm its target with 376 repeated connection attempts. Therefore, the node MUST retry the 377 connection setup only after some delay (a 1-second minimum is 378 RECOMMENDED), and it SHOULD use a (binary) exponential backoff 379 mechanism to increase this delay in case of repeated failures. In 380 case a SHUTDOWN message specifying a reconnection delay is received, 381 that delay is used as the initial delay. The default initial delay 382 SHOULD be at least 1 second but SHOULD be configurable since it will 383 be application and network type dependent. 385 The node MAY declare failure after one or more connection attempts 386 and MAY attempt to find an alternate route for bundle data. Such 387 decisions are up to the higher layer (i.e., the BP). 389 Once a TCP connection is established, each node MUST immediately 390 transmit a contact header over the TCP connection. The format of the 391 contact header is described in Section 4.1. 393 Upon receipt of the contact header, both nodes perform the validation 394 and negotiation procedures defined in Section 4.2 396 After receiving the contact header from the other node, either node 397 MAY also refuse the session by sending a SHUTDOWN message. If 398 session setup is refused, a reason MUST be included in the SHUTDOWN 399 message. 401 4.1. Contact Header 403 Once a TCP connection is established, both parties exchange a contact 404 header. This section describes the format of the contact header and 405 the meaning of its fields. 407 The format for the Contact Header is as follows: 409 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 410 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 411 +---------------+---------------+---------------+---------------+ 412 | magic='dtn!' | 413 +---------------+---------------+---------------+---------------+ 414 | Version | Flags | Keepalive Interval | 415 +---------------+---------------+---------------+---------------+ 416 | Segment MRU... | 417 +---------------+---------------+---------------+---------------+ 418 | contd. | 419 +---------------+---------------+---------------+---------------+ 420 | Transfer MRU... | 421 +---------------+---------------+---------------+---------------+ 422 | contd. | 423 +---------------+---------------+---------------+---------------+ 424 | EID Length | EID Data... | 425 +---------------+---------------+---------------+---------------+ 426 | EID Data contd. | 427 +---------------+---------------+---------------+---------------+ 428 | Header Extension Length... | 429 +---------------+---------------+---------------+---------------+ 430 | contd. | 431 +---------------+---------------+---------------+---------------+ 432 | Header Extension Items... | 433 +---------------+---------------+---------------+---------------+ 435 Figure 3: Contact Header Format 437 See Section 4.2 for details on the use of each of these contact 438 header fields. The fields of the contact header are: 440 magic: A four-octet field that always contains the octet sequence 441 0x64 0x74 0x6e 0x21, i.e., the text string "dtn!" in US-ASCII (and 442 UTF-8). 444 Version: A one-octet field value containing the value 4 (current 445 version of the protocol). 447 Flags: A one-octet field of single-bit flags, interpreted according 448 to the descriptions in Table 1. 450 Keepalive Interval: A 16-bit unsigned integer indicating the longest 451 allowable interval, in seconds, between any message being received 452 in this session and a subsequent KEEPALIVE message being received. 454 Segment MRU: A 64-bit unsigned integer indicating the largest 455 allowable single-segment data payload size to be received in this 456 session. Any XFER_SEGMENT sent to this peer SHALL have a data 457 payload no longer than the peer's Segment MRU. The two nodes of a 458 single session MAY have different Segment MRUs, and no relation 459 between the two is required. 461 Transfer MRU: A 64-bit unsigned integer indicating the largest 462 allowable total-bundle data size to be received in this session. 463 Any bundle transfer sent to this peer SHALL have a Total bundle 464 data payload no longer than the peer's Transfer MRU. This value 465 can be used to perform proactive bundle fragmentation. The two 466 nodes of a single session MAY have different Transfer MRUs, and no 467 relation between the two is required. 469 EID Length and EID Data: Together these fields represent a variable- 470 length text string. The EID Length is a 16-bit unsigned integer 471 indicating the number of octets of EID Data to follow. A zero EID 472 Length SHALL be used to indicate the lack of EID rather than a 473 truly empty EID. This case allows an node to avoid exposing EID 474 information on an untrusted network. A non-zero-length EID Data 475 SHALL contain the UTF-8 encoded EID of some singleton endpoint in 476 which the sending node is a member, in the canonical format of 477 :. This EID encoding is 478 consistent with [I-D.ietf-dtn-bpbis]. 480 Header Extension Length Header Extension Items: Together these 481 fields represent protocol extension data not defined by this 482 specification. The Header Extension Length is the total number of 483 octets to follow which are used to encode the Header Extension 484 Item list. The encoding of each Header Extension Item is 485 identical form as described in Section 4.1.1. 487 +----------+--------+-----------------------------------------------+ 488 | Name | Code | Description | 489 +----------+--------+-----------------------------------------------+ 490 | CAN_TLS | 0x01 | If bit is set, indicates that the sending | 491 | | | peer is capable of TLS security. | 492 | | | | 493 | Reserved | others | 494 +----------+--------+-----------------------------------------------+ 496 Table 1: Contact Header Flags 498 4.1.1. Header Extension Items 500 Each of the Header Extension items SHALL be encoded in an identical 501 Type-Length-Value (TLV) container form as indicated in Figure 4. The 502 fields of the header extension item are: 504 Flags: A one-octet field containing generic bit flags about the 505 item, which are listed in Table 2. If a TCPCL node receives an 506 extension item with an unknown Item Type and the CRITICAL flag 507 set, the node SHALL close the TCPCL session with SHUTDOWN reason 508 code of "Contact Failure". If the CRITICAL flag is not set, an 509 node SHALL skip over and ignore any item with an unkonwn Item 510 Type. 512 Item Type: A 16-bit unsigned integer field containing the type of 513 the extension item. Each type This specification does not define 514 any extension types directly, but does allocate an IANA registry 515 for such codes (see Section 8.3). 517 Item Length: A 32-bit unsigned integer field containing the number 518 of Item Value octets to follow. 520 Item Value: A variable-length data field which is interpreted 521 according to the associated Item Type. This specification places 522 no restrictions on an extensions use of available Item Value data. 523 Extension specification SHOULD avoid the use of large data 524 exchanges within the TCPCLv4 contact header as no bundle transfers 525 can begin until the a full contact exchange and negotiation has 526 been completed. 528 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 529 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 530 +---------------+---------------+---------------+---------------+ 531 | Item Flags | Item Type | Item Length...| 532 +---------------+---------------+---------------+---------------+ 533 | length contd. | Item Value... | 534 +---------------+---------------+---------------+---------------+ 535 | value contd. | 536 +---------------+---------------+---------------+---------------+ 538 Figure 4: Header Extention Item Format 540 +----------+--------+-----------------------------------------------+ 541 | Name | Code | Description | 542 +----------+--------+-----------------------------------------------+ 543 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 544 | | | peer must handle the extension item. | 545 | | | | 546 | Reserved | others | 547 +----------+--------+-----------------------------------------------+ 549 Table 2: Header Extension Item Flags 551 4.2. Validation and Parameter Negotiation 553 Upon reception of the contact header, each node follows the following 554 procedures to ensure the validity of the TCPCL session and to 555 negotiate values for the session parameters. 557 If the magic string is not present or is not valid, the connection 558 MUST be terminated. The intent of the magic string is to provide 559 some protection against an inadvertent TCP connection by a different 560 protocol than the one described in this document. To prevent a flood 561 of repeated connections from a misconfigured application, a node MAY 562 elect to hold an invalid connection open and idle for some time 563 before closing it. 565 A connecting TCPCL node SHALL send the highest TCPCL protocol version 566 on a first session attempt for a TCPCL peer. If a connecting node 567 receives a SHUTDOWN message with reason of "Version Mismatch", that 568 node MAY attempt further TCPCL sessions with the peer using earlier 569 protocol version numbers in decreasing order. Managing multi-TCPCL- 570 session state such as this is an implementation matter. 572 If a node receives a contact header containing a version that is 573 greater than the current version of the protocol that the node 574 implements, then the node SHALL shutdown the session with a reason 575 code of "Version mismatch". If a node receives a contact header with 576 a version that is lower than the version of the protocol that the 577 node implements, the node MAY either terminate the session (with a 578 reason code of "Version mismatch"). Otherwise, the node MAY adapt 579 its operation to conform to the older version of the protocol. The 580 decision of version fall-back is an implementation matter. 582 A node calculates the parameters for a TCPCL session by negotiating 583 the values from its own preferences (conveyed by the contact header 584 it sent to the peer) with the preferences of the peer node (expressed 585 in the contact header that it received from the peer). The 586 negotatiated parameters defined by this specification are described 587 in the following paragraphs. 589 Session Keepalive: Negotiation of the Session Keepalive parameter is 590 performed by taking the minimum of this two contact headers' 591 Keepalive Interval. If the negotiated Session Keepalive is zero 592 (i.e. one or both contact headers contains a zero Keepalive 593 Interval), then the keepalive feature (described in Section 5.2.1) 594 is disabled. There is no logical minimum value for the keepalive 595 interval, but when used for many sessions on an open, shared 596 network a short interval could lead to excessive traffic. For 597 shared network use, nodes SHOULD choose a keepalive interval no 598 shorter than 30 seconds. There is no logical maximum value for 599 the keepalive interval, but an idle TCP connection is liable for 600 closure by the host operating system if the keepalive time is 601 longer than tens-of-minutes. Nodes SHOULD choose a keepalive 602 interval no longer than 10 minutes (600 seconds). 604 Enable TLS: Negotiation of the Enable TLS parameter is performed by 605 taking the logical AND of the two contact headers' CAN_TLS flags. 606 If the negotiated Enable TLS value is true then TLS negotiation 607 feature (described in Section 4.3) begins immediately following 608 the contact header exchange. The security policy on either node 609 MAY forbid the establishment of a TCPCL session for any Enable TLS 610 result (or for any combination of local or peer CAN_TLS flag), in 611 which case the node SHALL shutdown the session with a reason code 612 of "Contact Failure". For example, one node may disallow TCPCL 613 sessions without TLS, while a second node may disallow sessions 614 with TLS. Also note that this Contact Failure (of the header 615 negotiation) is different than a TLS Failure (after an agreed-upon 616 Enable TLS state). 618 Once this process of parameter negotiation is completed (which 619 includes a possible completed TLS handshakede of the connection to 620 use TLS), this protocol defines no additional mechanism to change the 621 parameters of an established session; to effect such a change, the 622 TCPCL session MUST be terminated and a new session established. 624 4.3. Session Security 626 This version of the TCPCL supports establishing a Transport Layer 627 Security (TLS) session within an existing TCP connection. Negotation 628 of whether or not to initiate TLS within a TCPCL session is part of 629 the contact header as described in Section 4.2. The TLS handshake, 630 if it occurs, is considered to be part of the contact negotiation 631 before the TCPCL session itself is established. Specifics about 632 sensitive data exposure are discussed in Section 7. 634 When TLS is used within the TCPCL it affects the entire session. By 635 convention, this protocol uses the node which initiated the 636 underlying TCP connection as the "client" role of the TLS handshake 637 request. Once a TLS session is established within TCPCL, there is no 638 mechanism provided to end the TLS session and downgrade the session. 639 If a non-TLS session is desired after a TLS session is started then 640 the entire TCPCL session MUST be shutdown first. 642 After negotiating an Enable TLS parameter of true, and before any 643 other TCPCL messages are sent within the session, the session nodes 644 SHALL begin a TLS handshake in accordance with [RFC5246]. The 645 parameters within each TLS negotation are implementation dependent 646 but any TCPCL node SHOULD follow all recommended best practices of 647 [RFC7525]. 649 4.3.1. TLS Handshake Result 651 If a TLS handshake cannot negotiate a TLS session, both nodes of the 652 TCPCL session SHALL cause a TCPCL shutdown with reason "TLS Failure". 654 After a TLS session is successfuly established, both TCPCL nodes 655 SHALL re-exchange TCPCL Contact Header messages. Any information 656 cached from the prior Contact Header exchange SHALL be discarded. 657 This re-exchange avoids man-in-the-middle attack in identical fashion 658 to [RFC2595]. Each re-exchange header CAN_TLS flag SHALL be 659 identical to the original header CAN_TLS flag from the same node. 660 The CAN_TLS logic (TLS negotiation) SHALL NOT apply during header re- 661 exchange. This reinforces the fact that there is no TLS downgrade 662 mechanism. 664 4.3.2. Example TLS Initiation 666 A summary of a typical CAN_TLS usage is shown in the sequence in 667 Figure 5 below. 669 Node A Node B 670 ====== ====== 672 +-------------------------+ 673 | Open TCP Connnection | -> 674 +-------------------------+ +-------------------------+ 675 <- | Accept Connection | 676 +-------------------------+ 678 +-------------------------+ +-------------------------+ 679 | Contact Header | -> <- | Contact Header | 680 +-------------------------+ +-------------------------+ 682 +-------------------------+ +-------------------------+ 683 | TLS Negotiation | -> <- | TLS Negotiation | 684 | (as client) | | (as server) | 685 +-------------------------+ +-------------------------+ 687 +-------------------------+ +-------------------------+ 688 | Contact Header | -> <- | Contact Header | 689 +-------------------------+ +-------------------------+ 691 ... secured TCPCL messaging ... 693 +-------------------------+ +-------------------------+ 694 | SHUTDOWN | -> <- | SHUTDOWN | 695 +-------------------------+ +-------------------------+ 697 Figure 5: A simple visual example of TCPCL TLS Establishment between 698 two nodes 700 5. Established Session Operation 702 This section describes the protocol operation for the duration of an 703 established session, including the mechanism for transmitting bundles 704 over the session. 706 5.1. Message Type Codes 708 After the initial exchange of a contact header, all messages 709 transmitted over the session are identified by a one-octet header 710 with the following structure: 712 0 1 2 3 4 5 6 7 713 +---------------+ 714 | Message Type | 715 +---------------+ 717 Figure 6: Format of the Message Header 719 The message header fields are as follows: 721 Message Type: Indicates the type of the message as per Table 3 722 below. 724 The message types defined in this specificaiton are listed in 725 Table 3. Encoded values are listed in Section 8.4. 727 +--------------+----------------------------------------------------+ 728 | Type | Description | 729 +--------------+----------------------------------------------------+ 730 | XFER_INIT | Contains the length (in octets) of the next | 731 | | transfer, as described in Section 5.3.2. | 732 | | | 733 | XFER_SEGMENT | Indicates the transmission of a segment of bundle | 734 | | data, as described in Section 5.3.3. | 735 | | | 736 | XFER_ACK | Acknowledges reception of a data segment, as | 737 | | described in Section 5.3.4. | 738 | | | 739 | XFER_REFUSE | Indicates that the transmission of the current | 740 | | bundle SHALL be stopped, as described in Section | 741 | | 5.3.5. | 742 | | | 743 | KEEPALIVE | Used to keep TCPCL session active, as described in | 744 | | Section 5.2.1. | 745 | | | 746 | SHUTDOWN | Indicates that one of the nodes participating in | 747 | | the session wishes to cleanly terminate the | 748 | | session, as described in Section 6. | 749 | | | 750 | MSG_REJECT | Contains a TCPCL message rejection, as described | 751 | | in Section 5.2.2. | 752 +--------------+----------------------------------------------------+ 754 Table 3: TCPCL Message Types 756 5.2. Upkeep and Status Messages 758 5.2.1. Session Upkeep (KEEPALIVE) 760 The protocol includes a provision for transmission of KEEPALIVE 761 messages over the TCPCL session to help determine if the underlying 762 TCP connection has been disrupted. 764 As described in Section 4.1, one of the parameters in the contact 765 header is the Keepalive Interval. Both sides populate this field 766 with their requested intervals (in seconds) between KEEPALIVE 767 messages. 769 The format of a KEEPALIVE message is a one-octet message type code of 770 KEEPALIVE (as described in Table 3) with no additional data. Both 771 sides SHOULD send a KEEPALIVE message whenever the negotiated 772 interval has elapsed with no transmission of any message (KEEPALIVE 773 or other). 775 If no message (KEEPALIVE or other) has been received for at least 776 twice the Keepalive Interval, then either party MAY terminate the 777 session by transmitting a one-octet SHUTDOWN message (as described in 778 Section 6.1, with reason code "Idle Timeout") and by closing the 779 session. 781 Note: The Keepalive Interval SHOULD not be chosen too short as TCP 782 retransmissions MAY occur in case of packet loss. Those will have to 783 be triggered by a timeout (TCP retransmission timeout (RTO)), which 784 is dependent on the measured RTT for the TCP connection so that 785 KEEPALIVE messages MAY experience noticeable latency. 787 5.2.2. Message Rejection (MSG_REJECT) 789 If a TCPCL node receives a message which is unknown to it (possibly 790 due to an unhandled protocol mismatch) or is inappropriate for the 791 current session state (e.g. a KEEPALIVE message received after 792 contact header negotation has disabled that feature), there is a 793 protocol-level message to signal this condition in the form of a 794 MSG_REJECT reply. 796 The format of a MSG_REJECT message follows: 798 +-----------------------------+ 799 | Message Header | 800 +-----------------------------+ 801 | Reason Code (U8) | 802 +-----------------------------+ 803 | Rejected Message Header | 804 +-----------------------------+ 806 Figure 7: Format of MSG_REJECT Messages 808 The fields of the MSG_REJECT message are: 810 Reason Code: A one-octet refusal reason code interpreted according 811 to the descriptions in Table 4. 813 Rejected Message Header: The Rejected Message Header is a copy of 814 the Message Header to which the MSG_REJECT message is sent as a 815 response. 817 +-------------+------+----------------------------------------------+ 818 | Name | Code | Description | 819 +-------------+------+----------------------------------------------+ 820 | Message | 0x01 | A message was received with a Message Type | 821 | Type | | code unknown to the TCPCL node. | 822 | Unknown | | | 823 | | | | 824 | Message | 0x02 | A message was received but the TCPCL node | 825 | Unsupported | | cannot comply with the message contents. | 826 | | | | 827 | Message | 0x03 | A message was received while the session is | 828 | Unexpected | | in a state in which the message is not | 829 | | | expected. | 830 +-------------+------+----------------------------------------------+ 832 Table 4: MSG_REJECT Reason Codes 834 5.3. Bundle Transfer 836 All of the message in this section are directly associated with 837 transfering a bundle between TCPCL nodes. 839 A single TCPCL transfer results in a bundle (handled by the 840 convergence layer as opaque data) being exchanged from one node to 841 the other. In TCPCL a transfer is accomplished by dividing a single 842 bundle up into "segments" based on the receving-side Segment MRU (see 843 Section 4.1). 845 A single transfer (and by extension a single segment) SHALL NOT 846 contain data of more than a single bundle. This requirement is 847 imposed on the agent using the TCPCL rather than TCPCL itself. 849 5.3.1. Bundle Transfer ID 851 Each of the bundle transfer messages contains a Transfer ID number 852 which is used to correlate messages originating from sender and 853 receiver of a bundle. A Transfer ID does not attempt to address 854 uniqueness of the bundle data itself and has no relation to concepts 855 such as bundle fragmentation. Each invocation of TCPCL by the bundle 856 protocol agent, requesting transmission of a bundle (fragmentary or 857 otherwise), results in the initiation of a single TCPCL transfer. 858 Each transfer entails the sending of a XFER_INIT message and some 859 number of XFER_SEGMENT and XFER_ACK messages; all are correlated by 860 the same Transfer ID. 862 Transfer IDs from each node SHALL be unique within a single TCPCL 863 session. The initial Transfer ID from each node SHALL have value 864 zero. Subsequent Transfer ID values SHALL be incremented from the 865 prior Transfer ID value by one. Upon exhaustion of the entire 64-bit 866 Transfer ID space, the sending node SHALL terminate the session with 867 SHUTDOWN reason code "Resource Exhaustion". 869 For bidirectional bundle transfers, a TCPCL node SHOULD NOT rely on 870 any relation between Transfer IDs originating from each side of the 871 TCPCL session. 873 5.3.2. Transfer Initialization (XFER_INIT) 875 The XFER_INIT message contains the total length, in octets, of the 876 bundle data in the associated transfer. The total length is 877 formatted as a 64-bit unsigned integer. 879 The purpose of the XFER_INIT message is to allow nodes to 880 preemptively refuse bundles that would exceed their resources or to 881 prepare storage on the receiving node for the upcoming bundle data. 882 See Section 5.3.5 for details on when refusal based on XFER_INIT 883 content is acceptable. 885 The Total Bundle Length field within a XFER_INIT message SHALL be 886 treated as authoritative by the receiver. If, for whatever reason, 887 the actual total length of bundle data received differs from the 888 value indicated by the XFER_INIT message, the receiver SHOULD treat 889 the transmitted data as invalid. 891 The format of the XFER_INIT message is as follows: 893 +-----------------------------+ 894 | Message Header | 895 +-----------------------------+ 896 | Transfer ID (U64) | 897 +-----------------------------+ 898 | Total bundle length (U64) | 899 +-----------------------------+ 901 Figure 8: Format of XFER_INIT Messages 903 The fields of the XFER_INIT message are: 905 Transfer ID: A 64-bit unsigned integer identifying the transfer 906 about to begin. 908 Total bundle length: A 64-bit unsigned integer indicating the size 909 of the data-to-be-transferred. 911 An XFER_INIT message SHALL be sent immediately before transmission of 912 any XFER_SEGMENT messages for each Transfer ID. XFER_INIT messages 913 MUST NOT be sent unless the next XFER_SEGMENT message has the 'START' 914 bit set to "1" (i.e., just before the start of a new transfer). 916 A receiver MAY send a BUNDLE_REFUSE message as soon as it receives a 917 XFER_INIT message without waiting for the next XFER_SEGMENT message. 918 The sender MUST be prepared for this and MUST associate the refusal 919 with the correct bundle via the Transfer ID fields. 921 5.3.3. Data Transmission (XFER_SEGMENT) 923 Each bundle is transmitted in one or more data segments. The format 924 of a XFER_SEGMENT message follows in Figure 9. 926 +------------------------------+ 927 | Message Header | 928 +------------------------------+ 929 | Message Flags (U8) | 930 +------------------------------+ 931 | Transfer ID (U64) | 932 +------------------------------+ 933 | Data length (U64) | 934 +------------------------------+ 935 | Data contents (octet string) | 936 +------------------------------+ 938 Figure 9: Format of XFER_SEGMENT Messages 940 The fields of the XFER_SEGMENT message are: 942 Message Flags: A one-octet field of single-bit flags, interpreted 943 according to the descriptions in Table 5. 945 Transfer ID: A 64-bit unsigned integer identifying the transfer 946 being made. 948 Data length: A 64-bit unsigned integer indicating the number of 949 octets in the Data contents to follow. 951 Data contents: The variable-length data payload of the message. 953 +----------+--------+-----------------------------------------------+ 954 | Name | Code | Description | 955 +----------+--------+-----------------------------------------------+ 956 | END | 0x01 | If bit is set, indicates that this is the | 957 | | | last segment of the transfer. | 958 | | | | 959 | START | 0x02 | If bit is set, indicates that this is the | 960 | | | first segment of the transfer. | 961 | | | | 962 | Reserved | others | 963 +----------+--------+-----------------------------------------------+ 965 Table 5: XFER_SEGMENT Flags 967 The flags portion of the message contains two optional values in the 968 two low-order bits, denoted 'START' and 'END' in Table 5. The 969 'START' bit MUST be set to one if it precedes the transmission of the 970 first segment of a transfer. The 'END' bit MUST be set to one when 971 transmitting the last segment of a transfer. In the case where an 972 entire transfer is accomplished in a single segment, both the 'START' 973 and 'END' bits MUST be set to one. 975 Once a transfer of a bundle has commenced, the node MUST only send 976 segments containing sequential portions of that bundle until it sends 977 a segment with the 'END' bit set. No interleaving of multiple 978 transfers from the same node is possible within a single TCPCL 979 session. Simultaneous transfers between two nodes MAY be achieved 980 using multiple TCPCL sessions. 982 5.3.4. Data Acknowledgments (XFER_ACK) 984 Although the TCP transport provides reliable transfer of data between 985 transport peers, the typical BSD sockets interface provides no means 986 to inform a sending application of when the receiving application has 987 processed some amount of transmitted data. Thus, after transmitting 988 some data, a Bundle Protocol agent needs an additional mechanism to 989 determine whether the receiving agent has successfully received the 990 segment. To this end, the TCPCL protocol provides feedback messaging 991 whereby a receiving node transmits acknowledgments of reception of 992 data segments. 994 The format of an XFER_ACK message follows in Figure 10. 996 +-----------------------------+ 997 | Message Header | 998 +-----------------------------+ 999 | Message Flags (U8) | 1000 +-----------------------------+ 1001 | Transfer ID (U64) | 1002 +-----------------------------+ 1003 | Acknowledged length (U64) | 1004 +-----------------------------+ 1006 Figure 10: Format of XFER_ACK Messages 1008 The fields of the XFER_ACK message are: 1010 Message Flags: A one-octet field of single-bit flags, interpreted 1011 according to the descriptions in Table 5. 1013 Transfer ID: A 64-bit unsigned integer identifying the transfer 1014 being acknowledged. 1016 Acknowledged length: A 64-bit unsigned integer indicating the total 1017 number of octets in the transfer which are being acknowledged. 1019 A receving TCPCL endpoing SHALL send an XFER_ACK message in response 1020 to each received XFER_SEGMENT message. The flags portion of the 1021 XFER_ACK header SHALL be set to match the corresponding DATA_SEGEMNT 1022 message being acknowledged. The acknowledged length of each XFER_ACK 1023 contains the sum of the data length fields of all XFER_SEGMENT 1024 messages received so far in the course of the indicated transfer. 1026 For example, suppose the sending node transmits four segments of 1027 bundle data with lengths 100, 200, 500, and 1000, respectively. 1028 After receiving the first segment, the node sends an acknowledgment 1029 of length 100. After the second segment is received, the node sends 1030 an acknowledgment of length 300. The third and fourth 1031 acknowledgments are of length 800 and 1800, respectively. 1033 5.3.5. Transfer Refusal (XFER_REFUSE) 1035 As bundles can be large, the TCPCL supports an optional mechanism by 1036 which a receiving node MAY indicate to the sender that it does not 1037 want to receive the corresponding bundle. 1039 To do so, upon receiving a XFER_INIT or XFER_SEGMENT message, the 1040 node MAY transmit a XFER_REFUSE message. As data segments and 1041 acknowledgments MAY cross on the wire, the bundle that is being 1042 refused SHALL be identified by the Transfer ID of the refusal. 1044 There is no required relation between the Transfer MRU of a TCPCL 1045 node (which is supposed to represent a firm limitation of what the 1046 node will accept) and sending of a XFER_REFUSE message. A 1047 XFER_REFUSE can be used in cases where the agent's bundle storage is 1048 temporarily depleted or somehow constrained. A XFER_REFUSE can also 1049 be used after the bundle header or any bundle data is inspected by an 1050 agent and determined to be unacceptable. 1052 The format of the XFER_REFUSE message is as follows: 1054 +-----------------------------+ 1055 | Message Header | 1056 +-----------------------------+ 1057 | Reason Code (U8) | 1058 +-----------------------------+ 1059 | Transfer ID (U64) | 1060 +-----------------------------+ 1062 Figure 11: Format of XFER_REFUSE Messages 1064 The fields of the XFER_REFUSE message are: 1066 Reason Code: A one-octet refusal reason code interpreted according 1067 to the descriptions in Table 6. 1069 Transfer ID: A 64-bit unsigned integer identifying the transfer 1070 being refused. 1072 +------------+------------------------------------------------------+ 1073 | Name | Semantics | 1074 +------------+------------------------------------------------------+ 1075 | Unknown | Reason for refusal is unknown or not specified. | 1076 | | | 1077 | Completed | The receiver already has the complete bundle. The | 1078 | | sender MAY consider the bundle as completely | 1079 | | received. | 1080 | | | 1081 | No | The receiver's resources are exhausted. The sender | 1082 | Resources | SHOULD apply reactive bundle fragmentation before | 1083 | | retrying. | 1084 | | | 1085 | Retransmit | The receiver has encountered a problem that requires | 1086 | | the bundle to be retransmitted in its entirety. | 1087 +------------+------------------------------------------------------+ 1089 Table 6: XFER_REFUSE Reason Codes 1091 The receiver MUST, for each transfer preceding the one to be refused, 1092 have either acknowledged all XFER_SEGMENTs or refused the bundle 1093 transfer. 1095 The bundle transfer refusal MAY be sent before an entire data segment 1096 is received. If a sender receives a XFER_REFUSE message, the sender 1097 MUST complete the transmission of any partially sent XFER_SEGMENT 1098 message. There is no way to interrupt an individual TCPCL message 1099 partway through sending it. The sender MUST NOT commence 1100 transmission of any further segments of the refused bundle 1101 subsequently. Note, however, that this requirement does not ensure 1102 that a node will not receive another XFER_SEGMENT for the same bundle 1103 after transmitting a XFER_REFUSE message since messages MAY cross on 1104 the wire; if this happens, subsequent segments of the bundle SHOULD 1105 also be refused with a XFER_REFUSE message. 1107 Note: If a bundle transmission is aborted in this way, the receiver 1108 MAY not receive a segment with the 'END' flag set to '1' for the 1109 aborted bundle. The beginning of the next bundle is identified by 1110 the 'START' bit set to '1', indicating the start of a new transfer, 1111 and with a distinct Transfer ID value. 1113 6. Session Termination 1115 This section describes the procedures for ending a TCPCL session. 1117 6.1. Shutdown Message (SHUTDOWN) 1119 To cleanly shut down a session, a SHUTDOWN message MUST be 1120 transmitted by either node at any point following complete 1121 transmission of any other message. A receiving node SHOULD 1122 acknowledge all received data segments before sending a SHUTDOWN 1123 message to end the session. A transmitting node SHALL treat a 1124 SHUTDOWN message received mid-transfer (i.e. before the final 1125 acknowledgement) as a failure of the transfer. 1127 After transmitting a SHUTDOWN message, an node MAY immediately close 1128 the associated TCP connection. Once the SHUTDOWN message is sent, 1129 any further received data on the TCP connection SHOULD be ignored. 1130 Any delay between request to terminate the TCP connection and actual 1131 closing of the connection (a "half-closed" state) MAY be ignored by 1132 the TCPCL node. 1134 The format of the SHUTDOWN message is as follows: 1136 +-----------------------------------+ 1137 | Message Header | 1138 +-----------------------------------+ 1139 | Message Flags (U8) | 1140 +-----------------------------------+ 1141 | Reason Code (optional U8) | 1142 +-----------------------------------+ 1143 | Reconnection Delay (optional U16) | 1144 +-----------------------------------+ 1146 Figure 12: Format of SHUTDOWN Messages 1148 The fields of the SHUTDOWN message are: 1150 Message Flags: A one-octet field of single-bit flags, interpreted 1151 according to the descriptions in Table 7. 1153 Reason Code: A one-octet refusal reason code interpreted according 1154 to the descriptions in Table 8. The Reason Code is present or 1155 absent as indicated by one of the flags. 1157 Reconnection Delay: A 16-bit unsigned integer indicating the desired 1158 delay until further TCPCL sessions to the sending node. The 1159 Reconnection Delay is present or absent as indicated by one of the 1160 flags. 1162 +----------+--------+-----------------------------------------------+ 1163 | Name | Code | Description | 1164 +----------+--------+-----------------------------------------------+ 1165 | D | 0x01 | If bit is set, indicates that a Reconnection | 1166 | | | Delay field is present. | 1167 | | | | 1168 | R | 0x02 | If bit is set, indicates that a Reason Code | 1169 | | | field is present. | 1170 | | | | 1171 | Reserved | others | 1172 +----------+--------+-----------------------------------------------+ 1174 Table 7: SHUTDOWN Flags 1176 It is possible for a node to convey additional information regarding 1177 the reason for session termination. To do so, the node MUST set the 1178 'R' bit in the message flags and transmit a one-octet reason code 1179 immediately following the message header. The specified values of 1180 the reason code are: 1182 +---------------+---------------------------------------------------+ 1183 | Name | Description | 1184 +---------------+---------------------------------------------------+ 1185 | Idle timeout | The session is being closed due to idleness. | 1186 | | | 1187 | Version | The node cannot conform to the specified TCPCL | 1188 | mismatch | protocol version. | 1189 | | | 1190 | Busy | The node is too busy to handle the current | 1191 | | session. | 1192 | | | 1193 | Contact | The node cannot interpret or negotiate contact | 1194 | Failure | header option. | 1195 | | | 1196 | TLS Failure | The node failed to negotiate TLS session and | 1197 | | cannot continue the session. | 1198 | | | 1199 | Resource | The node has run into some resoure limit and | 1200 | Exhaustion | cannot continue the session. | 1201 +---------------+---------------------------------------------------+ 1203 Table 8: SHUTDOWN Reason Codes 1205 It is also possible to convey a requested reconnection delay to 1206 indicate how long the other node MUST wait before attempting session 1207 re-establishment. To do so, the node sets the 'D' bit in the message 1208 flags and then transmits an 16-bit unsigned integer specifying the 1209 requested delay, in seconds, following the message header (and 1210 optionally, the SHUTDOWN reason code). The value 0 SHALL be 1211 interpreted as an infinite delay, i.e., that the connecting node MUST 1212 NOT re-establish the session. In contrast, if the node does not wish 1213 to request a delay, it SHOULD omit the reconnection delay field (and 1214 set the 'D' bit to zero). 1216 A session shutdown MAY occur immediately after TCP connection 1217 establishment or reception of a contact header (and prior to any 1218 further data exchange). This MAY, for example, be used to notify 1219 that the node is currently not able or willing to communicate. 1220 However, a node MUST always send the contact header to its peer 1221 before sending a SHUTDOWN message. 1223 If either node terminates a session prematurely in this manner, it 1224 SHOULD send a SHUTDOWN message and MUST indicate a reason code unless 1225 the incoming connection did not include the magic string. If the 1226 magic string was not present, a node SHOULD close the TCP connection 1227 without sending a SHUTDOWN message. If a node does not want its peer 1228 to reopen a connection immediately, it SHOULD set the 'D' bit in the 1229 flags and include a reconnection delay to indicate when the peer is 1230 allowed to attempt another session setup. 1232 If a session is to be terminated before a protocol message has 1233 completed being sent, then the node MUST NOT transmit the SHUTDOWN 1234 message but still SHOULD close the TCP connection. Each TCPCL 1235 message is contiguous in the octet stream and has no ability to be 1236 cut short and/or preempted by an other message. This is particularly 1237 important when large segment sizes are being transmitted; either 1238 entire XFER_SEGMENT is sent before a SHUTDOWN message or the 1239 connection is simply termiated mid-XFER_SEGMENT. 1241 6.2. Idle Session Shutdown 1243 The protocol includes a provision for clean shutdown of idle 1244 sessions. Determining the length of time to wait before closing idle 1245 sessions, if they are to be closed at all, is an implementation and 1246 configuration matter. 1248 If there is a configured time to close idle links and if no bundle 1249 data (other than KEEPALIVE messages) has been received for at least 1250 that amount of time, then either node MAY terminate the session by 1251 transmitting a SHUTDOWN message indicating the reason code of 'Idle 1252 timeout' (as described in Table 8). After receiving a SHUTDOWN 1253 message in response, both sides MAY close the TCP connection. 1255 7. Security Considerations 1257 One security consideration for this protocol relates to the fact that 1258 nodes present their endpoint identifier as part of the contact header 1259 exchange. It would be possible for a node to fake this value and 1260 present the identity of a singleton endpoint in which the node is not 1261 a member, essentially masquerading as another DTN node. If this 1262 identifier is used outside of a TLS-secured session or without 1263 further verification as a means to determine which bundles are 1264 transmitted over the session, then the node that has falsified its 1265 identity would be able to obtain bundles that it otherwise would not 1266 have. Therefore, a node SHALL NOT use the EID value of an unsecured 1267 contact header to derive a peer node's identity unless it can 1268 corroborate it via other means. When TCPCL session security is 1269 mandatory, an endpoint SHALL transmit initial unsecured contact 1270 header values indicated in Table 9 in order. These values avoid 1271 unnecessarily leaking endpoing parameters and will be ignored when 1272 secure contact header re-exchange occurs. 1274 +--------------------+---------------------------------------------+ 1275 | Parameter | Value | 1276 +--------------------+---------------------------------------------+ 1277 | Flags | The USE_TLS flag is set. | 1278 | | | 1279 | Keepalive Interval | Zero, indicating no keepalive. | 1280 | | | 1281 | Segment MRU | Zero, indicating all segments are refused. | 1282 | | | 1283 | Transfer MRU | Zero, indicating all transfers are refused. | 1284 | | | 1285 | EID | Empty, indating lack of EID. | 1286 +--------------------+---------------------------------------------+ 1288 Table 9: Recommended Unsecured Contact Header 1290 TCPCL can be used to provide point-to-point transport security, but 1291 does not provide security of data-at-rest and does not guarantee end- 1292 to-end bundle security. The mechanisms defined in [RFC6257] and 1293 [I-D.ietf-dtn-bpsec] are to be used instead. 1295 Even when using TLS to secure the TCPCL session, the actual 1296 ciphersuite negotiated between the TLS peers MAY be insecure. TLS 1297 can be used to perform authentication without data confidentiality, 1298 for example. It is up to security policies within each TCPCL node to 1299 ensure that the negotiated TLS ciphersuite meets transport security 1300 requirements. This is identical behavior to STARTTLS use in 1301 [RFC2595]. 1303 Another consideration for this protocol relates to denial-of-service 1304 attacks. A node MAY send a large amount of data over a TCPCL 1305 session, requiring the receiving node to handle the data, attempt to 1306 stop the flood of data by sending a XFER_REFUSE message, or forcibly 1307 terminate the session. This burden could cause denial of service on 1308 other, well-behaving sessions. There is also nothing to prevent a 1309 malicious node from continually establishing sessions and repeatedly 1310 trying to send copious amounts of bundle data. A listening node MAY 1311 take countermeasures such as ignoring TCP SYN messages, closing TCP 1312 connections as soon as they are established, waiting before sending 1313 the contact header, sending a SHUTDOWN message quickly or with a 1314 delay, etc. 1316 8. IANA Considerations 1318 In this section, registration procedures are as defined in [RFC5226]. 1320 Some of the registries below are created new for TCPCLv4 but share 1321 code values with TCPCLv3. This was done to disambiguate the use of 1322 these values between TCPCLv3 and TCPCLv4 while preserving the 1323 semantics of some values. 1325 8.1. Port Number 1327 Port number 4556 has been previously assigned as the default port for 1328 the TCP convergence layer in [RFC7242]. This assignment is unchanged 1329 by protocol version 4. Each TCPCL node identifies its TCPCL protocol 1330 version in its initial contact (see Section 8.2), so there is no 1331 ambiguity about what protocol is being used. 1333 +------------------------+-------------------------------------+ 1334 | Parameter | Value | 1335 +------------------------+-------------------------------------+ 1336 | Service Name: | dtn-bundle | 1337 | | | 1338 | Transport Protocol(s): | TCP | 1339 | | | 1340 | Assignee: | Simon Perreault | 1341 | | | 1342 | Contact: | Simon Perreault | 1343 | | | 1344 | Description: | DTN Bundle TCP CL Protocol | 1345 | | | 1346 | Reference: | [RFC7242] | 1347 | | | 1348 | Port Number: | 4556 | 1349 +------------------------+-------------------------------------+ 1351 8.2. Protocol Versions 1353 IANA has created, under the "Bundle Protocol" registry, a sub- 1354 registry titled "Bundle Protocol TCP Convergence-Layer Version 1355 Numbers" and initialized it with the following table. The 1356 registration procedure is RFC Required. 1358 +-------+-------------+---------------------+ 1359 | Value | Description | Reference | 1360 +-------+-------------+---------------------+ 1361 | 0 | Reserved | [RFC7242] | 1362 | | | | 1363 | 1 | Reserved | [RFC7242] | 1364 | | | | 1365 | 2 | Reserved | [RFC7242] | 1366 | | | | 1367 | 3 | TCPCL | [RFC7242] | 1368 | | | | 1369 | 4 | TCPCLbis | This specification. | 1370 | | | | 1371 | 5-255 | Unassigned | 1372 +-------+-------------+---------------------+ 1374 8.3. Header Extension Types 1376 EDITOR NOTE: sub-registry to-be-created upon publication of this 1377 specification. 1379 IANA will create, under the "Bundle Protocol" registry, a sub- 1380 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1381 Header Extension Types" and initialized it with the contents of 1382 Table 10. The registration procedure is RFC Required within the 1383 lower range 0x0001--0x3fff. Values in the range 0x8000--0xffff are 1384 reserved for use on private networks for functions not published to 1385 the IANA. 1387 +----------------+--------------------------+ 1388 | Code | Message Type | 1389 +----------------+--------------------------+ 1390 | 0x0000 | Reserved | 1391 | | | 1392 | 0x0001--0x3fff | Unassigned | 1393 | | | 1394 | 0x8000--0xffff | Private/Experimental Use | 1395 +----------------+--------------------------+ 1397 Table 10: Header Extension Type Codes 1399 8.4. Message Types 1401 EDITOR NOTE: sub-registry to-be-created upon publication of this 1402 specification. 1404 IANA will create, under the "Bundle Protocol" registry, a sub- 1405 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1406 Message Types" and initialized it with the contents of Table 11. The 1407 registration procedure is RFC Required. 1409 +-----------+--------------+ 1410 | Code | Message Type | 1411 +-----------+--------------+ 1412 | 0x00 | Reserved | 1413 | | | 1414 | 0x01 | XFER_SEGMENT | 1415 | | | 1416 | 0x02 | XFER_ACK | 1417 | | | 1418 | 0x03 | XFER_REFUSE | 1419 | | | 1420 | 0x04 | KEEPALIVE | 1421 | | | 1422 | 0x05 | SHUTDOWN | 1423 | | | 1424 | 0x06 | XFER_INIT | 1425 | | | 1426 | 0x07 | MSG_REJECT | 1427 | | | 1428 | 0x08--0xf | Unassigned | 1429 +-----------+--------------+ 1431 Table 11: Message Type Codes 1433 8.5. XFER_REFUSE Reason Codes 1435 EDITOR NOTE: sub-registry to-be-created upon publication of this 1436 specification. 1438 IANA will create, under the "Bundle Protocol" registry, a sub- 1439 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1440 XFER_REFUSE Reason Codes" and initialized it with the contents of 1441 Table 12. The registration procedure is RFC Required. 1443 +----------+---------------------------+ 1444 | Code | Refusal Reason | 1445 +----------+---------------------------+ 1446 | 0x0 | Unknown | 1447 | | | 1448 | 0x1 | Completed | 1449 | | | 1450 | 0x2 | No Resources | 1451 | | | 1452 | 0x3 | Retransmit | 1453 | | | 1454 | 0x4--0x7 | Unassigned | 1455 | | | 1456 | 0x8--0xf | Reserved for future usage | 1457 +----------+---------------------------+ 1459 Table 12: XFER_REFUSE Reason Codes 1461 8.6. SHUTDOWN Reason Codes 1463 EDITOR NOTE: sub-registry to-be-created upon publication of this 1464 specification. 1466 IANA will create, under the "Bundle Protocol" registry, a sub- 1467 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1468 SHUTDOWN Reason Codes" and initialized it with the contents of 1469 Table 13. The registration procedure is RFC Required. 1471 +------------+------------------+ 1472 | Code | Shutdown Reason | 1473 +------------+------------------+ 1474 | 0x00 | Idle timeout | 1475 | | | 1476 | 0x01 | Version mismatch | 1477 | | | 1478 | 0x02 | Busy | 1479 | | | 1480 | 0x03 | Contact Failure | 1481 | | | 1482 | 0x04 | TLS failure | 1483 | | | 1484 | 0x05--0xFF | Unassigned | 1485 +------------+------------------+ 1487 Table 13: SHUTDOWN Reason Codes 1489 8.7. MSG_REJECT Reason Codes 1491 EDITOR NOTE: sub-registry to-be-created upon publication of this 1492 specification. 1494 IANA will create, under the "Bundle Protocol" registry, a sub- 1495 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1496 MSG_REJECT Reason Codes" and initialized it with the contents of 1497 Table 14. The registration procedure is RFC Required. 1499 +-----------+----------------------+ 1500 | Code | Rejection Reason | 1501 +-----------+----------------------+ 1502 | 0x00 | reserved | 1503 | | | 1504 | 0x01 | Message Type Unknown | 1505 | | | 1506 | 0x02 | Message Unsupported | 1507 | | | 1508 | 0x03 | Message Unexpected | 1509 | | | 1510 | 0x04-0xFF | Unassigned | 1511 +-----------+----------------------+ 1513 Table 14: REJECT Reason Codes 1515 9. Acknowledgments 1517 This memo is based on comments on implementation of [RFC7242] 1518 provided from Scott Burleigh. 1520 10. References 1522 10.1. Normative References 1524 [I-D.ietf-dtn-bpbis] 1525 Burleigh, S., Fall, K., and E. Birrane, "Bundle Protocol", 1526 draft-ietf-dtn-bpbis-08 (work in progress), August 2017. 1528 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1529 Requirement Levels", BCP 14, RFC 2119, 1530 DOI 10.17487/RFC2119, March 1997, 1531 . 1533 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 1534 Specification", RFC 5050, DOI 10.17487/RFC5050, November 1535 2007, . 1537 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1538 IANA Considerations Section in RFCs", RFC 5226, 1539 DOI 10.17487/RFC5226, May 2008, 1540 . 1542 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1543 (TLS) Protocol Version 1.2", RFC 5246, 1544 DOI 10.17487/RFC5246, August 2008, 1545 . 1547 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 1548 "Recommendations for Secure Use of Transport Layer 1549 Security (TLS) and Datagram Transport Layer Security 1550 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 1551 2015, . 1553 10.2. Informative References 1555 [I-D.ietf-dtn-bpsec] 1556 Birrane, E. and K. McKeever, "Bundle Protocol Security 1557 Specification", draft-ietf-dtn-bpsec-06 (work in 1558 progress), October 2017. 1560 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 1561 RFC 2595, DOI 10.17487/RFC2595, June 1999, 1562 . 1564 [RFC4838] Cerf, V., Burleigh, S., Hooke, A., Torgerson, L., Durst, 1565 R., Scott, K., Fall, K., and H. Weiss, "Delay-Tolerant 1566 Networking Architecture", RFC 4838, DOI 10.17487/RFC4838, 1567 April 2007, . 1569 [RFC6257] Symington, S., Farrell, S., Weiss, H., and P. Lovell, 1570 "Bundle Security Protocol Specification", RFC 6257, 1571 DOI 10.17487/RFC6257, May 2011, 1572 . 1574 [RFC7242] Demmer, M., Ott, J., and S. Perreault, "Delay-Tolerant 1575 Networking TCP Convergence-Layer Protocol", RFC 7242, 1576 DOI 10.17487/RFC7242, June 2014, 1577 . 1579 Appendix A. Significant changes from RFC7242 1581 The areas in which changes from [RFC7242] have been made to existing 1582 headers and messages are: 1584 o Changed contact header content to limit number of negotiated 1585 options. 1587 o Added contact option to negotiate maximum segment size (per each 1588 direction). 1590 o Added contact header extension capability. 1592 o Defined new IANA registries for message / type / reason codes to 1593 allow renaming some codes for clarity. 1595 o Expanded Message Header to octet-aligned fields instead of bit- 1596 packing. 1598 o Added a bundle transfer identification number to all bundle- 1599 related messages (XFER_INIT, XFER_SEGMENT, XFER_ACK, XFER_REFUSE). 1601 o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. 1603 o Removed all uses of SDNV fields and replaced with fixed-bit-length 1604 fields. 1606 The areas in which extensions from [RFC7242] have been made as new 1607 messages and codes are: 1609 o Added contact negotation failure SHUTDOWN reason code. 1611 o Added MSG_REJECT message to indicate an unknown or unhandled 1612 message was received. 1614 o Added TLS session security mechanism. 1616 o Added TLS failure SHUTDOWN reason code. 1618 Authors' Addresses 1620 Brian Sipos 1621 RKF Engineering Solutions, LLC 1622 7500 Old Georgetown Road 1623 Suite 1275 1624 Bethesda, MD 20814-6198 1625 US 1627 Email: BSipos@rkf-eng.com 1628 Michael Demmer 1629 University of California, Berkeley 1630 Computer Science Division 1631 445 Soda Hall 1632 Berkeley, CA 94720-1776 1633 US 1635 Email: demmer@cs.berkeley.edu 1637 Joerg Ott 1638 Aalto University 1639 Department of Communications and Networking 1640 PO Box 13000 1641 Aalto 02015 1642 Finland 1644 Email: jo@netlab.tkk.fi 1646 Simon Perreault 1647 Quebec, QC 1648 Canada 1650 Email: simon@per.reau.lt