Network Working Group | E.K. Rescorla |
Internet-Draft | RTFM, Inc. |
Intended status: Standards Track | J. Uberti |
Expires: April 24, 2013 | |
E. Ivov | |
Jitsi | |
October 23, 2012 |
Trickle ICE: Incremental Provisioning of Candidates for the Interactive Connectivity Establishment (ICE) Protocol
draft-rescorla-mmusic-ice-trickle-01
This document describes an extension to the Interactive Connectivity Establishment (ICE) protocol that allows ICE agents to send and receive candidates incrementally rather than exchanging complete lists. With such incremental provisioning, ICE agents can begin connectivity checks while they are still gathering candidates and considerably shorten the time necessary for ICE processing to complete.
The above mechanism is also referred to as "trickle ICE".
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.
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 http:/⁠/⁠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 April 24, 2013.
Copyright (c) 2012 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 (http:/⁠/⁠trustee.ietf.org/⁠license-⁠info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect 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.
The Interactive Connectivity Establishment (ICE) protocol [RFC5245] describes mechanisms for gathering, candidates, prioritizing them, choosing default ones, exchanging them with the remote party, pairing them and ordering them into check lists. Once all of the above have been completed, and only then, the participating agents can begin a phase of connectivity checks and eventually select the pair of candidates that will be used in the following session.
While the above sequence has the advantage of being relatively straightforward to implement and debug once deployed, it may also prove to be rather lengthy. Gathering candidates or candidate harvesting would often involve things like querying STUN [RFC5389] servers, discovering UPnP devices, and allocating relayed candidates at TURN [RFC5766] servers. All of these can be delayed for a noticeable amount of time and while they can be run in parallel, they still need to respect the pacing requirements from [RFC5245], which is likely to delay them even further. Some or all of the above would also have to be completed by the remote agent. Both agents would next perform connectivity checks and only then would they be ready to begin streaming media.
All of the above could lead to relatively lengthy session establishment times and degraded user experience.
The purpose of this document is to define an alternative mode of operation for ICE implementations, also known as "trickle ICE", where candidates can be exchanged incrementally. This would allow ICE agents to exchange host candidates as soon as a session has been initiated. Connectivity checks for a media stream would also start as soon as the first candidates for that stream have become available.
Trickle ICE allows reducing session establishment times in cases where connectivity is confirmed for the first exchanged candidates (e.g. where the host candidates for one of the agents are directly reachable from the second agent). Even when this is not the case, running candidate harvesting for both agents and connectivity checks all in parallel allows to considerably reduce ICE processing times.
It is worth pointing out that before being introduced to the IETF, trickle ICE had already been included in specifications such as XMPP Jingle [XEP-0176] and it has been in use in various implementations and deployments.
In addition to the basics of trickle ICE, this document also describes how support for trickle ICE needs to be discovered, how regular ICE processing needs to be modified when building and updating check lists, and how trickle ICE implementations should interoperate with agents that only implement [RFC5245] processing.
This specification does not define usage of trickle ICE with any specific signalling or media description protocol, contrary to [RFC5245] which defined a usage for ICE wht SIP and SDP. Such usages would have to be specified in separate documents.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
This specification makes use of all terminology defined by the protocol for Interactive Connectivity Establishment in [RFC5245].
The ICE protocol was designed to be fairly flexible so that it would work in and adapt to as many network environments as possible. It is hence important to point out at least some of the reasons why, despite its flexibility, the specification in [RFC5245] would not support trickle-ICE.
[RFC5245] describes the conditions required to update check lists and timer states while an ICE agent is in the Running state. These conditions are verified upon transaction completion and one of them stipulates that:
This could be a problem and cause ICE processing to fail prematurely in a number of scenarios. Consider the following case:
At this point the check list only contains Failed candidates and the valid list is empty. This causes the media stream and potentially all ICE processing to Fail.
A similar race condition would occur if the initial offer from Alice only contains candidates that can be determined as unreachable (per [I-D.keranen-mmusic-ice-address-selection]) from any of the candidates that Bob has gathered. This would be the case if Bob's candidates only contain IPv4 addresses and the first candidate that he receives from Alice is an IPv6 one.
Another potential problem could arise when a non-trickle ICE implementation sends an offer to a trickle one. Consider the following case:
After Bob's agent receives Alice's offer it would immediately start connectivity checks. It would also start gathering candidates, which would take long because of the unreachable STUN server. By the time Bob's answer is ready and sent to Alice, Bob's connectivity checks may well have failed: until Alice gets Bob's answer, she won't be able to start connectivity checks and punch holes in her NAT. The NAT would hence be filtering Bob's checks as originating from an unknown endpoint.
In order to avoid interoperability problems such as those described in Section 3, it is important that trickle ICE sessions are only attempted in cases where both parties support this specification. This means that usages of trickle for specific protocols MUST provide one of the following:
The exact mechanisms that would allow for the verifications above are outside the scope of this document and should be handled by the signalling protocol that is employing ICE.
Examples of how some signalling protocols already handle service and capabilities discovery include:
Usages of trickle ICE SHOULD make use of these mechanisms where they exist and can provide reliable indication.
In some cases, agents may choose to just send an offer that the remote party would reject as invalid unless it supports trickling. One such example would be an offer with no ICE candidates and an invalid default address (e.g. 0.0.0.0).
Usages of trickle ICE MUST define a way for ICE descriptions to indicate support for trickling as well as a clear procedure for falling back to vanilla ICE in the absence of such support.
The vanilla ICE specification uses the Offer/Answer model for exchanging all ICE parameters. Using just a couple of signalling messages is obviously no longer possible with continuous candidate provisioning and trying to fit candidate exchanges into consecutive offer/answer pairs is clearly not practical. This specification therefore loosens the relationship with the Offer/Answer model by splitting trickle ICE signalling into two phases: initial ICE Descriptions and subsequent exchange of additional candidates.
ICE descriptions contain session or media-level parameters that are necessary for ICE processing to begin. Those include attributes such as ice-ufrag and ice-pwd. Due to their nature ICE descriptions are exchanged in the beginning of a session and trickle ICE agents MUST NOT send any candidates prior to a description. It is however possible for ICE descriptions to be accompanied by a first set of candidates.
When using trickle ICE with Offer/Answer protocols agents MUST include an initial ICE description in their Offers. Answerers in this situation MAY send their ICE description at any point after receiving that of the offerer but no later than sending their answer, which MUST contain an ICE description if the agent did not provide one before.
After sending an ICE description each agent can continue trickling candidates regardless of what the state of the Offer/Answer negotiation is.
An agent starts gathering candidates as soon as it has an indication that communication is imminent (e.g. a user interface cue or an explicit request to initiate a session). Contrary to vanilla ICE, implementations of trickle ICE do not need to gather candidates in a blocking manner, and SHOULD generate and transmit their initial ICE description as early as possible.
In the case of protocols using the Offer/Answer model, agents MUST include the initial ICE description in the corresponding offer.
Trickle ICE agents MAY include any set of candidates in an ICE description. This includes the possibility of generating a description with no candidates, or one that contains all the candidates that the agent is planning on using in the following session.
For optimal performance, it is RECOMMENDED that an ICE description contains host candidates only. This would allow both agents to start gathering server reflexive, relayed and other non-host candidates simultaneously, and it would also enable them to begin connectivity checks.
If the privacy implications of revealing host addresses are a concern, agents MAY generate an initial ICE description that contains no candidates and then only trickle candidates that do not reveal host addresses (e.g. relayed candidates).
Prior to actually sending an initial ICE description, agents MAY verify if the remote party supports trickle ICE. If absence of such support is confirmed agents SHOULD fall back to using vanilla ICE or abandon the entire session.
All trickle ICE descriptions MUST indicate support of this specification. The exact syntax of providing this indication is left to the usages that define how signalling protocols employ trickle ICE.
Calculating priorities and foundations, as well as determining redundancy of candidates work the same way they do with vanilla ICE.
When an agent receives an initial ICE description, in the case of protocols using Offer/Answer this description will be part of the offer, it will check if it indicates support for trickle ICE as explained in Section 4. If this is not the case, the agent MUST process the description according to the [RFC5245] procedures or standard [RFC3264] processing in case no ICE support is detected at all.
If, the description does indicate support for trickle ICE, the agent will determine its role, start gathering and prioritizing candidates and, while doing so it will also respond by sending its own ICE description, so that both agents can start forming check lists and begin connectivity checks.
Otherwise the agent would simply fallback to vanilla ICE processing.
An agent can respond to an initial ICE description at any point while gathering candidates. Just as with initial ICE descriptions (Section 6), the agent does send the description without any candidates or with all those it is planning on using. Again, as with initial descriptions it is RECOMMENDED that responses to initial ICE descriptions contain host candidates so that the remote party can also start forming checklists and performing connectivity checks.
The answer MUST indicate support for trickle ICE as described by usage specifications.
For protocols using Offer/Answer semantics the response to the initial ICE description would either be transmitted prior to the [RFC3264] answer or as a part of it.
After exchanging descriptions, and as soon as they have gathered any candidates, agents will begin forming candidate pairs, computing their priorities and creating check lists according to the vanilla ICE procedures described in [RFC5245]. Obviously in order for candidate pairing to be possible, it would be necessary that both descriptions contained candidates. If this was not the case agents will still create the check lists (so that their Active/Frozen state could be monitored and updated) but they will only populate them once they have learned any local and remote candidates.
Initially, all check lists will have their Active/Frozen state set to Frozen.
Trickle ICE agents will then also attempt to unfreeze the check list for the first media stream (i.e. the first media stream that was reported to the ICE implementation from the using application). If this checklist is still empty however, agents will continue examining media streams in the order they were reported and will unfreeze the first non-empty checklist.
Respecting the order in which lists have been reported to an ICE implementation, or in other words, the order in which streams had been described by the signalling protocol (e.g. SDP), is helpful so that checks for the same media stream is more likely to be performed simultaneously by both agents.
When receiving an answer, agents will follow vanilla ICE procedures to determine their role and they would then form check lists and begin connectivity checks as described in Section 7.2.
For the most part, trickle ICE agents perform connectivity checks following vanilla ICE procedures. Of course, the asynchronous nature of candidate harvesting in trickle ICE would impose a number of changes:
The vanilla ICE specification requires that agents update check lists and timer states upon completing a connectivity check transaction. During such an update vanilla ICE agents would set the state of a check list to Failed if the following two conditions are satisfied:
With trickle ICE, the above situation would often occur when candidate harvesting and trickling are still in progress and it is perfectly possible that future checks will succeed. For this reason trickle ICE agents add the following conditions to the above list:
Vanilla ICE requires that agents then update all other check lists, placing one pair in each of them into the Waiting state, effectively unfreezing the check list. Given that with trickle ICE, other check lists may still be empty at that point, a trickle ICE agent SHOULD also maintain an explicit Active/Frozen state for every check list, rather than deducing it from the state of the pairs it contains. This state should be set to Active when unfreezing the first pair in a list or when that couldn't happen because a list was empty.
After an ICE description has been sent or received, agents will most likely continue discovering new local candidates as STUN, TURN and other non-host candidate harvesting mechanisms begin to yield results. Whenever such a new candidate is learned agents will compute its priority, type, foundation and component id according to normal vanilla ICE procedures.
The new candidate is then checked for redundancy against the existing list of local candidates. If its transport address and base match those of an existing candidate, it will be considered redundant and will be ignored. This would often happen for server reflexive candidates that match the host addresses they were obtained from (e.g. when the latter are public IPv4 addresses). Contrary to vanilla ICE, trickle ICE agents will consider the new candidate redundant regardless of its priority. [TODO: is this OK? if not we need to check if the existing candidate was already used in conn checks, cancel them, and then restart them with the new candidate ... and in this specific case there's probably no point to do that].
Then, if no remote candidates are currently known for this same stream, the new candidate will simply be added to the list of local candidates.
Otherwise, if the agent has already learned of one or more remote candidates for this stream and component, it will begin pairing the new local candidates with them and adding the pairs to the existing check lists according to their priority. Forming candidate pairs will work the way it is described by the vanilla ICE specification. Actually adding the new pair to a check list however, will happen according to the rules described below.
If the new pair's local candidate is server reflexive, the server reflexive candidate MUST be replaced by its base before adding the pair to the list. Once this is done, the agent examines the check list looking for another pair that would be redundant with the new one. If such a pair exists and its state is:
For all other pairs, including those with a server reflexive local candidate that were not found to be redundant:
Once all candidate harvesters for a specific media stream complete, or expire, the agent MUST generate an "end-of-candidates" event for that stream and send it to the remote agent via the signalling channel. This would allow the remote agent to begin updating check list states and, in case valid pairs do not exist for every component in every media stream, determine that ICE processing has failed.
An agent MAY also choose to generate an "end-of-candidates" event before candidate harvesting has actually completed, if the agent determines that harvesting has continued for more than an acceptable period of time.
Once the agent sends the end-of-candidates event, it SHOULD update the state of the corresponding check list as explained in section Section 9.1
[TODO: should we also have an end-of-candidates for the entire harvesting process (as opposed to that of a single stream)]
At any point of ICE processing, a trickle ICE agent may receive new candidates from the remote agent. When this happens and no local candidates are currently known for this same stream, the new remote candidates are simply added to the list of remote candidates.
Otherwise, the new candidates are used for forming candidate pairs with the pool of local candidates.
Once the remote agent has completed candidate harvesting, it will send an "end-of-candidates" event. Upon receiving such an event, the local agent MUST update check list states as per Section 9.1. This may lead to some check lists being marked as Failed.
Trickle ICE processing SHOULD be concluded as explained in Section 8 of [RFC5245].
Trickle ICE implementations MUST behave as non-trickle and follow [RFC5245] unless they can confirm that the remote party supports this specification. [TODO: anything else?]
A typical successful trickle ICE exchange with an Offer/Answer protocol would look this way:
Alice Bob | Offer+ICE Description | |---------------------------------------------->| | Additional Candidates | |---------------------------------------------->| | | | Answer+ICE Description | |<----------------------------------------------| | Additional Candidates | |<----------------------------------------------| | | | Additional Candidates and Connectivity Checks | |<--------------------------------------------->| | | |<=============== MEDIA FLOWS =================>|
Figure 1: Example
[TODO]
The authors would like to thank Christer Holmberg and Martin Thomson for their reviews and suggestions on improving this document.
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. |
[RFC5245] | Rosenberg, J., "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols", RFC 5245, April 2010. |
At the time of writing of this document the authors have no clear view on how and if the following list of issues should be address here:
Note to the RFC-Editor: please remove this section prior to publication as an RFC.