--- 1/draft-ietf-dtn-tcpclv4-04.txt 2017-12-14 18:13:08.758631432 -0800 +++ 2/draft-ietf-dtn-tcpclv4-05.txt 2017-12-14 18:13:08.838633334 -0800 @@ -1,22 +1,22 @@ Delay Tolerant Networking B. Sipos Internet-Draft RKF Engineering Obsoletes: 7242 (if approved) M. Demmer Intended status: Standards Track UC Berkeley -Expires: June 13, 2018 J. Ott +Expires: June 17, 2018 J. Ott Aalto University S. Perreault - December 10, 2017 + December 14, 2017 Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4 - draft-ietf-dtn-tcpclv4-04 + draft-ietf-dtn-tcpclv4-05 Abstract This document describes a revised protocol for the TCP-based convergence layer (TCPCL) for Delay-Tolerant Networking (DTN). The protocol revision is based on implementation issues in the original TCPCL Version 3 and updates to the Bundle Protocol contents, encodings, and convergence layer requirements in Bundle Protocol Version 7. Specifically, the TCPCLv4 uses CBOR-encoded BPv7 bundles as its service data unit being transported and provides a reliable @@ -32,21 +32,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on June 13, 2018. + This Internet-Draft will expire on June 17, 2018. Copyright Notice Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -54,28 +54,28 @@ to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 4 2.1. Definitions Specific to the TCPCL Protocol . . . . . . . 4 - 3. General Protocol Description . . . . . . . . . . . . . . . . 5 + 3. General Protocol Description . . . . . . . . . . . . . . . . 6 3.1. TCPCL Session Overview . . . . . . . . . . . . . . . . . 6 3.2. Example Message Exchange . . . . . . . . . . . . . . . . 7 - 4. Session Establishment . . . . . . . . . . . . . . . . . . . . 8 + 4. Session Establishment . . . . . . . . . . . . . . . . . . . . 9 4.1. Contact Header . . . . . . . . . . . . . . . . . . . . . 10 4.1.1. Header Extension Items . . . . . . . . . . . . . . . 12 4.2. Validation and Parameter Negotiation . . . . . . . . . . 13 - 4.3. Session Security . . . . . . . . . . . . . . . . . . . . 14 + 4.3. Session Security . . . . . . . . . . . . . . . . . . . . 15 4.3.1. TLS Handshake Result . . . . . . . . . . . . . . . . 15 4.3.2. Example TLS Initiation . . . . . . . . . . . . . . . 15 5. Established Session Operation . . . . . . . . . . . . . . . . 16 5.1. Message Type Codes . . . . . . . . . . . . . . . . . . . 16 5.2. Upkeep and Status Messages . . . . . . . . . . . . . . . 17 5.2.1. Session Upkeep (KEEPALIVE) . . . . . . . . . . . . . 17 5.2.2. Message Rejection (MSG_REJECT) . . . . . . . . . . . 18 5.3. Bundle Transfer . . . . . . . . . . . . . . . . . . . . . 19 5.3.1. Bundle Transfer ID . . . . . . . . . . . . . . . . . 19 5.3.2. Transfer Initialization (XFER_INIT) . . . . . . . . . 20 @@ -202,20 +202,26 @@ and thereby to the TCPCL is implementation dependent. However, the mechanism by which two bundle nodes exchange and negotiate the values to be used for a given session is described in Section 4.2. Transfer: Transfer refers to the procedures and mechanisms (described below) for conveyance of an individual bundle from one node to another. Each transfer within TCPCLv4 is identified by a Transfer ID number which is unique only to a single direction within a single Session. + Idle Session: A TCPCL session is idle while the only messages being + transmitted or received are KEEPALIVE messages. + + Lively Session: A TCPCL session is lively while any messages are + being transmitted or received. + Reason Codes: The TCPCL uses numeric codes to encode specific reasons for individual failure/error message types. This limits the expressiveness of TCPCL error encodings, but simplifies the encoding of errors and allows an application policy to attempt recovery from expected 'failure' modes (e.g. if a Session cannot be established with USE_TLS disabled because of a Contact Failure shutdown, a re-attempt can be made with USE_TLS enabled). 3. General Protocol Description @@ -270,30 +276,33 @@ Another feature is that a receiver MAY interrupt the transmission of a bundle at any point in time by replying with a XFER_REFUSE message, which causes the sender to stop transmission of the current bundle, after completing transmission of a partially sent data segment. Note: This enables a cross-layer optimization in that it allows a receiver that detects that it already has received a certain bundle to interrupt transmission as early as possible and thus save transmission capacity for other bundles. For sessions that are idle, a KEEPALIVE message is sent at a - negotiated interval. This is used to convey node liveness - information. + negotiated interval. This is used to convey node liveliqness + information during otherwise message-less time intervals. Finally, before sessions close, a SHUTDOWN message is sent to the - session peer. A SHUTDOWN message MAY also be used to refuse a - session setup by a peer (see Section 4.2). After sending a SHUTDOWN - message, the sender of the message MAY send further acknowledgments - (XFER_ACK or XFER_REFUSE) but no further data messages (XFER_INIT or - XFER_SEGMENT). After receving a SHUTDOWN message and when no - transfers are in-progress (i.e. have unacknowledged segemnts) + session peer (see Section 6.1). After sending a SHUTDOWN message, + the peer can not initiate any further transfers and the session + enters a closing-down phase. After receiving a SHUTDOWN message and + when no transfers are in-progress (i.e. have pending or + unacknowledged segments), the receiving peer can close the session + without chance of lost transfers. A SHUTDOWN message can also be + used to refuse a session setup by a peer (see Section 4.2). It is an + implementation matter to determine whether or not to close a TCPCL + session while there are no transfers queued or in-progress. There are specific messages for sending and receiving operations (in addition to session setup/teardown). TCPCL is symmetric, i.e., both sides can start sending data segments in a session, and one side's bundle transfer does not have to complete before the other side can start sending data segments on its own. Hence, the protocol allows for a bi-directional mode of communication. Note that in the case of concurrent bidirectional transmission, acknowledgment segments MAY be interleaved with data segments. @@ -452,23 +460,26 @@ magic: A four-octet field that always contains the octet sequence 0x64 0x74 0x6e 0x21, i.e., the text string "dtn!" in US-ASCII (and UTF-8). Version: A one-octet field value containing the value 4 (current version of the protocol). Flags: A one-octet field of single-bit flags, interpreted according to the descriptions in Table 1. - Keepalive Interval: A 16-bit unsigned integer indicating the longest - allowable interval, in seconds, between any message being received - in this session and a subsequent KEEPALIVE message being received. + Keepalive Interval: A 16-bit unsigned integer indicating the + interval, in seconds, between any subsequent messages being + transmitted by the peer. The peer receiving this contact header + uses this interval to determine how long to wait after any last- + message transmission and a necessary subsequent KEEPALIVE message + transmission. Segment MRU: A 64-bit unsigned integer indicating the largest allowable single-segment data payload size to be received in this session. Any XFER_SEGMENT sent to this peer SHALL have a data payload no longer than the peer's Segment MRU. The two nodes of a single session MAY have different Segment MRUs, and no relation between the two is required. Transfer MRU: A 64-bit unsigned integer indicating the largest allowable total-bundle data size to be received in this session. @@ -511,21 +522,21 @@ Each of the Header Extension items SHALL be encoded in an identical Type-Length-Value (TLV) container form as indicated in Figure 4. The fields of the header extension item are: Flags: A one-octet field containing generic bit flags about the item, which are listed in Table 2. If a TCPCL node receives an extension item with an unknown Item Type and the CRITICAL flag set, the node SHALL close the TCPCL session with SHUTDOWN reason code of "Contact Failure". If the CRITICAL flag is not set, an - node SHALL skip over and ignore any item with an unkonwn Item + node SHALL skip over and ignore any item with an unknown Item Type. Item Type: A 16-bit unsigned integer field containing the type of the extension item. This specification does not define any extension types directly, but does allocate an IANA registry for such codes (see Section 8.3). Item Length: A 32-bit unsigned integer field containing the number of Item Value octets to follow. @@ -588,22 +599,22 @@ a version that is lower than the version of the protocol that the node implements, the node MAY either terminate the session (with a reason code of "Version mismatch"). Otherwise, the node MAY adapt its operation to conform to the older version of the protocol. The decision of version fall-back is an implementation matter. A node calculates the parameters for a TCPCL session by negotiating the values from its own preferences (conveyed by the contact header it sent to the peer) with the preferences of the peer node (expressed in the contact header that it received from the peer). The - negotatiated parameters defined by this specification are described - in the following paragraphs. + negotiated parameters defined by this specification are described in + the following paragraphs. Session Keepalive: Negotiation of the Session Keepalive parameter is performed by taking the minimum of this two contact headers' Keepalive Interval. If the negotiated Session Keepalive is zero (i.e. one or both contact headers contains a zero Keepalive Interval), then the keepalive feature (described in Section 5.2.1) is disabled. There is no logical minimum value for the keepalive interval, but when used for many sessions on an open, shared network a short interval could lead to excessive traffic. For shared network use, nodes SHOULD choose a keepalive interval no @@ -621,56 +632,55 @@ MAY forbid the establishment of a TCPCL session for any Enable TLS result (or for any combination of local or peer CAN_TLS flag), in which case the node SHALL shutdown the session with a reason code of "Contact Failure". For example, one node may disallow TCPCL sessions without TLS, while a second node may disallow sessions with TLS. Also note that this Contact Failure (of the header negotiation) is different than a TLS Failure (after an agreed-upon Enable TLS state). Once this process of parameter negotiation is completed (which - includes a possible completed TLS handshakede of the connection to - use TLS), this protocol defines no additional mechanism to change the + includes a possible completed TLS handshake of the connection to use + TLS), this protocol defines no additional mechanism to change the parameters of an established session; to effect such a change, the TCPCL session MUST be terminated and a new session established. 4.3. Session Security This version of the TCPCL supports establishing a Transport Layer - Security (TLS) session within an existing TCP connection. Negotation - of whether or not to initiate TLS within a TCPCL session is part of - the contact header as described in Section 4.2. The TLS handshake, - if it occurs, is considered to be part of the contact negotiation - before the TCPCL session itself is established. Specifics about - sensitive data exposure are discussed in Section 7. + Security (TLS) session within an existing TCP connection. + Negotiation of whether or not to initiate TLS within a TCPCL session + is part of the contact header as described in Section 4.2. The TLS + handshake, if it occurs, is considered to be part of the contact + negotiation before the TCPCL session itself is established. + Specifics about sensitive data exposure are discussed in Section 7. When TLS is used within the TCPCL it affects the entire session. By convention, this protocol uses the node which initiated the underlying TCP connection as the "client" role of the TLS handshake request. Once a TLS session is established within TCPCL, there is no mechanism provided to end the TLS session and downgrade the session. If a non-TLS session is desired after a TLS session is started then the entire TCPCL session MUST be shutdown first. After negotiating an Enable TLS parameter of true, and before any other TCPCL messages are sent within the session, the session nodes SHALL begin a TLS handshake in accordance with [RFC5246]. The - parameters within each TLS negotation are implementation dependent - but any TCPCL node SHOULD follow all recommended best practices of - [RFC7525]. + parameters within each TLS nqion are implementation dependent but any + TCPCL node SHOULD follow all recommended best practices of [RFC7525]. 4.3.1. TLS Handshake Result If a TLS handshake cannot negotiate a TLS session, both nodes of the TCPCL session SHALL cause a TCPCL shutdown with reason "TLS Failure". - After a TLS session is successfuly established, both TCPCL nodes + After a TLS session is successfully established, both TCPCL nodes SHALL re-exchange TCPCL Contact Header messages. Any information cached from the prior Contact Header exchange SHALL be discarded. This re-exchange avoids man-in-the-middle attack in identical fashion to [RFC2595]. Each re-exchange header CAN_TLS flag SHALL be identical to the original header CAN_TLS flag from the same node. The CAN_TLS logic (TLS negotiation) SHALL NOT apply during header re- exchange. This reinforces the fact that there is no TLS downgrade mechanism. 4.3.2. Example TLS Initiation @@ -777,35 +787,35 @@ The format of a KEEPALIVE message is a one-octet message type code of KEEPALIVE (as described in Table 3) with no additional data. Both sides SHOULD send a KEEPALIVE message whenever the negotiated interval has elapsed with no transmission of any message (KEEPALIVE or other). If no message (KEEPALIVE or other) has been received for at least twice the Keepalive Interval, then either party MAY terminate the session by transmitting a one-octet SHUTDOWN message (as described in - Section 6.1, with reason code "Idle Timeout") and by closing the + Section 6.1) with reason code "Idle Timeout", and by closing the session. Note: The Keepalive Interval SHOULD not be chosen too short as TCP retransmissions MAY occur in case of packet loss. Those will have to be triggered by a timeout (TCP retransmission timeout (RTO)), which is dependent on the measured RTT for the TCP connection so that KEEPALIVE messages MAY experience noticeable latency. 5.2.2. Message Rejection (MSG_REJECT) If a TCPCL node receives a message which is unknown to it (possibly due to an unhandled protocol mismatch) or is inappropriate for the current session state (e.g. a KEEPALIVE message received after - contact header negotation has disabled that feature), there is a + contact header negotiation has disabled that feature), there is a protocol-level message to signal this condition in the form of a MSG_REJECT reply. The format of a MSG_REJECT message follows: +-----------------------------+ | Message Header | +-----------------------------+ | Reason Code (U8) | +-----------------------------+ @@ -836,21 +846,21 @@ | Message | 0x03 | A message was received while the session is | | Unexpected | | in a state in which the message is not | | | | expected. | +-------------+------+----------------------------------------------+ Table 4: MSG_REJECT Reason Codes 5.3. Bundle Transfer All of the message in this section are directly associated with - transfering a bundle between TCPCL nodes. + transferring a bundle between TCPCL nodes. A single TCPCL transfer results in a bundle (handled by the convergence layer as opaque data) being exchanged from one node to the other. In TCPCL a transfer is accomplished by dividing a single bundle up into "segments" based on the receiving-side Segment MRU (see Section 4.1). A single transfer (and by extension a single segment) SHALL NOT contain data of more than a single bundle. This requirement is imposed on the agent using the TCPCL rather than TCPCL itself. @@ -1119,25 +1129,28 @@ and with a distinct Transfer ID value. 6. Session Termination This section describes the procedures for ending a TCPCL session. 6.1. Shutdown Message (SHUTDOWN) To cleanly shut down a session, a SHUTDOWN message MUST be transmitted by either node at any point following complete - transmission of any other message. A receiving node SHOULD - acknowledge all received data segments before sending a SHUTDOWN - message to end the session. A transmitting node SHALL treat a - SHUTDOWN message received mid-transfer (i.e. before the final - acknowledgement) as a failure of the transfer. + transmission of any other message. After sending a SHUTDOWN message, + the sender of the message MAY send further acknowledgments (XFER_ACK + or XFER_REFUSE) but no further data messages (XFER_INIT or + XFER_SEGMENT). A receiving node SHOULD acknowledge all received data + segments before sending a SHUTDOWN message to end the session. A + transmitting node SHALL treat a SHUTDOWN message received mid- + transfer (i.e. before the final acknowledgment) as a failure of the + transfer. After transmitting a SHUTDOWN message, an node MAY immediately close the associated TCP connection. Once the SHUTDOWN message is sent, any further received data on the TCP connection SHOULD be ignored. Any delay between request to terminate the TCP connection and actual closing of the connection (a "half-closed" state) MAY be ignored by the TCPCL node. The format of the SHUTDOWN message is as follows: @@ -1197,21 +1210,21 @@ | | | | Busy | The node is too busy to handle the current | | | session. | | | | | Contact | The node cannot interpret or negotiate contact | | Failure | header option. | | | | | TLS Failure | The node failed to negotiate TLS session and | | | cannot continue the session. | | | | - | Resource | The node has run into some resoure limit and | + | Resource | The node has run into some resource limit and | | Exhaustion | cannot continue the session. | +---------------+---------------------------------------------------+ Table 8: SHUTDOWN Reason Codes It is also possible to convey a requested reconnection delay to indicate how long the other node MUST wait before attempting session re-establishment. To do so, the node sets the 'D' bit in the message flags and then transmits an 16-bit unsigned integer specifying the requested delay, in seconds, following the message header (and @@ -1237,66 +1250,66 @@ flags and include a reconnection delay to indicate when the peer is allowed to attempt another session setup. If a session is to be terminated before a protocol message has completed being sent, then the node MUST NOT transmit the SHUTDOWN message but still SHOULD close the TCP connection. Each TCPCL message is contiguous in the octet stream and has no ability to be cut short and/or preempted by an other message. This is particularly important when large segment sizes are being transmitted; either entire XFER_SEGMENT is sent before a SHUTDOWN message or the - connection is simply termiated mid-XFER_SEGMENT. + connection is simply terminated mid-XFER_SEGMENT. 6.2. Idle Session Shutdown The protocol includes a provision for clean shutdown of idle sessions. Determining the length of time to wait before closing idle sessions, if they are to be closed at all, is an implementation and configuration matter. - If there is a configured time to close idle links and if no bundle - data (other than KEEPALIVE messages) has been received for at least - that amount of time, then either node MAY terminate the session by - transmitting a SHUTDOWN message indicating the reason code of 'Idle - timeout' (as described in Table 8). + If there is a configured time to close idle links and if no TCPCL + messages (other than KEEPALIVE messages) has been received for at + least that amount of time, then either node MAY terminate the session + by transmitting a SHUTDOWN message indicating the reason code of + 'Idle timeout' (as described in Table 8). 7. Security Considerations One security consideration for this protocol relates to the fact that nodes present their endpoint identifier as part of the contact header exchange. It would be possible for a node to fake this value and present the identity of a singleton endpoint in which the node is not a member, essentially masquerading as another DTN node. If this identifier is used outside of a TLS-secured session or without further verification as a means to determine which bundles are transmitted over the session, then the node that has falsified its identity would be able to obtain bundles that it otherwise would not have. Therefore, a node SHALL NOT use the EID value of an unsecured contact header to derive a peer node's identity unless it can - corroborate it via other means. When TCPCL session security is - mandatory, an endpoint SHALL transmit initial unsecured contact + corroborate it via other means. When TCPCL session security mandated + by a TCPCL peer, that peer SHALL transmit initial unsecured contact header values indicated in Table 9 in order. These values avoid unnecessarily leaking endpoing parameters and will be ignored when secure contact header re-exchange occurs. +--------------------+---------------------------------------------+ | Parameter | Value | +--------------------+---------------------------------------------+ | Flags | The USE_TLS flag is set. | | | | | Keepalive Interval | Zero, indicating no keepalive. | | | | | Segment MRU | Zero, indicating all segments are refused. | | | | | Transfer MRU | Zero, indicating all transfers are refused. | | | | - | EID | Empty, indating lack of EID. | + | EID | Empty, indicating lack of EID. | +--------------------+---------------------------------------------+ Table 9: Recommended Unsecured Contact Header TCPCL can be used to provide point-to-point transport security, but does not provide security of data-at-rest and does not guarantee end- to-end bundle security. The mechanisms defined in [RFC6257] and [I-D.ietf-dtn-bpsec] are to be used instead. Even when using TLS to secure the TCPCL session, the actual @@ -1616,21 +1629,21 @@ related messages (XFER_INIT, XFER_SEGMENT, XFER_ACK, XFER_REFUSE). o Use flags in XFER_ACK to mirror flags from XFER_SEGMENT. o Removed all uses of SDNV fields and replaced with fixed-bit-length fields. The areas in which extensions from [RFC7242] have been made as new messages and codes are: - o Added contact negotation failure SHUTDOWN reason code. + o Added contact negotiation failure SHUTDOWN reason code. o Added MSG_REJECT message to indicate an unknown or unhandled message was received. o Added TLS session security mechanism. o Added TLS failure SHUTDOWN reason code. Authors' Addresses