idnits 2.17.1 draft-ietf-dtn-tcpclv4-09.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 abstract seems to contain references ([RFC7242]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. -- The draft header indicates that this document obsoletes RFC7242, but the abstract doesn't seem to directly say this. It does mention RFC7242 though, so this could be OK. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (June 24, 2018) is 2133 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: 'TCPTERM' is mentioned on line 586, but not defined == Missing Reference: 'SESSTERM' is mentioned on line 639, but not defined == Missing Reference: 'I1' is mentioned on line 787, but not defined == Missing Reference: 'L1' is mentioned on line 775, but not defined == Missing Reference: 'L2' is mentioned on line 775, but not defined == Missing Reference: 'L3' is mentioned on line 781, but not defined == Outdated reference: A later version (-31) exists of draft-ietf-dtn-bpbis-11 ** Obsolete normative reference: RFC 793 (Obsoleted by RFC 9293) ** 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 (~~), 9 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: December 26, 2018 J. Ott 7 Aalto University 8 S. Perreault 9 June 24, 2018 11 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 12 draft-ietf-dtn-tcpclv4-09 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 of [RFC7242] and updates to the Bundle Protocol 20 contents, encodings, and convergence layer requirements in Bundle 21 Protocol Version 7. Specifically, the TCPCLv4 uses CBOR-encoded BPv7 22 bundles as its service data unit being transported and provides a 23 reliable transport of such bundles. Several new IANA registries are 24 defined for TCPCLv4 which define some behaviors inherited from 25 TCPCLv3 but with updated encodings and/or semantics. 27 Status of This Memo 29 This Internet-Draft is submitted in full conformance with the 30 provisions of BCP 78 and BCP 79. 32 Internet-Drafts are working documents of the Internet Engineering 33 Task Force (IETF). Note that other groups may also distribute 34 working documents as Internet-Drafts. The list of current Internet- 35 Drafts is at https://datatracker.ietf.org/drafts/current/. 37 Internet-Drafts are draft documents valid for a maximum of six months 38 and may be updated, replaced, or obsoleted by other documents at any 39 time. It is inappropriate to use Internet-Drafts as reference 40 material or to cite them other than as "work in progress." 42 This Internet-Draft will expire on December 26, 2018. 44 Copyright Notice 46 Copyright (c) 2018 IETF Trust and the persons identified as the 47 document authors. All rights reserved. 49 This document is subject to BCP 78 and the IETF Trust's Legal 50 Provisions Relating to IETF Documents 51 (https://trustee.ietf.org/license-info) in effect on the date of 52 publication of this document. Please review these documents 53 carefully, as they describe your rights and restrictions with respect 54 to this document. Code Components extracted from this document must 55 include Simplified BSD License text as described in Section 4.e of 56 the Trust Legal Provisions and are provided without warranty as 57 described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 62 1.1. Convergence Layer Services . . . . . . . . . . . . . . . 4 63 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 6 64 2.1. Definitions Specific to the TCPCL Protocol . . . . . . . 6 65 3. General Protocol Description . . . . . . . . . . . . . . . . 9 66 3.1. TCPCL Session Overview . . . . . . . . . . . . . . . . . 9 67 3.2. TCPCL States and Transitions . . . . . . . . . . . . . . 11 68 3.3. Transfer Segmentation Policies . . . . . . . . . . . . . 16 69 3.4. Example Message Exchange . . . . . . . . . . . . . . . . 17 70 4. Session Establishment . . . . . . . . . . . . . . . . . . . . 19 71 4.1. TCP Connection . . . . . . . . . . . . . . . . . . . . . 19 72 4.2. Contact Header . . . . . . . . . . . . . . . . . . . . . 19 73 4.3. Contact Validation and Negotiation . . . . . . . . . . . 20 74 4.4. Session Security . . . . . . . . . . . . . . . . . . . . 21 75 4.4.1. TLS Handshake Result . . . . . . . . . . . . . . . . 22 76 4.4.2. Example TLS Initiation . . . . . . . . . . . . . . . 22 77 4.5. Message Type Codes . . . . . . . . . . . . . . . . . . . 23 78 4.6. Session Initialization Message (SESS_INIT) . . . . . . . 24 79 4.6.1. Session Extension Items . . . . . . . . . . . . . . . 26 80 4.7. Session Parameter Negotiation . . . . . . . . . . . . . . 27 81 5. Established Session Operation . . . . . . . . . . . . . . . . 28 82 5.1. Upkeep and Status Messages . . . . . . . . . . . . . . . 28 83 5.1.1. Session Upkeep (KEEPALIVE) . . . . . . . . . . . . . 28 84 5.1.2. Message Rejection (MSG_REJECT) . . . . . . . . . . . 29 85 5.2. Bundle Transfer . . . . . . . . . . . . . . . . . . . . . 30 86 5.2.1. Bundle Transfer ID . . . . . . . . . . . . . . . . . 30 87 5.2.2. Transfer Initialization (XFER_INIT) . . . . . . . . . 31 88 5.2.3. Data Transmission (XFER_SEGMENT) . . . . . . . . . . 34 89 5.2.4. Data Acknowledgments (XFER_ACK) . . . . . . . . . . . 35 90 5.2.5. Transfer Refusal (XFER_REFUSE) . . . . . . . . . . . 36 91 6. Session Termination . . . . . . . . . . . . . . . . . . . . . 38 92 6.1. Session Termination Message (SESS_TERM) . . . . . . . . . 38 93 6.2. Idle Session Shutdown . . . . . . . . . . . . . . . . . . 40 94 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 41 95 8. Security Considerations . . . . . . . . . . . . . . . . . . . 41 96 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 97 9.1. Port Number . . . . . . . . . . . . . . . . . . . . . . . 43 98 9.2. Protocol Versions . . . . . . . . . . . . . . . . . . . . 43 99 9.3. Session Extension Types . . . . . . . . . . . . . . . . . 44 100 9.4. Transfer Extension Types . . . . . . . . . . . . . . . . 44 101 9.5. Message Types . . . . . . . . . . . . . . . . . . . . . . 45 102 9.6. XFER_REFUSE Reason Codes . . . . . . . . . . . . . . . . 46 103 9.7. SESS_TERM Reason Codes . . . . . . . . . . . . . . . . . 47 104 9.8. MSG_REJECT Reason Codes . . . . . . . . . . . . . . . . . 48 105 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 48 106 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 48 107 11.1. Normative References . . . . . . . . . . . . . . . . . . 48 108 11.2. Informative References . . . . . . . . . . . . . . . . . 49 109 Appendix A. Significant changes from RFC7242 . . . . . . . . . . 50 110 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 51 112 1. Introduction 114 This document describes the TCP-based convergence-layer protocol for 115 Delay-Tolerant Networking. Delay-Tolerant Networking is an end-to- 116 end architecture providing communications in and/or through highly 117 stressed environments, including those with intermittent 118 connectivity, long and/or variable delays, and high bit error rates. 119 More detailed descriptions of the rationale and capabilities of these 120 networks can be found in "Delay-Tolerant Network Architecture" 121 [RFC4838]. 123 An important goal of the DTN architecture is to accommodate a wide 124 range of networking technologies and environments. The protocol used 125 for DTN communications is the Bundle Protocol Version 7 (BPv7) 126 [I-D.ietf-dtn-bpbis], an application-layer protocol that is used to 127 construct a store-and-forward overlay network. BPv7 requires the 128 services of a "convergence-layer adapter" (CLA) to send and receive 129 bundles using the service of some "native" link, network, or Internet 130 protocol. This document describes one such convergence-layer adapter 131 that uses the well-known Transmission Control Protocol (TCP). This 132 convergence layer is referred to as TCP Convergence Layer Version 4 133 (TCPCLv4). For the remainder of this document, the abbreviation "BP" 134 without the version suffix refers to BPv7. For the remainder of this 135 document, the abbreviation "TCPCL" without the version suffix refers 136 to TCPCLv4. 138 The locations of the TCPCL and the BP in the Internet model protocol 139 stack (described in [RFC1122]) are shown in Figure 1. In particular, 140 when BP is using TCP as its bearer with TCPCL as its convergence 141 layer, both BP and TCPCL reside at the application layer of the 142 Internet model. 144 +-------------------------+ 145 | DTN Application | -\ 146 +-------------------------| | 147 | Bundle Protocol (BP) | -> Application Layer 148 +-------------------------+ | 149 | TCP Conv. Layer (TCPCL) | | 150 +-------------------------+ | 151 | TLS (optional) | -/ 152 +-------------------------+ 153 | TCP | ---> Transport Layer 154 +-------------------------+ 155 | IPv4/IPv6 | ---> Network Layer 156 +-------------------------+ 157 | Link-Layer Protocol | ---> Link Layer 158 +-------------------------+ 160 Figure 1: The Locations of the Bundle Protocol and the TCP 161 Convergence-Layer Protocol above the Internet Protocol Stack 163 This document describes the format of the protocol data units passed 164 between entities participating in TCPCL communications. This 165 document does not address: 167 o The format of protocol data units of the Bundle Protocol, as those 168 are defined elsewhere in [RFC5050] and [I-D.ietf-dtn-bpbis]. This 169 includes the concept of bundle fragmentation or bundle 170 encapsulation. The TCPCL transfers bundles as opaque data blocks. 172 o Mechanisms for locating or identifying other bundle entities 173 within an internet. 175 1.1. Convergence Layer Services 177 This version of the TCPCL provides the following services to support 178 the overlaying Bundle Protocol agent. In all cases, this is not an 179 API defintion but a logical description of how the CL may interact 180 with the BP agent. Each of these interactions may be associated with 181 any number of additional metadata items as necessary to support the 182 operation of the CL or BP agent. 184 Attempt Session The TCPCL allows a BP agent to pre-emptively attempt 185 to establish a TCPCL session with a peer entity. Each session 186 attempt can send a different set of session negotiation parameters 187 as directed by the BP agent. 189 Terminate Session The TCPCL allows a BP agent to pre-emptively 190 terminate an established TCPCL session with a peer entity. The 191 terminate request is on a per-session basis. 193 Session State Changed The TCPCL supports indication when the session 194 state changes. The top-level session states indicated are: 196 Contact Negotating: A TCP connection has been made (as either 197 active or passive entity) and contact negotiation has begun. 199 Session Negotiating: Contact negotation has been completed 200 (including possible TLS use) and session negotiation has begun. 202 Established: The session has been fully established and is ready 203 for its first transfer. 205 Closing: The entity received a SESS_TERM message and is in the 206 closing state. 208 Terminated: The session has finished normal termination 209 sequencing.. 211 Failed: The session ended without normal termination sequencing. 213 Session Idle Changed The TCPCL supports indication when the live/ 214 idle sub-state changes. This occurs only when the top-level 215 session state is Established. Because TCPCL transmits serially 216 over a TCP connection, it suffers from "head of queue blocking" 217 this indication provides information about when a session is 218 available for immediate transfer start. 220 Begin Transmission The principal purpose of the TCPCL is to allow a 221 BP agent to transmit bundle data over an established TCPCL 222 session. Transmission request is on a per-session basis, the CL 223 does not necessarily perform any per-session or inter-session 224 queueing. Any queueing of transmissions is the obligation of the 225 BP agent. 227 Transmission Success The TCPCL supports positive indication when a 228 bundle has been fully transferred to a peer entity. 230 Transmission Intermediate Progress The TCPCL supports positive 231 indication of intermediate progress of transferr to a peer entity. 232 This intermediate progress is at the granularity of each 233 transferred segment. 235 Transmission Failure The TCPCL supports positive indication of 236 certain reasons for bundle transmission failure, notably when the 237 peer entity rejects the bundle or when a TCPCL session ends before 238 transferr success. The TCPCL itself does not have a notion of 239 transfer timeout. 241 Reception Initialized The TCPCL supports indication to the reciver 242 just before any transmssion data is sent. This corresponds to 243 reception of the XFER_INIT message. 245 Interrupt Reception The TCPCL allows a BP agent to interrupt an 246 individual transfer before it has fully completed (successfully or 247 not). Interruption can occur any time after the reception is 248 initialized. 250 Reception Success The TCPCL supports positive indication when a 251 bundle has been fully transferred from a peer entity. 253 Reception Intermediate Progress The TCPCL supports positive 254 indication of intermediate progress of transfer from the peer 255 entity. This intermediate progress is at the granularity of each 256 transferred segment. Intermediate reception indication allows a 257 BP agent the chance to inspect bundle header contents before the 258 entire bundle is available, and thus supports the "Reception 259 Interruption" capability. 261 Reception Failure The TCPCL supports positive indication of certain 262 reasons for reception failure, notably when the local entity 263 rejects an attempted transfer for some local policy reason or when 264 a TCPCL session ends before transfer success. The TCPCL itself 265 does not have a notion of transfer timeout. 267 2. Requirements Language 269 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 270 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 271 document are to be interpreted as described in [RFC2119]. 273 2.1. Definitions Specific to the TCPCL Protocol 275 This section contains definitions specific to the TCPCL protocol. 277 TCPCL Entity: This is the notional TCPCL application that initiates 278 TCPCL sessions. This design, implementation, configuration, and 279 specific behavior of such an entity is outside of the scope of 280 this document. However, the concept of an entity has utility 281 within the scope of this document as the container and initiator 282 of TCPCL sessions. The relationship between a TCPCL entity and 283 TCPCL sessions is defined as follows: 285 A TCPCL Entity MAY actively initiate any number of TCPCL 286 Sessions and should do so whenever the entity is the initial 287 transmitter of information to another entity in the network. 289 A TCPCL Entity MAY support zero or more passive listening 290 elements that listen for connection requests from other TCPCL 291 Entities operating on other entitys in the network. 293 A TCPCL Entity MAY passivley initiate any number of TCPCL 294 Sessions from requests received by its passive listening 295 element(s) if the entity uses such elements. 297 These relationships are illustrated in Figure 2. For most TCPCL 298 behavior within a session, the two entities are symmetric and 299 there is no protocol distinction between them. Some specific 300 behavior, particularly during session establishment, distinguishes 301 between the active entity and the passive entity. For the 302 remainder of this document, the term "entity" without the prefix 303 "TCPCL" refers to a TCPCL entity. 305 TCP Connection: The term Connection in this specification 306 exclusively refers to a TCP connection and any and all behaviors, 307 sessions, and other states association with that TCP connection. 309 TCPCL Session: A TCPCL session (as opposed to a TCP connection) is a 310 TCPCL communication relationship between two TCPCL entities. 311 Within a single TCPCL session there are two possible transfer 312 streams; one in each direction, with one stream from each entity 313 being the outbound stream and the other being the inbound stream. 314 The lifetime of a TCPCL session is bound to the lifetime of an 315 underlying TCP connection. A TCPCL session is terminated when the 316 TCP connection ends, due either to one or both entities actively 317 terminating the TCP connection or due to network errors causing a 318 failure of the TCP connection. For the remainder of this 319 document, the term "session" without the prefix "TCPCL" refers to 320 a TCPCL session. 322 Session parameters: These are a set of values used to affect the 323 operation of the TCPCL for a given session. The manner in which 324 these parameters are conveyed to the bundle entity and thereby to 325 the TCPCL is implementation dependent. However, the mechanism by 326 which two entities exchange and negotiate the values to be used 327 for a given session is described in Section 4.3. 329 Transfer Stream: A Transfer stream is a uni-directional user-data 330 path within a TCPCL Session. Messages sent over a transfer stream 331 are serialized, meaning that one set of user data must complete 332 its transmission prior to another set of user data being 333 transmitted over the same transfer stream. Each uni-directional 334 stream has a single sender entity and a single receiver entity. 336 Transfer: This refers to the procedures and mechanisms for 337 conveyance of an individual bundle from one node to another. Each 338 transfer within TCPCL is identified by a Transfer ID number which 339 is unique only to a single direction within a single Session. 341 Transfer Segment: A subset of a transfer of user data being 342 communicated over a trasnfer stream. 344 Idle Session: A TCPCL session is idle while the only messages being 345 transmitted or received are KEEPALIVE messages. 347 Live Session: A TCPCL session is live while any messages are being 348 transmitted or received. 350 Reason Codes: The TCPCL uses numeric codes to encode specific 351 reasons for individual failure/error message types. 353 The relationship between connections, sessions, and streams is shown 354 in Figure 3. 356 +--------------------------------------------+ 357 | TCPCL Entity | 358 | | +----------------+ 359 | +--------------------------------+ | | |-+ 360 | | Actively Inititated Session #1 +------------->| Other | | 361 | +--------------------------------+ | | TCPCL Entity's | | 362 | ... | | Passive | | 363 | +--------------------------------+ | | Listener | | 364 | | Actively Inititated Session #n +------------->| | | 365 | +--------------------------------+ | +----------------+ | 366 | | +-----------------+ 367 | +---------------------------+ | 368 | +---| +---------------------------+ | +----------------+ 369 | | | | Optional Passive | | | |-+ 370 | | +-| Listener(s) +<-------------+ | | 371 | | +---------------------------+ | | | | 372 | | | | Other | | 373 | | +---------------------------------+ | | TCPCL Entity's | | 374 | +--->| Passively Inititated Session #1 +-------->| Active | | 375 | | +---------------------------------+ | | Initiator(s) | | 376 | | | | | | 377 | | +---------------------------------+ | | | | 378 | +--->| Passively Inititated Session #n +-------->| | | 379 | +---------------------------------+ | +----------------+ | 380 | | +-----------------+ 381 +--------------------------------------------+ 383 Figure 2: The relationships between TCPCL entities 385 +----------------------------+ +--------------------------+ 386 | TCPCL Session | | TCPCL "Other" Session | 387 | | | | 388 | +-----------------------+ | | +---------------------+ | 389 | | TCP Connection | | | | TCP Connection | | 390 | | | | | | | | 391 | | +-------------------+ | | | | +-----------------+ | | 392 | | | Optional Inbound | | | | | | Peer Outbound | | | 393 | | | Transfer Stream |<-[Seg]--[Seg]--[Seg]-| | Transfer Stream | | | 394 | | | ----- | | | | | | ----- | | | 395 | | | RECEIVER | | | | | | SENDER | | | 396 | | +-------------------+ | | | | +-----------------+ | | 397 | | | | | | | | 398 | | +-------------------+ | | | | +-----------------+ | | 399 | | | Optional Outbound | | | | | | Peer Inbound | | | 400 | | | Transfer Stream |------[Seg]---[Seg]---->| Transfer Stream | | | 401 | | | ----- | | | | | | ----- | | | 402 | | | SENDER | | | | | | RECEIVER | | | 403 | | +-------------------+ | | | | +-----------------+ | | 404 | +-----------------------+ | | +---------------------+ | 405 +----------------------------+ +--------------------------+ 407 Figure 3: The relationship within a TCPCL Session of its two streams 409 3. General Protocol Description 411 The service of this protocol is the transmission of DTN bundles via 412 the Transmission Control Protocol (TCP). This document specifies the 413 encapsulation of bundles, procedures for TCP setup and teardown, and 414 a set of messages and node requirements. The general operation of 415 the protocol is as follows. 417 3.1. TCPCL Session Overview 419 First, one node establishes a TCPCL session to the other by 420 initiating a TCP connection in accordance with [RFC0793]. After 421 setup of the TCP connection is complete, an initial contact header is 422 exchanged in both directions to establish a shared TCPCL version and 423 possibly initiate TLS security. Once contact negotiation is 424 complete, TCPCL messaging is available and the session negotiation is 425 used to set parameters of the TCPCL session. One of these parameters 426 is a singleton endpoint identifier for each node (not the singleton 427 Endpoint Identifier (EID) of any application running on the node) to 428 denote the bundle-layer identity of each DTN node. This is used to 429 assist in routing and forwarding messages (e.g. to prevent loops). 431 Once negotiated, the parameters of a TCPCL session cannot change and 432 if there is a desire by either peer to transfer data under different 433 parameters then a new session must be established. This makes CL 434 logic simpler but relies on the assumption that establishing a TCP 435 connection is lightweight enough that TCP connection overhead is 436 negligable compared to TCPCL data sizes. 438 Once the TCPCL session is established and configured in this way, 439 bundles can be transferred in either direction. Each transfer is 440 performed by an initialization (XFER_INIT) message followed by one or 441 more logical segments of data within an XFER_SEGMENT message. 442 Multiple bundles can be transmitted consecutively on a single TCPCL 443 connection. Segments from different bundles are never interleaved. 444 Bundle interleaving can be accomplished by fragmentation at the BP 445 layer or by establishing multiple TCPCL sessions between the same 446 peers. 448 A feature of this protocol is for the receiving node to send 449 acknowledgment (XFER_ACK) messages as bundle data segments arrive . 450 The rationale behind these acknowledgments is to enable the sender 451 node to determine how much of the bundle has been received, so that 452 in case the session is interrupted, it can perform reactive 453 fragmentation to avoid re-sending the already transmitted part of the 454 bundle. In addition, there is no explicit flow control on the TCPCL 455 layer. 457 A TCPCL receiver can interrupt the transmission of a bundle at any 458 point in time by replying with a XFER_REFUSE message, which causes 459 the sender to stop transmission of the associated bundle (if it 460 hasn't already finished transmission) Note: This enables a cross- 461 layer optimization in that it allows a receiver that detects that it 462 already has received a certain bundle to interrupt transmission as 463 early as possible and thus save transmission capacity for other 464 bundles. 466 For sessions that are idle, a KEEPALIVE message is sent at a 467 negotiated interval. This is used to convey node live-ness 468 information during otherwise message-less time intervals. 470 A SESS_TERM message is used to start the closing of a TCPCL session 471 (see Section 6.1). During shutdown sequencing, in-progress transfers 472 can be completed but no new transfers can be initiated. A SESS_TERM 473 message can also be used to refuse a session setup by a peer (see 474 Section 4.3). It is an implementation matter to determine whether or 475 not to close a TCPCL session while there are no transfers queued or 476 in-progress. 478 Once a session is established established, TCPCL is a symmetric 479 protocol between the peers. Both sides can start sending data 480 segments in a session, and one side's bundle transfer does not have 481 to complete before the other side can start sending data segments on 482 its own. Hence, the protocol allows for a bi-directional mode of 483 communication. Note that in the case of concurrent bidirectional 484 transmission, acknowledgment segments MAY be interleaved with data 485 segments. 487 3.2. TCPCL States and Transitions 489 The states of a nominal TCPCL session (i.e. without session failures) 490 are indicated in Figure 4. 492 +-------+ 493 | START | 494 +-------+ 495 | 496 TCP Establishment 497 | 498 V 499 +-----------+ +---------------------+ 500 | TCP |----------->| Contact / Session | 501 | Connected | | Negotiation | 502 +-----------+ +---------------------+ 503 | 504 +-----Session Parameters-----+ 505 | Negotiated 506 V 507 +-------------+ +-------------+ 508 | Established |----New Transfer---->| Established | 509 | Session | | Session | 510 | Idle |<---Transfers Done---| Live | 511 +-------------+ +-------------+ 512 | | 513 +------------------------------------+ 514 | 515 SESS_TERM Exchange 516 | 517 V 518 +-------------+ 519 | Established | +-------------+ 520 | Session |----Transfers------>| TCP | 521 | Ending | Done | Terminating | 522 +-------------+ +-------------+ 523 | 524 +------------Close Message------------+ 525 | 526 V 527 +-------+ 528 | END | 529 +-------+ 531 Figure 4: Top-level states of a TCPCL session 533 Notes on Established Session states: 535 Session "Live" means transmitting or reeiving over a transfer 536 stream. 538 Session "Idle" means no transmission/reception over a transfer 539 stream. 541 Session "Closing" means no new transfers will be allowed. 543 The contact negotiation sequencing is performed either as the active 544 or passive peer, and is illustrated in Figure 5 and Figure 6 545 respectively which both share the data validation and analyze final 546 states of Figure 7. 548 +-------+ 549 | START |-----TCP-----+ 550 +-------+ Connecting | 551 V 552 +-----------+ +---------+ 553 | Connected |--OK-->| Send CH |--OK-->[PCH] 554 +-----------+ +---------+ 555 | | 556 Error Error 557 | | 558 V | 559 [TCPTERM]<-------------+ 561 Figure 5: Contact Initiation as Active peer 563 +-------+ 564 | START |-----TCP----->[PCH] 565 +-------+ Connected 567 Figure 6: Contact Initiation as Passive peer 568 +-------->[TCPTERM]<----------+ 569 | | 570 Timeout Error 571 or Error | 572 | | 573 +-------+ +---------+ Contact +----------+ 574 | START |---->| Waiting |---- Header --->| Validate | 575 +-------+ +---------+ Received +----------+ 576 | 577 +---------------------------+ 578 | 579 V 580 +---------+ 581 +--Error--| Analyze |---No TLS---->[SI] 582 | | | ^ 583 | +---------+ | 584 | | | 585 V TLS | 586 [TCPTERM] Negotiated | 587 ^ | | 588 | V | 589 | +-----------+ | 590 | | Establish |---Success---+ 591 +--Error--| TLS | 592 +-----------+ 594 Figure 7: Processing of Contact Header (PCH) 596 The session negotiation sequencing is performed either as the active 597 or passive peer, and is illustrated in Figure 8 and Figure 9 598 respectively which both share the data validation and analyze final 599 states of Figure 10. 601 +-------+ TCPCL 602 | START |--Messaging--+ 603 +-------+ Available | 604 V 605 +----------------+ 606 | Send SESS_INIT |--OK-->[PSI] 607 +----------------+ 608 | 609 Error 610 | 611 V 612 [SESSTERM] 614 Figure 8: Session Initiation as Active peer 616 +-------+ TCPCL 617 | START |---Messaging-->[PSI] 618 +-------+ Available 620 Figure 9: Session Initiation as Passive peer 622 +------->[SESSTERM]<--------+ 623 | | 624 Timeout Error 625 or Error | 626 | | 627 +-------+ +---------+ +----------+ 628 | START |---->| Waiting |---SESS_INIT--->| Validate | 629 +-------+ +---------+ Received +----------+ 630 | 631 +---------------------------+ 632 | 633 V 634 +---------+ +--------------+ 635 +--Error--| Analyze |---->| Established | 636 | | | | Session Idle | 637 | +---------+ +--------------+ 638 V 639 [SESSTERM] 641 Figure 10: Processing of Session Initiation (PSI) 643 Transfers can occur after a session is established and it's not in 644 the ending state. Each transfer occurs within a single logical 645 transfer stream between a sender and a receiver, as illustrated in 646 Figure 11 and Figure 12 respectively. 648 +--Send XFER_DATA--+ 649 +--------+ | | 650 | Stream | +-------------+ | 651 | Idle |---Send XFER_INIT-->| In Progress |<---------+ 652 +--------+ +-------------+ 653 | 654 +------All segments sent-------+ 655 | 656 V 657 +---------+ +--------+ 658 | Waiting |---- Receive Final---->| Stream | 659 | for Ack | Ack | IDLE | 660 +---------+ +--------+ 662 Figure 11: Transfer sender states 664 Notes on transfer sending: 666 Pipelining of transfers can occur when the sending entity begins a 667 new transfer while in the "Waiting for Ack" state. 669 +-Receive XFER_DATA-+ 670 +--------+ | Send Ack | 671 | Stream | +-------------+ | 672 | IDLE |--Receive XFER_INIT-->| In Progress |<----------+ 673 +--------+ +-------------+ 674 | 675 +---------Sent Final Ack---------+ 676 | 677 V 678 +--------+ 679 | Stream | 680 | IDLE | 681 +--------+ 683 Figure 12: Transfer receiver states 685 3.3. Transfer Segmentation Policies 687 Each TCPCL session allows a negotiated transfer segmentation polcy to 688 be applied in each transfer direction. A receiving node can set the 689 Segment MRU in its contact header to determine the largest acceptable 690 segment size, and a transmitting node can segment a transfer into any 691 sizes smaller than the receiver's Segment MRU. It is a network 692 administration matter to determine an appropriate segmentation policy 693 for entities operating TCPCL, but guidance given here can be used to 694 steer policy toward performance goals. It is also advised to 695 consider the Segment MRU in relation to chunking/packetization 696 performed by TLS, TCP, and any intermediate network-layer nodes. 698 Minimum Overhead For a simple network expected to exchange 699 relatively small bundles, the Segment MRU can be set to be 700 identical to the Transfer MRU which indicates that all transfers 701 can be sent with a single data segment (i.e. no actual 702 segmentation). If the network is closed and all transmitters are 703 known to follow a single-segment transfer policy, then receivers 704 can avoid the necessity of segment reassembly. Because this CL 705 operates over a TCP stream, which suffers from a form of head-of- 706 queue blocking between messages, while one node is transmitting a 707 single XFER_SEGMENT message it is not able to transmit any 708 XFER_ACK or XFER_REFUSE for any associated received transfers. 710 Predictable Message Sizing In situations where the maximum message 711 size is desired to be well-controlled, the Segment MRU can be set 712 to the largest acceptable size (the message size less XFER_SEGMENT 713 header size) and transmitters can always segment a transfer into 714 maximum-size chunks no larger than the Segment MRU. This 715 guarantees that any single XFER_SEGMENT will not monopolize the 716 TCP stream for too long, which would prevent outgoing XFER_ACK and 717 XFER_REFUSE associated with received transfers. 719 Dynamic Segmentation Even after negotiation of a Segment MRU for 720 each receiving node, the actual transfer segmentation only needs 721 to guarantee than any individual segment is no larger than that 722 MRU. In a situation where network "goodput" is dynamic, the 723 transfer segmentation size can also be dynamic in order to control 724 message transmission duration. 726 Many other policies can be established in a TCPCL network between 727 these two extremes. Different policies can be applied to each 728 direction to/from any particular node. Additionally, future header 729 and transfer extension types can apply further nuance to transfer 730 policies and policy negotiation. 732 3.4. Example Message Exchange 734 The following figure depicts the protocol exchange for a simple 735 session, showing the session establishment and the transmission of a 736 single bundle split into three data segments (of lengths "L1", "L2", 737 and "L3") from Entity A to Entity B. 739 Note that the sending node MAY transmit multiple XFER_SEGMENT 740 messages without necessarily waiting for the corresponding XFER_ACK 741 responses. This enables pipelining of messages on a transfer stream. 742 Although this example only demonstrates a single bundle transmission, 743 it is also possible to pipeline multiple XFER_SEGMENT messages for 744 different bundles without necessarily waiting for XFER_ACK messages 745 to be returned for each one. However, interleaving data segments 746 from different bundles is not allowed. 748 No errors or rejections are shown in this example. 750 Entity A Entity B 751 ======== ======== 752 +-------------------------+ 753 | Contact Header | -> +-------------------------+ 754 +-------------------------+ <- | Contact Header | 755 +-------------------------+ 756 +-------------------------+ 757 | SESS_INIT | -> +-------------------------+ 758 +-------------------------+ <- | SESS_INIT | 759 +-------------------------+ 761 +-------------------------+ 762 | XFER_INIT | -> 763 | Transfer ID [I1] | 764 | Total Length [L1] | 765 +-------------------------+ 766 +-------------------------+ 767 | XFER_SEGMENT (start) | -> 768 | Transfer ID [I1] | 769 | Length [L1] | 770 | Bundle Data 0..(L1-1) | 771 +-------------------------+ 772 +-------------------------+ +-------------------------+ 773 | XFER_SEGMENT | -> <- | XFER_ACK (start) | 774 | Transfer ID [I1] | | Transfer ID [I1] | 775 | Length [L2] | | Length [L1] | 776 |Bundle Data L1..(L1+L2-1)| +-------------------------+ 777 +-------------------------+ 778 +-------------------------+ +-------------------------+ 779 | XFER_SEGMENT (end) | -> <- | XFER_ACK | 780 | Transfer ID [I1] | | Transfer ID [I1] | 781 | Length [L3] | | Length [L1+L2] | 782 |Bundle Data | +-------------------------+ 783 | (L1+L2)..(L1+L2+L3-1)| 784 +-------------------------+ 785 +-------------------------+ 786 <- | XFER_ACK (end) | 787 | Transfer ID [I1] | 788 | Length [L1+L2+L3] | 789 +-------------------------+ 791 +-------------------------+ 792 | SESS_TERM | -> +-------------------------+ 793 +-------------------------+ <- | SESS_TERM | 794 +-------------------------+ 796 Figure 13: An example of the flow of protocol messages on a single 797 TCP Session between two entities 799 4. Session Establishment 801 For bundle transmissions to occur using the TCPCL, a TCPCL session 802 MUST first be established between communicating entities. It is up 803 to the implementation to decide how and when session setup is 804 triggered. For example, some sessions MAY be opened proactively and 805 maintained for as long as is possible given the network conditions, 806 while other sessions MAY be opened only when there is a bundle that 807 is queued for transmission and the routing algorithm selects a 808 certain next-hop node. 810 4.1. TCP Connection 812 To establish a TCPCL session, an entity MUST first establish a TCP 813 connection with the intended peer entity, typically by using the 814 services provided by the operating system. Destination port number 815 4556 has been assigned by IANA as the Registered Port number for the 816 TCP convergence layer. Other destination port numbers MAY be used 817 per local configuration. Determining a peer's destination port 818 number (if different from the registered TCPCL port number) is up to 819 the implementation. Any source port number MAY be used for TCPCL 820 sessions. Typically an operating system assigned number in the TCP 821 Ephemeral range (49152-65535) is used. 823 If the entity is unable to establish a TCP connection for any reason, 824 then it is an implementation matter to determine how to handle the 825 connection failure. An entity MAY decide to re-attempt to establish 826 the connection. If it does so, it MUST NOT overwhelm its target with 827 repeated connection attempts. Therefore, the entity MUST retry the 828 connection setup no earlier than some delay time from the last 829 attempt, and it SHOULD use a (binary) exponential backoff mechanism 830 to increase this delay in case of repeated failures. 832 Once a TCP connection is established, each entity MUST immediately 833 transmit a contact header over the TCP connection. The format of the 834 contact header is described in Section 4.2. 836 4.2. Contact Header 838 Once a TCP connection is established, both parties exchange a contact 839 header. This section describes the format of the contact header and 840 the meaning of its fields. 842 Upon receipt of the contact header, both entities perform the 843 validation and negotiation procedures defined in Section 4.3. After 844 receiving the contact header from the other entity, either entity MAY 845 refuse the session by sending a SESS_TERM message with an appropriate 846 reason code. 848 The format for the Contact Header is as follows: 850 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 851 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 852 +---------------+---------------+---------------+---------------+ 853 | magic='dtn!' | 854 +---------------+---------------+---------------+---------------+ 855 | Version | Flags | 856 +---------------+---------------+ 858 Figure 14: Contact Header Format 860 See Section 4.3 for details on the use of each of these contact 861 header fields. The fields of the contact header are: 863 magic: A four-octet field that always contains the octet sequence 864 0x64 0x74 0x6e 0x21, i.e., the text string "dtn!" in US-ASCII (and 865 UTF-8). 867 Version: A one-octet field value containing the value 4 (current 868 version of the protocol). 870 Flags: A one-octet field of single-bit flags, interpreted according 871 to the descriptions in Table 1. 873 +----------+--------+-----------------------------------------------+ 874 | Name | Code | Description | 875 +----------+--------+-----------------------------------------------+ 876 | CAN_TLS | 0x01 | If bit is set, indicates that the sending | 877 | | | peer is capable of TLS security. | 878 | | | | 879 | Reserved | others | 880 +----------+--------+-----------------------------------------------+ 882 Table 1: Contact Header Flags 884 4.3. Contact Validation and Negotiation 886 Upon reception of the contact header, each node follows the following 887 procedures to ensure the validity of the TCPCL session and to 888 negotiate values for the session parameters. 890 If the magic string is not present or is not valid, the connection 891 MUST be terminated. The intent of the magic string is to provide 892 some protection against an inadvertent TCP connection by a different 893 protocol than the one described in this document. To prevent a flood 894 of repeated connections from a misconfigured application, an entity 895 MAY elect to hold an invalid connection open and idle for some time 896 before closing it. 898 A connecting TCPCL node SHALL send the highest TCPCL protocol version 899 on a first session attempt for a TCPCL peer. If a connecting node 900 receives a SESS_TERM message with reason of "Version Mismatch", that 901 node MAY attempt further TCPCL sessions with the peer using earlier 902 protocol version numbers in decreasing order. Managing multi-TCPCL- 903 session state such as this is an implementation matter. 905 If an entity receives a contact header containing a version that is 906 greater than the current version of the protocol that the node 907 implements, then the node SHALL shutdown the session with a reason 908 code of "Version mismatch". If an entity receives a contact header 909 with a version that is lower than the version of the protocol that 910 the node implements, the node MAY either terminate the session (with 911 a reason code of "Version mismatch") or the node MAY adapt its 912 operation to conform to the older version of the protocol. The 913 decision of version fall-back is an implementation matter. 915 4.4. Session Security 917 This version of the TCPCL supports establishing a Transport Layer 918 Security (TLS) session within an existing TCP connection. When TLS 919 is used within the TCPCL it affects the entire session. Once 920 established, there is no mechanism available to downgrade a TCPCL 921 session to non-TLS operation. If this is desired, the entire TCPCL 922 session MUST be terminated and a new non-TLS-negotiated session 923 established. 925 The use of TLS is negotated using the Contact Header as described in 926 Section 4.3. After negotiating an Enable TLS parameter of true, and 927 before any other TCPCL messages are sent within the session, the 928 session entities SHALL begin a TLS handshake in accordance with 929 [RFC5246]. The parameters within each TLS negotiation are 930 implementation dependent but any TCPCL node SHOULD follow all 931 recommended best practices of [RFC7525]. By convention, this 932 protocol uses the node which initiated the underlying TCP connection 933 as the "client" role of the TLS handshake request. 935 The TLS handshake, if it occurs, is considered to be part of the 936 contact negotiation before the TCPCL session itself is established. 937 Specifics about sensitive data exposure are discussed in Section 8. 939 4.4.1. TLS Handshake Result 941 If a TLS handshake cannot negotiate a TLS session, both entities of 942 the TCPCL session SHALL terminate the TCP connection. At this point 943 the TCPCL session has not yet been established so there is no TCPCL 944 session to terminate. This also avoids any potential security issues 945 assoicated with further TCP communication with an untrusted peer. 947 After a TLS session is successfully established, the active peer 948 SHALL send a SESS_INIT message to begin session negotiation. This 949 session negotation and all subsequent messaging are secured. 951 4.4.2. Example TLS Initiation 953 A summary of a typical CAN_TLS usage is shown in the sequence in 954 Figure 15 below. 956 Entity A Entity B 957 ======== ======== 959 +-------------------------+ 960 | Open TCP Connnection | -> 961 +-------------------------+ +-------------------------+ 962 <- | Accept Connection | 963 +-------------------------+ 965 +-------------------------+ 966 | Contact Header | -> 967 +-------------------------+ +-------------------------+ 968 <- | Contact Header | 969 +-------------------------+ 971 +-------------------------+ +-------------------------+ 972 | TLS Negotiation | -> <- | TLS Negotiation | 973 | (as client) | | (as server) | 974 +-------------------------+ +-------------------------+ 976 ... secured TCPCL messaging, starting with SESS_INIT ... 978 +-------------------------+ +-------------------------+ 979 | SESS_TERM | -> <- | SESS_TERM | 980 +-------------------------+ +-------------------------+ 982 Figure 15: A simple visual example of TCPCL TLS Establishment between 983 two entities 985 4.5. Message Type Codes 987 After the initial exchange of a contact header, all messages 988 transmitted over the session are identified by a one-octet header 989 with the following structure: 991 0 1 2 3 4 5 6 7 992 +---------------+ 993 | Message Type | 994 +---------------+ 996 Figure 16: Format of the Message Header 998 The message header fields are as follows: 1000 Message Type: Indicates the type of the message as per Table 2 1001 below. Encoded values are listed in Section 9.5. 1003 +--------------+----------------------------------------------------+ 1004 | Type | Description | 1005 +--------------+----------------------------------------------------+ 1006 | SESS_INIT | Contains the session parameter inputs from one of | 1007 | | the entities, as described in Section 4.6. | 1008 | | | 1009 | XFER_INIT | Contains the length (in octets) of the next | 1010 | | transfer, as described in Section 5.2.2. | 1011 | | | 1012 | XFER_SEGMENT | Indicates the transmission of a segment of bundle | 1013 | | data, as described in Section 5.2.3. | 1014 | | | 1015 | XFER_ACK | Acknowledges reception of a data segment, as | 1016 | | described in Section 5.2.4. | 1017 | | | 1018 | XFER_REFUSE | Indicates that the transmission of the current | 1019 | | bundle SHALL be stopped, as described in Section | 1020 | | 5.2.5. | 1021 | | | 1022 | KEEPALIVE | Used to keep TCPCL session active, as described in | 1023 | | Section 5.1.1. | 1024 | | | 1025 | SESS_TERM | Indicates that one of the entities participating | 1026 | | in the session wishes to cleanly terminate the | 1027 | | session, as described in Section 6. | 1028 | | | 1029 | MSG_REJECT | Contains a TCPCL message rejection, as described | 1030 | | in Section 5.1.2. | 1031 +--------------+----------------------------------------------------+ 1033 Table 2: TCPCL Message Types 1035 4.6. Session Initialization Message (SESS_INIT) 1037 Before a session is established and ready to transfer bundles, the 1038 session parameters are negotiated between the connected entities. 1039 The SESS_INIT message is used to convey the per-entity parameters 1040 which are used together to negotiate the per-session parameters. 1042 The format of a SESS_INIT message is as follows in Figure 17. 1044 +-------------------------------+ 1045 | Message Header | 1046 +-------------------------------+ 1047 | Keepalive Interval (U16) | 1048 +-------------------------------+ 1049 | Segment MRU (U64) | 1050 +-------------------------------+ 1051 | Transfer MRU (U64) | 1052 +-------------------------------+ 1053 | EID Length (U16) | 1054 +-------------------------------+ 1055 | EID Data (variable) | 1056 +-------------------------------+ 1057 | Session Extension Length (U64)| 1058 +-------------------------------+ 1059 | Session Extension Items (var.)| 1060 +-------------------------------+ 1062 Figure 17: SESS_INIT Format 1064 A 16-bit unsigned integer indicating the interval, in seconds, 1065 between any subsequent messages being transmitted by the peer. 1066 The peer receiving this contact header uses this interval to 1067 determine how long to wait after any last-message transmission and 1068 a necessary subsequent KEEPALIVE message transmission. 1070 A 64-bit unsigned integer indicating the largest allowable single- 1071 segment data payload size to be received in this session. Any 1072 XFER_SEGMENT sent to this peer SHALL have a data payload no longer 1073 than the peer's Segment MRU. The two entities of a single session 1074 MAY have different Segment MRUs, and no relation between the two 1075 is required. 1077 A 64-bit unsigned integer indicating the largest allowable total- 1078 bundle data size to be received in this session. Any bundle 1079 transfer sent to this peer SHALL have a Total Bundle Length 1080 payload no longer than the peer's Transfer MRU. This value can be 1081 used to perform proactive bundle fragmentation. The two entities 1082 of a single session MAY have different Transfer MRUs, and no 1083 relation between the two is required. 1085 Together these fields represent a variable-length text string. 1086 The EID Length is a 16-bit unsigned integer indicating the number 1087 of octets of EID Data to follow. A zero EID Length SHALL be used 1088 to indicate the lack of EID rather than a truly empty EID. This 1089 case allows an entity to avoid exposing EID information on an 1090 untrusted network. A non-zero-length EID Data SHALL contain the 1091 UTF-8 encoded EID of some singleton endpoint in which the sending 1092 entity is a member, in the canonical format of :. This EID encoding is consistent 1094 with [I-D.ietf-dtn-bpbis]. 1096 Together these fields represent protocol extension data not 1097 defined by this specification. The Session Extension Length is 1098 the total number of octets to follow which are used to encode the 1099 Session Extension Item list. The encoding of each Session 1100 Extension Item is within a consistent data container as described 1101 in Section 4.6.1. The full set of Session Extension Items apply 1102 for the duration of the TCPCL session to follow. The order and 1103 mulitplicity of these Session Extension Items MAY be significant, 1104 as defined in the associated type specification(s). 1106 4.6.1. Session Extension Items 1108 Each of the Session Extension Items SHALL be encoded in an identical 1109 Type-Length-Value (TLV) container form as indicated in Figure 18. 1110 The fields of the Session Extension Item are: 1112 Flags: A one-octet field containing generic bit flags about the 1113 Item, which are listed in Table 3. If a TCPCL entity receives a 1114 Session Extension Item with an unknown Item Type and the CRITICAL 1115 flag set, the entity SHALL close the TCPCL session with SESS_TERM 1116 reason code of "Contact Failure". If the CRITICAL flag is not 1117 set, an entity SHALL skip over and ignore any item with an unknown 1118 Item Type. 1120 Item Type: A 16-bit unsigned integer field containing the type of 1121 the extension item. This specification does not define any 1122 extension types directly, but does allocate an IANA registry for 1123 such codes (see Section 9.3). 1125 Item Length: A 32-bit unsigned integer field containing the number 1126 of Item Value octets to follow. 1128 Item Value: A variable-length data field which is interpreted 1129 according to the associated Item Type. This specification places 1130 no restrictions on an extension's use of available Item Value 1131 data. Extension specification SHOULD avoid the use of large data 1132 exchanges within the TCPCL contact header as no bundle transfers 1133 can begin until the full contact exchange and negotiation has been 1134 completed. 1136 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1137 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 1138 +---------------+---------------+---------------+---------------+ 1139 | Item Flags | Item Type | Item Length...| 1140 +---------------+---------------+---------------+---------------+ 1141 | length contd. | Item Value... | 1142 +---------------+---------------+---------------+---------------+ 1143 | value contd. | 1144 +---------------+---------------+---------------+---------------+ 1146 Figure 18: Session Extension Item Format 1148 +----------+--------+-----------------------------------------------+ 1149 | Name | Code | Description | 1150 +----------+--------+-----------------------------------------------+ 1151 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1152 | | | peer must handle the extension item. | 1153 | | | | 1154 | Reserved | others | 1155 +----------+--------+-----------------------------------------------+ 1157 Table 3: Session Extension Item Flags 1159 4.7. Session Parameter Negotiation 1161 An entity calculates the parameters for a TCPCL session by 1162 negotiating the values from its own preferences (conveyed by the 1163 contact header it sent to the peer) with the preferences of the peer 1164 node (expressed in the contact header that it received from the 1165 peer). The negotiated parameters defined by this specification are 1166 described in the following paragraphs. 1168 Transfer MTU and Segment MTU: The maximum transmit unit (MTU) for 1169 whole transfers and individual segments are idententical to the 1170 Transfer MRU and Segment MRU, respectively, of the recevied 1171 contact header. A transmitting peer can send individual segments 1172 with any size smaller than the Segment MTU, depending on local 1173 policy, dynamic network conditions, etc. Determining the size of 1174 each transmitted segment is an implementation matter. 1176 Session Keepalive: Negotiation of the Session Keepalive parameter is 1177 performed by taking the minimum of this two contact headers' 1178 Keepalive Interval. The Session Keepalive interval is a parameter 1179 for the behavior described in Section 5.1.1. 1181 Enable TLS: Negotiation of the Enable TLS parameter is performed by 1182 taking the logical AND of the two contact headers' CAN_TLS flags. 1183 A local security policy is then applied to determine of the 1184 negotated value of Enable TLS is acceptable. It can be a 1185 reasonable security policy to both require or disallow the use of 1186 TLS depending upon the desired network flows. If the Enable TLS 1187 state is unacceptable, the node SHALL terminate the session with a 1188 reason code of "Contact Failure". Note that this contact failure 1189 is different than a failure of TLS handshake after an agreed-upon 1190 and acceptable Enable TLS state. If the negotiated Enable TLS 1191 value is true and acceptable then TLS negotiation feature 1192 (described in Section 4.4) begins immediately following the 1193 contact header exchange. 1195 Once this process of parameter negotiation is completed (which 1196 includes a possible completed TLS handshake of the connection to use 1197 TLS), this protocol defines no additional mechanism to change the 1198 parameters of an established session; to effect such a change, the 1199 TCPCL session MUST be terminated and a new session established. 1201 5. Established Session Operation 1203 This section describes the protocol operation for the duration of an 1204 established session, including the mechanism for transmitting bundles 1205 over the session. 1207 5.1. Upkeep and Status Messages 1209 5.1.1. Session Upkeep (KEEPALIVE) 1211 The protocol includes a provision for transmission of KEEPALIVE 1212 messages over the TCPCL session to help determine if the underlying 1213 TCP connection has been disrupted. 1215 As described in Section 4.3, a negotiated parameter of each session 1216 is the Session Keepalive interval. If the negotiated Session 1217 Keepalive is zero (i.e. one or both contact headers contains a zero 1218 Keepalive Interval), then the keepalive feature is disabled. There 1219 is no logical minimum value for the keepalive interval, but when used 1220 for many sessions on an open, shared network a short interval could 1221 lead to excessive traffic. For shared network use, entities SHOULD 1222 choose a keepalive interval no shorter than 30 seconds. There is no 1223 logical maximum value for the keepalive interval, but an idle TCP 1224 connection is liable for closure by the host operating system if the 1225 keepalive time is longer than tens-of-minutes. Entities SHOULD 1226 choose a keepalive interval no longer than 10 minutes (600 seconds). 1228 Note: The Keepalive Interval SHOULD NOT be chosen too short as TCP 1229 retransmissions MAY occur in case of packet loss. Those will have to 1230 be triggered by a timeout (TCP retransmission timeout (RTO)), which 1231 is dependent on the measured RTT for the TCP connection so that 1232 KEEPALIVE messages MAY experience noticeable latency. 1234 The format of a KEEPALIVE message is a one-octet message type code of 1235 KEEPALIVE (as described in Table 2) with no additional data. Both 1236 sides SHOULD send a KEEPALIVE message whenever the negotiated 1237 interval has elapsed with no transmission of any message (KEEPALIVE 1238 or other). 1240 If no message (KEEPALIVE or other) has been received in a session 1241 after some implementation-defined time duration, then the node MAY 1242 terminate the session by transmitting a SESS_TERM message (as 1243 described in Section 6.1) with reason code "Idle Timeout. 1245 5.1.2. Message Rejection (MSG_REJECT) 1247 If a TCPCL node receives a message which is unknown to it (possibly 1248 due to an unhandled protocol mismatch) or is inappropriate for the 1249 current session state (e.g. a KEEPALIVE message received after 1250 contact header negotiation has disabled that feature), there is a 1251 protocol-level message to signal this condition in the form of a 1252 MSG_REJECT reply. 1254 The format of a MSG_REJECT message is as follows in Figure 19. 1256 +-----------------------------+ 1257 | Message Header | 1258 +-----------------------------+ 1259 | Reason Code (U8) | 1260 +-----------------------------+ 1261 | Rejected Message Header | 1262 +-----------------------------+ 1264 Figure 19: Format of MSG_REJECT Messages 1266 The fields of the MSG_REJECT message are: 1268 Reason Code: A one-octet refusal reason code interpreted according 1269 to the descriptions in Table 4. 1271 Rejected Message Header: The Rejected Message Header is a copy of 1272 the Message Header to which the MSG_REJECT message is sent as a 1273 response. 1275 +-------------+------+----------------------------------------------+ 1276 | Name | Code | Description | 1277 +-------------+------+----------------------------------------------+ 1278 | Message | 0x01 | A message was received with a Message Type | 1279 | Type | | code unknown to the TCPCL node. | 1280 | Unknown | | | 1281 | | | | 1282 | Message | 0x02 | A message was received but the TCPCL node | 1283 | Unsupported | | cannot comply with the message contents. | 1284 | | | | 1285 | Message | 0x03 | A message was received while the session is | 1286 | Unexpected | | in a state in which the message is not | 1287 | | | expected. | 1288 +-------------+------+----------------------------------------------+ 1290 Table 4: MSG_REJECT Reason Codes 1292 5.2. Bundle Transfer 1294 All of the messages in this section are directly associated with 1295 transferring a bundle between TCPCL entities. 1297 A single TCPCL transfer results in a bundle (handled by the 1298 convergence layer as opaque data) being exchanged from one node to 1299 the other. In TCPCL a transfer is accomplished by dividing a single 1300 bundle up into "segments" based on the receiving-side Segment MRU 1301 (see Section 4.2). The choice of the length to use for segments is 1302 an implementation matter, but each segment MUST be no larger than the 1303 receiving node's maximum receive unit (MRU) (see the field "Segment 1304 MRU" of Section 4.2). The first segment for a bundle MUST set the 1305 'START' flag, and the last one MUST set the 'end' flag in the 1306 XFER_SEGMENT message flags. 1308 A single transfer (and by extension a single segment) SHALL NOT 1309 contain data of more than a single bundle. This requirement is 1310 imposed on the agent using the TCPCL rather than TCPCL itself. 1312 If multiple bundles are transmitted on a single TCPCL connection, 1313 they MUST be transmitted consecutively without interleaving of 1314 segments from multiple bundles. 1316 5.2.1. Bundle Transfer ID 1318 Each of the bundle transfer messages contains a Transfer ID which is 1319 used to correlate messages (from both sides of a transfer) for each 1320 bundle. A Transfer ID does not attempt to address uniqueness of the 1321 bundle data itself and has no relation to concepts such as bundle 1322 fragmentation. Each invocation of TCPCL by the bundle protocol 1323 agent, requesting transmission of a bundle (fragmentary or 1324 otherwise), results in the initiation of a single TCPCL transfer. 1325 Each transfer entails the sending of a XFER_INIT message and some 1326 number of XFER_SEGMENT and XFER_ACK messages; all are correlated by 1327 the same Transfer ID. 1329 Transfer IDs from each node SHALL be unique within a single TCPCL 1330 session. The initial Transfer ID from each node SHALL have value 1331 zero. Subsequent Transfer ID values SHALL be incremented from the 1332 prior Transfer ID value by one. Upon exhaustion of the entire 64-bit 1333 Transfer ID space, the sending node SHALL terminate the session with 1334 SESS_TERM reason code "Resource Exhaustion". 1336 For bidirectional bundle transfers, a TCPCL node SHOULD NOT rely on 1337 any relation between Transfer IDs originating from each side of the 1338 TCPCL session. 1340 5.2.2. Transfer Initialization (XFER_INIT) 1342 The XFER_INIT message contains the total length, in octets, of the 1343 bundle data in the associated transfer. The total length is 1344 formatted as a 64-bit unsigned integer. 1346 The purpose of the XFER_INIT message is to allow entities to 1347 preemptively refuse bundles that would exceed their resources or to 1348 prepare storage on the receiving node for the upcoming bundle data. 1349 See Section 5.2.5 for details on when refusal based on XFER_INIT 1350 content is acceptable. 1352 The Total Bundle Length field within a XFER_INIT message SHALL be 1353 treated as authoritative by the receiver. If, for whatever reason, 1354 the actual total length of bundle data received differs from the 1355 value indicated by the XFER_INIT message, the receiver SHOULD treat 1356 the transmitted data as invalid. 1358 The format of the XFER_INIT message is as follows in Figure 20. 1360 +-----------------------------+ 1361 | Message Header | 1362 +-----------------------------+ 1363 | Transfer ID (U64) | 1364 +-----------------------------+ 1365 | Total Bundle Length (U64) | 1366 +-----------------------------+ 1367 | Transfer Extension | 1368 | Length (U64) | 1369 +-----------------------------+ 1370 | Transfer Extension Items... | 1371 +-----------------------------+ 1373 Figure 20: Format of XFER_INIT Messages 1375 The fields of the XFER_INIT message are: 1377 Transfer ID: A 64-bit unsigned integer identifying the transfer 1378 about to begin. 1380 Total Bundle Length: A 64-bit unsigned integer indicating the size 1381 of the data-to-be-transferred. 1383 Transfer Extension Length and Transfer Extension Items: Together 1384 these fields represent protocol extension data not defined by this 1385 specification. The Transfer Extension Length is the total number 1386 of octets to follow which are used to encode the Transfer 1387 Extension Item list. The encoding of each Transfer Extension Item 1388 is within a consistent data container as described in 1389 Section 5.2.2.1. The full set of transfer extension items apply 1390 only to the assoicated single transfer. The order and 1391 mulitplicity of these transfer extension items MAY be significant, 1392 as defined in the associated type specification(s). 1394 An XFER_INIT message SHALL be sent as the first message in a transfer 1395 sequence, before transmission of any XFER_SEGMENT messages for the 1396 same Transfer ID. XFER_INIT messages MUST NOT be sent unless the 1397 next XFER_SEGMENT message has the 'START' bit set to "1" (i.e., just 1398 before the start of a new transfer). 1400 5.2.2.1. Transfer Extension Items 1402 Each of the Transfer Extension Items SHALL be encoded in an identical 1403 Type-Length-Value (TLV) container form as indicated in Figure 21. 1404 The fields of the Transfer Extension Item are: 1406 Flags: A one-octet field containing generic bit flags about the 1407 Item, which are listed in Table 5. If a TCPCL node receives a 1408 Transfer Extension Item with an unknown Item Type and the CRITICAL 1409 flag set, the node SHALL refuse the transfer with an XFER_REFUSE 1410 reason code of "Extension Failure". If the CRITICAL flag is not 1411 set, an entity SHALL skip over and ignore any item with an unknown 1412 Item Type. 1414 Item Type: A 16-bit unsigned integer field containing the type of 1415 the extension item. This specification does not define any 1416 extension types directly, but does allocate an IANA registry for 1417 such codes (see Section 9.4). 1419 Item Length: A 32-bit unsigned integer field containing the number 1420 of Item Value octets to follow. 1422 Item Value: A variable-length data field which is interpreted 1423 according to the associated Item Type. This specification places 1424 no restrictions on an extension's use of available Item Value 1425 data. Extension specification SHOULD avoid the use of large data 1426 exchanges within the XFER_INIT as the associated transfer cannot 1427 begin until the full initialization message is sent. 1429 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 1430 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 1431 +---------------+---------------+---------------+---------------+ 1432 | Item Flags | Item Type | Item Length...| 1433 +---------------+---------------+---------------+---------------+ 1434 | length contd. | Item Value... | 1435 +---------------+---------------+---------------+---------------+ 1436 | value contd. | 1437 +---------------+---------------+---------------+---------------+ 1439 Figure 21: Transfer Extension Item Format 1441 +----------+--------+-----------------------------------------------+ 1442 | Name | Code | Description | 1443 +----------+--------+-----------------------------------------------+ 1444 | CRITICAL | 0x01 | If bit is set, indicates that the receiving | 1445 | | | peer must handle the extension item. | 1446 | | | | 1447 | Reserved | others | 1448 +----------+--------+-----------------------------------------------+ 1450 Table 5: Transfer Extension Item Flags 1452 5.2.3. Data Transmission (XFER_SEGMENT) 1454 Each bundle is transmitted in one or more data segments. The format 1455 of a XFER_SEGMENT message follows in Figure 22. 1457 +------------------------------+ 1458 | Message Header | 1459 +------------------------------+ 1460 | Message Flags (U8) | 1461 +------------------------------+ 1462 | Transfer ID (U64) | 1463 +------------------------------+ 1464 | Data length (U64) | 1465 +------------------------------+ 1466 | Data contents (octet string) | 1467 +------------------------------+ 1469 Figure 22: Format of XFER_SEGMENT Messages 1471 The fields of the XFER_SEGMENT message are: 1473 Message Flags: A one-octet field of single-bit flags, interpreted 1474 according to the descriptions in Table 6. 1476 Transfer ID: A 64-bit unsigned integer identifying the transfer 1477 being made. 1479 Data length: A 64-bit unsigned integer indicating the number of 1480 octets in the Data contents to follow. 1482 Data contents: The variable-length data payload of the message. 1484 +----------+--------+-----------------------------------------------+ 1485 | Name | Code | Description | 1486 +----------+--------+-----------------------------------------------+ 1487 | END | 0x01 | If bit is set, indicates that this is the | 1488 | | | last segment of the transfer. | 1489 | | | | 1490 | START | 0x02 | If bit is set, indicates that this is the | 1491 | | | first segment of the transfer. | 1492 | | | | 1493 | Reserved | others | 1494 +----------+--------+-----------------------------------------------+ 1496 Table 6: XFER_SEGMENT Flags 1498 The flags portion of the message contains two optional values in the 1499 two low-order bits, denoted 'START' and 'END' in Table 6. The 1500 'START' bit MUST be set to one if it precedes the transmission of the 1501 first segment of a transfer. The 'END' bit MUST be set to one when 1502 transmitting the last segment of a transfer. In the case where an 1503 entire transfer is accomplished in a single segment, both the 'START' 1504 and 'END' bits MUST be set to one. 1506 Once a transfer of a bundle has commenced, the node MUST only send 1507 segments containing sequential portions of that bundle until it sends 1508 a segment with the 'END' bit set. No interleaving of multiple 1509 transfers from the same node is possible within a single TCPCL 1510 session. Simultaneous transfers between two entities MAY be achieved 1511 using multiple TCPCL sessions. 1513 5.2.4. Data Acknowledgments (XFER_ACK) 1515 Although the TCP transport provides reliable transfer of data between 1516 transport peers, the typical BSD sockets interface provides no means 1517 to inform a sending application of when the receiving application has 1518 processed some amount of transmitted data. Thus, after transmitting 1519 some data, the TCPCL needs an additional mechanism to determine 1520 whether the receiving agent has successfully received the segment. 1521 To this end, the TCPCL protocol provides feedback messaging whereby a 1522 receiving node transmits acknowledgments of reception of data 1523 segments. 1525 The format of an XFER_ACK message follows in Figure 23. 1527 +-----------------------------+ 1528 | Message Header | 1529 +-----------------------------+ 1530 | Message Flags (U8) | 1531 +-----------------------------+ 1532 | Transfer ID (U64) | 1533 +-----------------------------+ 1534 | Acknowledged length (U64) | 1535 +-----------------------------+ 1537 Figure 23: Format of XFER_ACK Messages 1539 The fields of the XFER_ACK message are: 1541 Message Flags: A one-octet field of single-bit flags, interpreted 1542 according to the descriptions in Table 6. 1544 Transfer ID: A 64-bit unsigned integer identifying the transfer 1545 being acknowledged. 1547 Acknowledged length: A 64-bit unsigned integer indicating the total 1548 number of octets in the transfer which are being acknowledged. 1550 A receiving TCPCL node SHALL send an XFER_ACK message in response to 1551 each received XFER_SEGMENT message. The flags portion of the 1552 XFER_ACK header SHALL be set to match the corresponding DATA_SEGMENT 1553 message being acknowledged. The acknowledged length of each XFER_ACK 1554 contains the sum of the data length fields of all XFER_SEGMENT 1555 messages received so far in the course of the indicated transfer. 1556 The sending node MAY transmit multiple XFER_SEGMENT messages without 1557 necessarily waiting for the corresponding XFER_ACK responses. This 1558 enables pipelining of messages on a transfer stream. 1560 For example, suppose the sending node transmits four segments of 1561 bundle data with lengths 100, 200, 500, and 1000, respectively. 1562 After receiving the first segment, the node sends an acknowledgment 1563 of length 100. After the second segment is received, the node sends 1564 an acknowledgment of length 300. The third and fourth 1565 acknowledgments are of length 800 and 1800, respectively. 1567 5.2.5. Transfer Refusal (XFER_REFUSE) 1569 The TCPCL supports a mechanism by which a receiving node can indicate 1570 to the sender that it does not want to receive the corresponding 1571 bundle. To do so, upon receiving a XFER_INIT or XFER_SEGMENT 1572 message, the node MAY transmit a XFER_REFUSE message. As data 1573 segments and acknowledgments MAY cross on the wire, the bundle that 1574 is being refused SHALL be identified by the Transfer ID of the 1575 refusal. 1577 There is no required relation between the Transfer MRU of a TCPCL 1578 node (which is supposed to represent a firm limitation of what the 1579 node will accept) and sending of a XFER_REFUSE message. A 1580 XFER_REFUSE can be used in cases where the agent's bundle storage is 1581 temporarily depleted or somehow constrained. A XFER_REFUSE can also 1582 be used after the bundle header or any bundle data is inspected by an 1583 agent and determined to be unacceptable. 1585 A receiver MAY send an XFER_REFUSE message as soon as it receives a 1586 XFER_INIT message without waiting for the next XFER_SEGMENT message. 1587 The sender MUST be prepared for this and MUST associate the refusal 1588 with the correct bundle via the Transfer ID fields. 1590 The format of the XFER_REFUSE message is as follows in Figure 24. 1592 +-----------------------------+ 1593 | Message Header | 1594 +-----------------------------+ 1595 | Reason Code (U8) | 1596 +-----------------------------+ 1597 | Transfer ID (U64) | 1598 +-----------------------------+ 1600 Figure 24: Format of XFER_REFUSE Messages 1602 The fields of the XFER_REFUSE message are: 1604 Reason Code: A one-octet refusal reason code interpreted according 1605 to the descriptions in Table 7. 1607 Transfer ID: A 64-bit unsigned integer identifying the transfer 1608 being refused. 1610 +------------+------------------------------------------------------+ 1611 | Name | Semantics | 1612 +------------+------------------------------------------------------+ 1613 | Unknown | Reason for refusal is unknown or not specified. | 1614 | | | 1615 | Extension | A failure processing the Transfer Extension Items ha | 1616 | Failure | occurred. | 1617 | | | 1618 | Completed | The receiver already has the complete bundle. The | 1619 | | sender MAY consider the bundle as completely | 1620 | | received. | 1621 | | | 1622 | No | The receiver's resources are exhausted. The sender | 1623 | Resources | SHOULD apply reactive bundle fragmentation before | 1624 | | retrying. | 1625 | | | 1626 | Retransmit | The receiver has encountered a problem that requires | 1627 | | the bundle to be retransmitted in its entirety. | 1628 +------------+------------------------------------------------------+ 1630 Table 7: XFER_REFUSE Reason Codes 1632 The receiver MUST, for each transfer preceding the one to be refused, 1633 have either acknowledged all XFER_SEGMENTs or refused the bundle 1634 transfer. 1636 The bundle transfer refusal MAY be sent before an entire data segment 1637 is received. If a sender receives a XFER_REFUSE message, the sender 1638 MUST complete the transmission of any partially sent XFER_SEGMENT 1639 message. There is no way to interrupt an individual TCPCL message 1640 partway through sending it. The sender MUST NOT commence 1641 transmission of any further segments of the refused bundle 1642 subsequently. Note, however, that this requirement does not ensure 1643 that an entity will not receive another XFER_SEGMENT for the same 1644 bundle after transmitting a XFER_REFUSE message since messages MAY 1645 cross on the wire; if this happens, subsequent segments of the bundle 1646 SHOULD also be refused with a XFER_REFUSE message. 1648 Note: If a bundle transmission is aborted in this way, the receiver 1649 MAY not receive a segment with the 'END' flag set to '1' for the 1650 aborted bundle. The beginning of the next bundle is identified by 1651 the 'START' bit set to '1', indicating the start of a new transfer, 1652 and with a distinct Transfer ID value. 1654 6. Session Termination 1656 This section describes the procedures for ending a TCPCL session. 1658 6.1. Session Termination Message (SESS_TERM) 1660 To cleanly shut down a session, a SESS_TERM message SHALL be 1661 transmitted by either node at any point following complete 1662 transmission of any other message. Upon receiving a SESS_TERM 1663 message after not sending a SESS_TERM message in the same session, an 1664 entity SHOULD send a confirmation SESS_TERM message with identical 1665 content to the SESS_TERM for which it is confirming. 1667 After sending a SESS_TERM message, an entity MAY continue a possible 1668 in-progress transfer in either direction. After sending a SESS_TERM 1669 message, an entity SHALL NOT begin any new outgoing transfer (i.e. 1670 send an XFER_INIT message) for the remainder of the session. After 1671 receving a SESS_TERM message, an entity SHALL NOT accept any new 1672 incoming transfer for the remainder of the session. 1674 Instead of following a clean shutdown sequence, after transmitting a 1675 SESS_TERM message an entity MAY immediately close the associated TCP 1676 connection. When performing an unclean shutdown, a receiving node 1677 SHOULD acknowledge all received data segments before closing the TCP 1678 connection. When performing an unclean shutodwn, a transmitting node 1679 SHALL treat either sending or receiving a SESS_TERM message (i.e. 1680 before the final acknowledgment) as a failure of the transfer. Any 1681 delay between request to terminate the TCP connection and actual 1682 closing of the connection (a "half-closed" state) MAY be ignored by 1683 the TCPCL node. 1685 The format of the SESS_TERM message is as follows in Figure 25. 1687 +-----------------------------------+ 1688 | Message Header | 1689 +-----------------------------------+ 1690 | Message Flags (U8) | 1691 +-----------------------------------+ 1692 | Reason Code (optional U8) | 1693 +-----------------------------------+ 1695 Figure 25: Format of SESS_TERM Messages 1697 The fields of the SESS_TERM message are: 1699 Message Flags: A one-octet field of single-bit flags, interpreted 1700 according to the descriptions in Table 8. 1702 Reason Code: A one-octet refusal reason code interpreted according 1703 to the descriptions in Table 9. The Reason Code is present or 1704 absent as indicated by one of the flags. 1706 +----------+--------+-----------------------------------------------+ 1707 | Name | Code | Description | 1708 +----------+--------+-----------------------------------------------+ 1709 | R | 0x02 | If bit is set, indicates that a Reason Code | 1710 | | | field is present. | 1711 | | | | 1712 | Reserved | others | 1713 +----------+--------+-----------------------------------------------+ 1715 Table 8: SESS_TERM Flags 1717 It is possible for an entity to convey optional information regarding 1718 the reason for session termination. To do so, the node MUST set the 1719 'R' bit in the message flags and transmit a one-octet reason code 1720 immediately following the message header. The specified values of 1721 the reason code are: 1723 +---------------+---------------------------------------------------+ 1724 | Name | Description | 1725 +---------------+---------------------------------------------------+ 1726 | Idle timeout | The session is being closed due to idleness. | 1727 | | | 1728 | Version | The node cannot conform to the specified TCPCL | 1729 | mismatch | protocol version. | 1730 | | | 1731 | Busy | The node is too busy to handle the current | 1732 | | session. | 1733 | | | 1734 | Contact | The node cannot interpret or negotiate contact | 1735 | Failure | header option. | 1736 | | | 1737 | Resource | The node has run into some resource limit and | 1738 | Exhaustion | cannot continue the session. | 1739 +---------------+---------------------------------------------------+ 1741 Table 9: SESS_TERM Reason Codes 1743 A session shutdown MAY occur immediately after transmission of a 1744 contact header (and prior to any further message transmit). This 1745 MAY, for example, be used to notify that the node is currently not 1746 able or willing to communicate. However, an entity MUST always send 1747 the contact header to its peer before sending a SESS_TERM message. 1749 If reception of the contact header itself somehow fails (e.g. an 1750 invalid "magic string" is recevied), an entity SHOULD close the TCP 1751 connection without sending a SESS_TERM message. If the content of 1752 the Session Extension Items data disagrees with the Session Extension 1753 Length (i.e. the last Item claims to use more octets than are present 1754 in the Session Extension Length), the reception of the contact header 1755 is considered to have failed. 1757 If a session is to be terminated before a protocol message has 1758 completed being sent, then the node MUST NOT transmit the SESS_TERM 1759 message but still SHOULD close the TCP connection. Each TCPCL 1760 message is contiguous in the octet stream and has no ability to be 1761 cut short and/or preempted by an other message. This is particularly 1762 important when large segment sizes are being transmitted; either 1763 entire XFER_SEGMENT is sent before a SESS_TERM message or the 1764 connection is simply terminated mid-XFER_SEGMENT. 1766 6.2. Idle Session Shutdown 1768 The protocol includes a provision for clean shutdown of idle 1769 sessions. Determining the length of time to wait before closing idle 1770 sessions, if they are to be closed at all, is an implementation and 1771 configuration matter. 1773 If there is a configured time to close idle links and if no TCPCL 1774 messages (other than KEEPALIVE messages) has been received for at 1775 least that amount of time, then either node MAY terminate the session 1776 by transmitting a SESS_TERM message indicating the reason code of 1777 "Idle timeout" (as described in Table 9). 1779 7. Implementation Status 1781 [NOTE to the RFC Editor: please remove this section before 1782 publication, as well as the reference to [RFC7942] and 1783 [github-dtn-bpbis-tcpcl].] 1785 This section records the status of known implementations of the 1786 protocol defined by this specification at the time of posting of this 1787 Internet-Draft, and is based on a proposal described in [RFC7942]. 1788 The description of implementations in this section is intended to 1789 assist the IETF in its decision processes in progressing drafts to 1790 RFCs. Please note that the listing of any individual implementation 1791 here does not imply endorsement by the IETF. Furthermore, no effort 1792 has been spent to verify the information presented here that was 1793 supplied by IETF contributors. This is not intended as, and must not 1794 be construed to be, a catalog of available implementations or their 1795 features. Readers are advised to note that other implementations may 1796 exist. 1798 An example implementation of the this draft of TCPCLv4 has been 1799 created as a GitHub project [github-dtn-bpbis-tcpcl] and is intented 1800 to use as a proof-of-concept and as a possible source of 1801 interoperability testing. This example implementation uses D-Bus as 1802 the CL-BP Agent interface, so it only runs on hosts which provide the 1803 Python "dbus" library. 1805 8. Security Considerations 1807 One security consideration for this protocol relates to the fact that 1808 entities present their endpoint identifier as part of the contact 1809 header exchange. It would be possible for an entity to fake this 1810 value and present the identity of a singleton endpoint in which the 1811 node is not a member, essentially masquerading as another DTN node. 1812 If this identifier is used outside of a TLS-secured session or 1813 without further verification as a means to determine which bundles 1814 are transmitted over the session, then the node that has falsified 1815 its identity would be able to obtain bundles that it otherwise would 1816 not have. Therefore, an entity SHALL NOT use the EID value of an 1817 unsecured contact header to derive a peer node's identity unless it 1818 can corroborate it via other means. When TCPCL session security is 1819 mandated by a TCPCL peer, that peer SHALL transmit initial unsecured 1820 contact header values indicated in Table 10 in order. These values 1821 avoid unnecessarily leaking session parameters and will be ignored 1822 when secure contact header re-exchange occurs. 1824 +--------------------+---------------------------------------------+ 1825 | Parameter | Value | 1826 +--------------------+---------------------------------------------+ 1827 | Flags | The USE_TLS flag is set. | 1828 | | | 1829 | Keepalive Interval | Zero, indicating no keepalive. | 1830 | | | 1831 | Segment MRU | Zero, indicating all segments are refused. | 1832 | | | 1833 | Transfer MRU | Zero, indicating all transfers are refused. | 1834 | | | 1835 | EID | Empty, indicating lack of EID. | 1836 +--------------------+---------------------------------------------+ 1838 Table 10: Recommended Unsecured Contact Header 1840 TCPCL can be used to provide point-to-point transport security, but 1841 does not provide security of data-at-rest and does not guarantee end- 1842 to-end bundle security. The mechanisms defined in [RFC6257] and 1843 [I-D.ietf-dtn-bpsec] are to be used instead. 1845 Even when using TLS to secure the TCPCL session, the actual 1846 ciphersuite negotiated between the TLS peers MAY be insecure. TLS 1847 can be used to perform authentication without data confidentiality, 1848 for example. It is up to security policies within each TCPCL node to 1849 ensure that the negotiated TLS ciphersuite meets transport security 1850 requirements. This is identical behavior to STARTTLS use in 1851 [RFC2595]. 1853 Another consideration for this protocol relates to denial-of-service 1854 attacks. An entity MAY send a large amount of data over a TCPCL 1855 session, requiring the receiving entity to handle the data, attempt 1856 to stop the flood of data by sending a XFER_REFUSE message, or 1857 forcibly terminate the session. This burden could cause denial of 1858 service on other, well-behaving sessions. There is also nothing to 1859 prevent a malicious entity from continually establishing sessions and 1860 repeatedly trying to send copious amounts of bundle data. A 1861 listening entity MAY take countermeasures such as ignoring TCP SYN 1862 messages, closing TCP connections as soon as they are established, 1863 waiting before sending the contact header, sending a SESS_TERM 1864 message quickly or with a delay, etc. 1866 9. IANA Considerations 1868 In this section, registration procedures are as defined in [RFC8126]. 1870 Some of the registries below are created new for TCPCLv4 but share 1871 code values with TCPCLv3. This was done to disambiguate the use of 1872 these values between TCPCLv3 and TCPCLv4 while preserving the 1873 semantics of some values. 1875 9.1. Port Number 1877 Port number 4556 has been previously assigned as the default port for 1878 the TCP convergence layer in [RFC7242]. This assignment is unchanged 1879 by protocol version 4. Each TCPCL entity identifies its TCPCL 1880 protocol version in its initial contact (see Section 9.2), so there 1881 is no ambiguity about what protocol is being used. 1883 +------------------------+-------------------------------------+ 1884 | Parameter | Value | 1885 +------------------------+-------------------------------------+ 1886 | Service Name: | dtn-bundle | 1887 | | | 1888 | Transport Protocol(s): | TCP | 1889 | | | 1890 | Assignee: | Simon Perreault | 1891 | | | 1892 | Contact: | Simon Perreault | 1893 | | | 1894 | Description: | DTN Bundle TCP CL Protocol | 1895 | | | 1896 | Reference: | [RFC7242] | 1897 | | | 1898 | Port Number: | 4556 | 1899 +------------------------+-------------------------------------+ 1901 9.2. Protocol Versions 1903 IANA has created, under the "Bundle Protocol" registry, a sub- 1904 registry titled "Bundle Protocol TCP Convergence-Layer Version 1905 Numbers" and initialize it with the following table. The 1906 registration procedure is RFC Required. 1908 +-------+-------------+---------------------+ 1909 | Value | Description | Reference | 1910 +-------+-------------+---------------------+ 1911 | 0 | Reserved | [RFC7242] | 1912 | | | | 1913 | 1 | Reserved | [RFC7242] | 1914 | | | | 1915 | 2 | Reserved | [RFC7242] | 1916 | | | | 1917 | 3 | TCPCL | [RFC7242] | 1918 | | | | 1919 | 4 | TCPCLbis | This specification. | 1920 | | | | 1921 | 5-255 | Unassigned | 1922 +-------+-------------+---------------------+ 1924 9.3. Session Extension Types 1926 EDITOR NOTE: sub-registry to-be-created upon publication of this 1927 specification. 1929 IANA will create, under the "Bundle Protocol" registry, a sub- 1930 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1931 Session Extension Types" and initialize it with the contents of 1932 Table 11. The registration procedure is RFC Required within the 1933 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1934 reserved for use on private networks for functions not published to 1935 the IANA. 1937 +----------------+--------------------------+ 1938 | Code | Message Type | 1939 +----------------+--------------------------+ 1940 | 0x0000 | Reserved | 1941 | | | 1942 | 0x0001--0x7fff | Unassigned | 1943 | | | 1944 | 0x8000--0xffff | Private/Experimental Use | 1945 +----------------+--------------------------+ 1947 Table 11: Session Extension Type Codes 1949 9.4. Transfer Extension Types 1951 EDITOR NOTE: sub-registry to-be-created upon publication of this 1952 specification. 1954 IANA will create, under the "Bundle Protocol" registry, a sub- 1955 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1956 Transfer Extension Types" and initialize it with the contents of 1957 Table 12. The registration procedure is RFC Required within the 1958 lower range 0x0001--0x7fff. Values in the range 0x8000--0xffff are 1959 reserved for use on private networks for functions not published to 1960 the IANA. 1962 +----------------+--------------------------+ 1963 | Code | Message Type | 1964 +----------------+--------------------------+ 1965 | 0x0000 | Reserved | 1966 | | | 1967 | 0x0001--0x7fff | Unassigned | 1968 | | | 1969 | 0x8000--0xffff | Private/Experimental Use | 1970 +----------------+--------------------------+ 1972 Table 12: Transfer Extension Type Codes 1974 9.5. Message Types 1976 EDITOR NOTE: sub-registry to-be-created upon publication of this 1977 specification. 1979 IANA will create, under the "Bundle Protocol" registry, a sub- 1980 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 1981 Message Types" and initialize it with the contents of Table 13. The 1982 registration procedure is RFC Required. 1984 +-----------+--------------+ 1985 | Code | Message Type | 1986 +-----------+--------------+ 1987 | 0x00 | Reserved | 1988 | | | 1989 | 0x01 | XFER_SEGMENT | 1990 | | | 1991 | 0x02 | XFER_ACK | 1992 | | | 1993 | 0x03 | XFER_REFUSE | 1994 | | | 1995 | 0x04 | KEEPALIVE | 1996 | | | 1997 | 0x05 | SESS_TERM | 1998 | | | 1999 | 0x06 | XFER_INIT | 2000 | | | 2001 | 0x07 | MSG_REJECT | 2002 | | | 2003 | 0x08--0xf | Unassigned | 2004 +-----------+--------------+ 2006 Table 13: Message Type Codes 2008 9.6. XFER_REFUSE Reason Codes 2010 EDITOR NOTE: sub-registry to-be-created upon publication of this 2011 specification. 2013 IANA will create, under the "Bundle Protocol" registry, a sub- 2014 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2015 XFER_REFUSE Reason Codes" and initialize it with the contents of 2016 Table 14. The registration procedure is RFC Required. 2018 +----------+---------------------------+ 2019 | Code | Refusal Reason | 2020 +----------+---------------------------+ 2021 | 0x0 | Unknown | 2022 | | | 2023 | 0x1 | Extension Failure | 2024 | | | 2025 | 0x2 | Completed | 2026 | | | 2027 | 0x3 | No Resources | 2028 | | | 2029 | 0x4 | Retransmit | 2030 | | | 2031 | 0x5--0x7 | Unassigned | 2032 | | | 2033 | 0x8--0xf | Reserved for future usage | 2034 +----------+---------------------------+ 2036 Table 14: XFER_REFUSE Reason Codes 2038 9.7. SESS_TERM Reason Codes 2040 EDITOR NOTE: sub-registry to-be-created upon publication of this 2041 specification. 2043 IANA will create, under the "Bundle Protocol" registry, a sub- 2044 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2045 SESS_TERM Reason Codes" and initialize it with the contents of 2046 Table 15. The registration procedure is RFC Required. 2048 +------------+---------------------+ 2049 | Code | Shutdown Reason | 2050 +------------+---------------------+ 2051 | 0x00 | Idle timeout | 2052 | | | 2053 | 0x01 | Version mismatch | 2054 | | | 2055 | 0x02 | Busy | 2056 | | | 2057 | 0x03 | Contact Failure | 2058 | | | 2059 | 0x04 | Resource Exhaustion | 2060 | | | 2061 | 0x05--0xFF | Unassigned | 2062 +------------+---------------------+ 2064 Table 15: SESS_TERM Reason Codes 2066 9.8. MSG_REJECT Reason Codes 2068 EDITOR NOTE: sub-registry to-be-created upon publication of this 2069 specification. 2071 IANA will create, under the "Bundle Protocol" registry, a sub- 2072 registry titled "Bundle Protocol TCP Convergence-Layer Version 4 2073 MSG_REJECT Reason Codes" and initialize it with the contents of 2074 Table 16. The registration procedure is RFC Required. 2076 +-----------+----------------------+ 2077 | Code | Rejection Reason | 2078 +-----------+----------------------+ 2079 | 0x00 | reserved | 2080 | | | 2081 | 0x01 | Message Type Unknown | 2082 | | | 2083 | 0x02 | Message Unsupported | 2084 | | | 2085 | 0x03 | Message Unexpected | 2086 | | | 2087 | 0x04-0xFF | Unassigned | 2088 +-----------+----------------------+ 2090 Table 16: REJECT Reason Codes 2092 10. Acknowledgments 2094 This specification is based on comments on implementation of 2095 [RFC7242] provided from Scott Burleigh. 2097 11. References 2099 11.1. Normative References 2101 [I-D.ietf-dtn-bpbis] 2102 Burleigh, S., Fall, K., and E. Birrane, "Bundle Protocol 2103 Version 7", draft-ietf-dtn-bpbis-11 (work in progress), 2104 May 2018. 2106 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 2107 RFC 793, DOI 10.17487/RFC0793, September 1981, 2108 . 2110 [RFC1122] Braden, R., Ed., "Requirements for Internet Hosts - 2111 Communication Layers", STD 3, RFC 1122, 2112 DOI 10.17487/RFC1122, October 1989, 2113 . 2115 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2116 Requirement Levels", BCP 14, RFC 2119, 2117 DOI 10.17487/RFC2119, March 1997, 2118 . 2120 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2121 (TLS) Protocol Version 1.2", RFC 5246, 2122 DOI 10.17487/RFC5246, August 2008, 2123 . 2125 [RFC7525] Sheffer, Y., Holz, R., and P. Saint-Andre, 2126 "Recommendations for Secure Use of Transport Layer 2127 Security (TLS) and Datagram Transport Layer Security 2128 (DTLS)", BCP 195, RFC 7525, DOI 10.17487/RFC7525, May 2129 2015, . 2131 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2132 Writing an IANA Considerations Section in RFCs", BCP 26, 2133 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2134 . 2136 11.2. Informative References 2138 [github-dtn-bpbis-tcpcl] 2139 Sipos, B., "TCPCL Example Implementation", 2140 . 2143 [I-D.ietf-dtn-bpsec] 2144 Birrane, E. and K. McKeever, "Bundle Protocol Security 2145 Specification", draft-ietf-dtn-bpsec-06 (work in 2146 progress), October 2017. 2148 [RFC2595] Newman, C., "Using TLS with IMAP, POP3 and ACAP", 2149 RFC 2595, DOI 10.17487/RFC2595, June 1999, 2150 . 2152 [RFC4838] Cerf, V., Burleigh, S., Hooke, A., Torgerson, L., Durst, 2153 R., Scott, K., Fall, K., and H. Weiss, "Delay-Tolerant 2154 Networking Architecture", RFC 4838, DOI 10.17487/RFC4838, 2155 April 2007, . 2157 [RFC5050] Scott, K. and S. Burleigh, "Bundle Protocol 2158 Specification", RFC 5050, DOI 10.17487/RFC5050, November 2159 2007, . 2161 [RFC6257] Symington, S., Farrell, S., Weiss, H., and P. Lovell, 2162 "Bundle Security Protocol Specification", RFC 6257, 2163 DOI 10.17487/RFC6257, May 2011, 2164 . 2166 [RFC7242] Demmer, M., Ott, J., and S. Perreault, "Delay-Tolerant 2167 Networking TCP Convergence-Layer Protocol", RFC 7242, 2168 DOI 10.17487/RFC7242, June 2014, 2169 . 2171 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2172 Code: The Implementation Status Section", BCP 205, 2173 RFC 7942, DOI 10.17487/RFC7942, July 2016, 2174 . 2176 Appendix A. Significant changes from RFC7242 2178 The areas in which changes from [RFC7242] have been made to existing 2179 headers and messages are: 2181 o Split contact header into pre-TLS protocol negotiation and 2182 SESS_INIT parameter negotiation. The contact header is now fixed- 2183 length. 2185 o Changed contact header content to limit number of negotiated 2186 options. 2188 o Added contact option to negotiate maximum segment size (per each 2189 direction). 2191 o Added session extension capability. 2193 o Added transfer extension capability. 2195 o Defined new IANA registries for message / type / reason codes to 2196 allow renaming some codes for clarity. 2198 o Expanded Message Header to octet-aligned fields instead of bit- 2199 packing. 2201 o Added a bundle transfer identification number to all bundle- 2202 related messages (XFER_INIT, XFER_SEGMENT, XFER_ACK, XFER_REFUSE). 2204 o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. 2206 o Removed all uses of SDNV fields and replaced with fixed-bit-length 2207 fields. 2209 o Renamed SHUTDOWN to SESS_TERM to deconflict term "shutdown". 2211 o Removed the notion of a re-connection delay parameter. 2213 The areas in which extensions from [RFC7242] have been made as new 2214 messages and codes are: 2216 o Added contact negotiation failure SESS_TERM reason code. 2218 o Added MSG_REJECT message to indicate an unknown or unhandled 2219 message was received. 2221 o Added TLS session security mechanism. 2223 o Added Resource Exhaustion SESS_TERM reason code. 2225 Authors' Addresses 2227 Brian Sipos 2228 RKF Engineering Solutions, LLC 2229 7500 Old Georgetown Road 2230 Suite 1275 2231 Bethesda, MD 20814-6198 2232 United States of America 2234 Email: BSipos@rkf-eng.com 2236 Michael Demmer 2237 University of California, Berkeley 2238 Computer Science Division 2239 445 Soda Hall 2240 Berkeley, CA 94720-1776 2241 United States of America 2243 Email: demmer@cs.berkeley.edu 2245 Joerg Ott 2246 Aalto University 2247 Department of Communications and Networking 2248 PO Box 13000 2249 Aalto 02015 2250 Finland 2252 Email: jo@netlab.tkk.fi 2253 Simon Perreault 2254 Quebec, QC 2255 Canada 2257 Email: simon@per.reau.lt