7. DLEP Session Flow
All DLEP participants of a session transition through a number of distinct states during the lifetime of a DLEP session:
-
Peer Discovery
-
Session Initialization
-
In-Session
-
Session Termination
-
Session Reset
Modems, and routers supporting DLEP discovery, transition through all five of the above states. Routers that rely on preconfigured TCP address/port information start in the Session Initialization state.
Modems MUST support the Peer Discovery state.
7.1. Peer Discovery State
Modems MUST support DLEP Peer Discovery; routers MAY support the discovery signals or rely on a priori configuration to locate modems. If a router chooses to support DLEP discovery, all signals MUST be supported.
In the Peer Discovery state, routers that support DLEP discovery MUST send Peer Discovery Signals (Section 12.3) to initiate modem discovery.
The router implementation then waits for a Peer Offer Signal (Section 12.4) response from a potential DLEP modem. While in the Peer Discovery state, Peer Discovery Signals MUST be sent repeatedly by a DLEP router, at regular intervals. It is RECOMMENDED that this interval be set to 60 seconds. The interval MUST be a minimum of 1 second; it SHOULD be a configurable parameter. Note that this operation (sending Peer Discovery and waiting for Peer Offer) is outside the DLEP transaction model (Section 8), as the transaction model only describes Messages on a TCP session.
Routers receiving a Peer Offer Signal MUST use one of the modem address/port combinations from the Peer Offer Signal to establish a TCP connection to the modem, even if a priori configuration exists. If multiple Connection Point Data Items exist in the received Peer Offer Signal, routers SHOULD prioritize IPv6 connection points over IPv4 connection points. If multiple connection points exist with the same transport (e.g., IPv6 or IPv4), implementations MAY use their own heuristics to determine the order in which they are tried. If a TCP connection cannot be achieved using any of the address/port combinations and the Discovery mechanism is in use, then the router SHOULD resume issuing Peer Discovery Signals. If no Connection Point Data Items are included in the Peer Offer Signal, the router MUST use the source address of the UDP packet containing the Peer Offer Signal as the IP address, and the DLEP well-known port number.
In the Peer Discovery state, the modem implementation MUST listen for incoming Peer Discovery Signals on the DLEP well-known IPv6 and/or IPv4 link-local multicast address and port. On receipt of a valid Peer Discovery Signal, it MUST reply with a Peer Offer Signal.
Modems MUST be prepared to accept a TCP connection from a router that is not using the Discovery mechanism, i.e., a connection attempt that occurs without a preceding Peer Discovery Signal.
Implementations of DLEP SHOULD implement, and use, Transport Layer Security (TLS) [RFC5246] to protect the TCP session. The "dedicated deployments" discussed in "Implementation Scenarios" (Section 4) MAY consider the use of DLEP without TLS. For all "networked deployments" (again, discussed in "Implementation Scenarios"), the implementation and use of TLS are STRONGLY RECOMMENDED. If TLS is to be used, then the TLS session MUST be established before any Messages are passed between peers. Routers supporting TLS MUST prioritize connection points using TLS over those that do not.
Upon establishment of a TCP connection, and the establishment of a TLS session if TLS is in use, both modem and router enter the Session Initialization state. It is up to the router implementation if Peer Discovery Signals continue to be sent after the device has transitioned to the Session Initialization state. Modem implementations MUST silently ignore Peer Discovery Signals from a router with which a given implementation already has a TCP connection.
7.2. Session Initialization State
On entering the Session Initialization state, the router MUST send a Session Initialization Message (Section 12.5) to the modem. The router MUST then wait for receipt of a Session Initialization Response Message (Section 12.6) from the modem. Receipt of the Session Initialization Response Message containing a Status Data Item (Section 13.1) with status code set to 0 'Success' (see Table 2 in Section 13.1) indicates that the modem has received and processed the Session Initialization Message, and the router MUST transition to the In-Session state.
On entering the Session Initialization state, the modem MUST wait for receipt of a Session Initialization Message from the router. Upon receipt of a Session Initialization Message, the modem MUST send a Session Initialization Response Message, and the session MUST transition to the In-Session state. If the modem receives any Message other than Session Initialization or it fails to parse the received Message, it MUST NOT send any Message, and it MUST terminate the TCP connection and transition to the Session Reset state.
DLEP provides an extension negotiation capability to be used in the Session Initialization state; see Section 9. Extensions supported by an implementation MUST be declared to potential DLEP participants using the Extensions Supported Data Item (Section 13.6). Once both DLEP participants have exchanged initialization Messages, an implementation MUST NOT emit any Message, Signal, Data Item, or status code associated with an extension that was not specified in the received initialization Message from its peer.
7.3. In-Session State
In the In-Session state, Messages can flow in both directions between DLEP participants, indicating changes to the session state, the arrival or departure of reachable destinations, or changes of the state of the links to the destinations.
The In-Session state is maintained until one of the following conditions occurs:
-
The implementation terminates the session by sending a Session Termination Message (Section 12.9), or
-
Its peer terminates the session, indicated by receiving a Session Termination Message.
The implementation MUST then transition to the Session Termination state.
7.3.1. Heartbeats
In order to maintain the In-Session state, periodic Heartbeat Messages (Section 12.20) MUST be exchanged between router and modem. These Messages are intended to keep the session alive and to verify bidirectional connectivity between the two DLEP participants. It is RECOMMENDED that the interval timer between Heartbeat Messages be set to 60 seconds. The interval MUST be a minimum of 1 second; it SHOULD be a configurable parameter.
Each DLEP participant is responsible for the creation of Heartbeat Messages.
Receipt of any valid DLEP Message MUST reset the heartbeat interval timer (i.e., valid DLEP Messages take the place of, and obviate the need for, additional Heartbeat Messages).
An implementation MUST allow a minimum of 2 heartbeat intervals to expire with no Messages from its peer before terminating the session. When terminating the session, a Session Termination Message containing a Status Data Item (Section 13.1) with status code set to 132 'Timed Out' (see Table 2) MUST be sent, and then the implementation MUST transition to the Session Termination state.
7.4. Session Termination State
When an implementation enters the Session Termination state after sending a Session Termination Message (Section 12.9) as the result of an invalid Message or error, it MUST wait for a Session Termination Response Message (Section 12.10) from its peer. A sender SHOULD allow 4 heartbeat intervals to expire before assuming that its peer is unresponsive and before continuing with session termination. Any other Message received while waiting MUST be silently ignored.
When the sender of the Session Termination Message receives a Session Termination Response Message from its peer or times out, it MUST transition to the Session Reset state.
When an implementation receives a Session Termination Message from its peer, it enters the Session Termination state, and then it MUST immediately send a Session Termination Response and transition to the Session Reset state.
7.5. Session Reset State
In the Session Reset state, the implementation MUST perform the following actions:
-
Release all resources allocated for the session.
-
Eliminate all destinations in the information base represented by the session. Destination Down Messages (Section 12.15) MUST NOT be sent.
-
Terminate the TCP connection.
Having completed these actions, the implementation SHOULD return to the relevant initial state:
-
For modems: Peer Discovery.
-
For routers: either Peer Discovery or Session Initialization, depending on configuration.
7.5.1. Unexpected TCP Connection Termination
If the TCP connection between DLEP participants is terminated when an implementation is not in the Session Reset state, the implementation MUST immediately transition to the Session Reset state.