idnits 2.17.1 draft-ietf-ice-trickle-03.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (July 20, 2016) is 2830 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) ** Obsolete normative reference: RFC 4566 (Obsoleted by RFC 8866) == Outdated reference: A later version (-18) exists of draft-ietf-mmusic-trickle-ice-sip-04 -- Obsolete informational reference (is this intentional?): RFC 5389 (Obsoleted by RFC 8489) -- Obsolete informational reference (is this intentional?): RFC 5766 (Obsoleted by RFC 8656) Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group E. Ivov 3 Internet-Draft Atlassian 4 Intended status: Standards Track E. Rescorla 5 Expires: January 21, 2017 RTFM, Inc. 6 J. Uberti 7 Google 8 P. Saint-Andre 9 Filament 10 July 20, 2016 12 Trickle ICE: Incremental Provisioning of Candidates for the Interactive 13 Connectivity Establishment (ICE) Protocol 14 draft-ietf-ice-trickle-03 16 Abstract 18 This document describes an extension to the Interactive Connectivity 19 Establishment (ICE) protocol that enables ICE agents to send and 20 receive candidates incrementally rather than exchanging complete 21 lists. With such incremental provisioning, ICE agents can begin 22 connectivity checks while they are still gathering candidates and 23 considerably shorten the time necessary for ICE processing to 24 complete. This mechanism is called "trickle ICE". 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at http://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on January 21, 2017. 43 Copyright Notice 45 Copyright (c) 2016 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (http://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 62 3. Determining Support for Trickle ICE . . . . . . . . . . . . . 5 63 4. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 6 64 5. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 6 65 5.1. Sending the Initial Answer . . . . . . . . . . . . . . . 7 66 5.2. Forming Check Lists and Beginning Connectivity 67 Checks . . . . . . . . . . . . . . . . . . . . . . . . . 7 68 6. Receiving the Initial Answer . . . . . . . . . . . . . . . . 8 69 7. Performing Connectivity Checks . . . . . . . . . . . . . . . 8 70 7.1. Scheduling Checks . . . . . . . . . . . . . . . . . . . . 8 71 7.2. Check List and Timer State Updates . . . . . . . . . . . 9 72 8. Discovering and Sending Additional Local Candidates . . . . . 9 73 8.1. Pairing Newly Learned Candidates and Updating 74 Check Lists . . . . . . . . . . . . . . . . . . . . . . . 12 75 8.2. Announcing End of Candidates . . . . . . . . . . . . . . 13 76 9. Receiving Additional Remote Candidates . . . . . . . . . . . 14 77 10. Receiving an End-Of-Candidates Notification . . . . . . . . . 15 78 11. Trickle ICE and Peer Reflexive Candidates . . . . . . . . . . 15 79 12. Concluding ICE Processing . . . . . . . . . . . . . . . . . . 15 80 13. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 15 81 14. Unilateral Use of Trickle ICE (Half Trickle) . . . . . . . . 16 82 15. Example Flow . . . . . . . . . . . . . . . . . . . . . . . . 17 83 16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 84 17. Security Considerations . . . . . . . . . . . . . . . . . . . 18 85 18. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 18 86 19. References . . . . . . . . . . . . . . . . . . . . . . . . . 18 87 19.1. Normative References . . . . . . . . . . . . . . . . . . 18 88 19.2. Informative References . . . . . . . . . . . . . . . . . 18 89 Appendix A. Interaction with ICE . . . . . . . . . . . . . . . . 20 90 Appendix B. Interaction with ICE Lite . . . . . . . . . . . . . 21 91 Appendix C. Changes from Earlier Versions . . . . . . . . . . . 22 92 C.1. Changes from draft-ietf-ice-trickle-02 . . . . . . . . . 22 93 C.2. Changes from draft-ietf-ice-trickle-01 . . . . . . . . . 22 94 C.3. Changes from draft-ietf-ice-trickle-00 . . . . . . . . . 22 95 C.4. Changes from draft-mmusic-trickle-ice-02 . . . . . . . . 23 96 C.5. Changes from draft-ivov-01 and draft-mmusic-00 . . . . . 23 97 C.6. Changes from draft-ivov-00 . . . . . . . . . . . . . . . 23 98 C.7. Changes from draft-rescorla-01 . . . . . . . . . . . . . 24 99 C.8. Changes from draft-rescorla-00 . . . . . . . . . . . . . 25 100 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 102 1. Introduction 104 The Interactive Connectivity Establishment (ICE) protocol 105 [rfc5245bis] describes mechanisms for gathering candidates, 106 prioritizing them, choosing default ones, exchanging them with the 107 remote party, pairing them, and ordering them into check lists. Once 108 all of these actions have been completed (and only then), the 109 participating agents can begin a phase of connectivity checks and 110 eventually select the pair of candidates that will be used in a media 111 session. 113 Although the sequence described above has the advantage of being 114 relatively straightforward to implement and debug once deployed, it 115 can also be rather lengthy. Candidate gathering often involves 116 things like querying STUN [RFC5389] servers, discovering UPnP 117 devices, and allocating relayed candidates at TURN [RFC5766] servers. 118 All of these actions can be delayed for a noticeable amount of time; 119 although they can be run in parallel, they still need to respect the 120 pacing requirements from [rfc5245bis], which is likely to delay them 121 even further. Some or all of these actions also need be completed by 122 the remote agent. Both agents would next perform connectivity checks 123 and only then would they be ready to begin streaming media. 125 These factors can lead to relatively lengthy session establishment 126 times and degraded user experience. 128 This document defines an alternative mode of operation for ICE 129 implementations, known as "Trickle ICE", in which candidates can be 130 exchanged incrementally. This enables ICE agents to exchange 131 candidates as soon as a session has been initiated. Connectivity 132 checks for a media stream can also start as soon as the first 133 candidates for that stream become available. 135 Trickle ICE can reduce session establishment times in cases where 136 connectivity is confirmed for the first exchanged candidates (e.g., 137 where the host candidates for one of the agents are directly 138 reachable from the second agent, such as host candidates at a media 139 relay). Even when this is not the case, running candidate gathering 140 for both agents and connectivity checks in parallel can considerably 141 shorten ICE processing times. 143 It is worth noting that there is quite a bit of operational 144 experience with the Trickle ICE technique, going back as far as 2005 145 (when the XMPP Jingle extension defined a "dribble mode" as specified 146 in [XEP-0176]); this document incorporates feedback from those who 147 have implemented and deployed the technique. 149 In addition to the basics of Trickle ICE, this document also 150 describes how to discover support for Trickle ICE, how regular ICE 151 processing needs to be modified when building and updating check 152 lists, and how Trickle ICE implementations interoperate with agents 153 that only implement so-called "Vanilla ICE" processing as defined in 154 [rfc5245bis]. 156 This specification does not define the usage of Trickle ICE with any 157 specific signalling protocol (however, see 158 [I-D.ietf-mmusic-trickle-ice-sip] for usage with SIP [RFC3261]). 159 Similarly, it does not define Trickle ICE in terms of the Session 160 Description Protocol (SDP) [RFC4566] or the offer/answer model 161 [RFC3264] because the technique can be and already is used in 162 application protocols that are not tied to SDP or to offer/answer 163 semantics. 165 2. Terminology 167 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 168 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 169 document are to be interpreted as described in [RFC2119]. 171 This specification makes use of all terminology defined for 172 Interactive Connectivity Establishment in [rfc5245bis]. 174 Vanilla ICE: The Interactive Connectivity Establishment protocol as 175 defined in [rfc5245bis]. 177 Candidate Harvester: A module used by an ICE agent to obtain local 178 candidates. Candidate gatherers use different mechanisms for 179 discovering local candidates. Some of them would typically make 180 use of protocols such as STUN or TURN. Others may also employ 181 techniques that are not referenced within [rfc5245bis] (e.g., UPnP 182 based port allocation or XMPP Jingle Relay Nodes [XEP-0278]). 184 Trickled Candidates: Candidates that a Trickle ICE agent sends after 185 an offer or answer but within the same context. Trickled 186 candidates can be sent in parallel with candidate gathering and 187 connectivity checks. 189 Trickling/Trickle (v.): The act of sending trickled candidates. 191 Half Trickle: A Trickle ICE mode of operation where the offerer 192 gathers its first generation of candidates strictly before 193 creating and sending the offer. Once sent, that offer can be 194 processed by Vanilla ICE agents and does not require support for 195 this specification. It also allows Trickle ICE capable answerers 196 to still gather candidates and perform connectivity checks in a 197 non-blocking way, thus roughly offering "half" the advantages of 198 Trickle ICE. The mechanism is mostly meant for use in cases where 199 support for trickle ICE cannot be confirmed prior to sending a 200 initial offer. 202 Full Trickle: The regular mode of operation for Trickle ICE agents, 203 in which an initial offer can include any number of candidates 204 (even zero candidates) and does not need to include the entire 205 first generation of candidates as in half trickle. 207 3. Determining Support for Trickle ICE 209 Application protocols that use Trickle ICE should do one of the 210 following: 212 o Provide a way for agents to verify support of Trickle ICE prior to 213 initiating a session (XMPP's Service Discovery [XEP-0030] is one 214 such mechanism). 216 o Make support for Trickle ICE mandatory so that user agents can 217 assume support. 219 Alternately, for cases where a protocol provides neither of the 220 foregoing methods, agents may rely on provisioning/configuration or 221 use the half trickle procedure described in Section 14. 223 Prior to sending an initial offer, agents using signaling protocols 224 that support capabilities discovery can attempt to verify whether or 225 not the remote party supports Trickle ICE. If an agent determines 226 that the remote party does not support Trickle ICE, it MUST fall back 227 to using Vanilla ICE or abandon the entire session. 229 In application protocols that use SDP, a user agent supporting 230 Trickle ICE MUST include a token of "trickle" in the ice-options 231 attribute every time it generates an offer or an answer. This 232 enables an agent that receives offers or answers to verify support by 233 checking for presence of the token. 235 Dedicated discovery semantics and half trickle are needed only prior 236 to session initiation (e.g., when sending the initial offer). After 237 a session is established and Trickle ICE support is confirmed for 238 both parties, either agent can use full trickle for subsequent 239 offers. 241 4. Sending the Initial Offer 243 An agent starts gathering candidates as soon as it has an indication 244 that communication is imminent (e.g., a user interface cue or an 245 explicit request to initiate a session). Contrary to Vanilla ICE, 246 implementations of Trickle ICE do not need to gather candidates in a 247 blocking manner. Therefore, unless half trickle is being used, 248 agents SHOULD generate and transmit their initial offer as early as 249 possible, in order to allow the remote party to start gathering and 250 trickling candidates. 252 Trickle ICE agents MAY include any set of candidates in an offer. 253 This includes the possibility of sending an offer that contains all 254 the candidates that the agent plans to use (as in half trickle mode), 255 sending an offer that contains only a publically-reachable IP address 256 (e.g., a host candidate at a media relay that is known to not be 257 behind a firewall), or sending an offer with no candidates at all (in 258 which case the offerer can receive the answerer's initial candidate 259 list sooner and the answerer can begin candidate gathering more 260 quickly). 262 For optimal performance, it is RECOMMENDED that the candidates in an 263 initial offer (if any) be host candidates only. This would allow 264 both agents to start gathering server reflexive, relayed, and other 265 non-host candidates simultaneously, and it would also enable them to 266 begin connectivity checks. 268 If the privacy implications of revealing host addresses on an 269 endpoint device are a concern, agents can generate an offer that 270 contains no candidates and then only trickle candidates that do not 271 reveal host addresses (e.g., relayed candidates). 273 Methods for calculating priorities and foundations, as well as 274 determining redundancy of candidates, work just as with vanilla ICE. 276 5. Receiving the Initial Offer 278 When an agent receives an initial offer, it will first check if the 279 offer or offerer indicates support for Trickle ICE as explained in 280 Section 3. If this is not the case, the agent MUST process the offer 281 according to Vanilla ICE procedures [rfc5245bis] or offer/answer 282 processing rules [RFC3264] if no ICE support is detected at all. 284 If support for Trickle ICE is confirmed, an agent will automatically 285 assume support for Vanilla ICE as well even if the support 286 verification procedure in [rfc5245bis] indicates otherwise. 287 Specifically, the rules from [rfc5245bis] would imply that ICE itself 288 is not supported if the initial offer includes no candidates in the 289 offer; however, such a conclusion is not warranted if the answerer 290 can confirm that the offerer supports Trickle ICE and thus fallback 291 to [RFC3264] is not necessary. 293 If the offer does indicate support for Trickle ICE, the agent will 294 determine its role, start gathering and prioritizing candidates and 295 while doing so it will also respond by sending its own answer, so 296 that both agents can start forming check lists and begin connectivity 297 checks. 299 5.1. Sending the Initial Answer 301 An agent can respond to an initial offer at any point while gathering 302 candidates. The answer can again contain any set of candidates, 303 including all candidates or no candidates. (The benefit of including 304 no candidates is to send the answer as quickly as possible, so that 305 both parties can consider the overall session to be under active 306 negotiation as soon as possible.) Unless the answering agent is 307 protecting host addresses for privacy reasons, it would typically 308 construct this initial answer including only host addresses, thus 309 enabling the remote party to also start forming check lists and 310 performing connectivity checks. 312 In application protocols that use SDP, the answer MUST indicate 313 support for Trickle ICE as described in Section 3. 315 5.2. Forming Check Lists and Beginning Connectivity Checks 317 After exchanging the offer and answer, and as soon as they have 318 obtained local and remote candidates, agents begin forming candidate 319 pairs, computing candidate pair priorities and ordering candidate 320 pairs, pruning duplicate pairs, and creating check lists according to 321 the Vanilla ICE procedures described in [rfc5245bis]. 323 According to those procedures, in order for candidate pairing to be 324 possible and for duplicate candidates to be pruned, the candidates 325 would need to be provided in both the offer and the answer. Under 326 Trickle ICE, check lists can be empty until candidate pairs are sent 327 or received. Therefore Trickle ICE agents handle check lists and 328 candidate pairing in a slightly different way: the agents still 329 create the check lists, but they only populate the check lists after 330 they actually have the candidate pairs. 332 Note: According to [rfc5245bis], "A check list with at least one 333 pair that is Waiting is called an active check list, and a check 334 list with all pairs Frozen is called a frozen check list." 335 Formally speaking an active check list does not have a state of 336 Active and a frozen check list does not have a state of Frozen, 337 because the only check list states are Running, Completed, and 338 Failed. 340 A Trickle ICE agent initially considers all check lists to be frozen. 341 It then inspects the first check list and attempts to unfreeze all 342 candidates it has received so far that belong to the first component 343 on the first media stream (i.e., the first media stream that was 344 reported to the ICE implementation from the using application). If 345 that first component of the first media stream does not contain 346 candidates for one or more of the currently known pair foundations, 347 and if candidate pairs already exist for that foundation in one of 348 the following components or media streams, then the agent unfreezes 349 the first of those. 351 With regard to pruning of duplicate candidate pairs, a Trickle ICE 352 agent SHOULD follow a policy of "first one wins" and not re-apply the 353 pruning procedure if a higher-priority candidate pair is received 354 from the remote agent. 356 Respecting the order in which check lists have been reported to an 357 ICE implementation is crucial to the frozen candidates algorithm, so 358 that connectivity checks are performed simultaneously by both agents. 360 6. Receiving the Initial Answer 362 When receiving an answer, agents follow Vanilla ICE procedures to 363 determine their role, after which they form check lists (as described 364 in Section 5.2) and begin connectivity checks. 366 7. Performing Connectivity Checks 368 For the most part, Trickle ICE agents perform connectivity checks 369 following Vanilla ICE procedures. However, the asynchronous nature 370 of gathering and communicating candidates in Trickle ICE impose a 371 number of changes described as described in the following sections. 373 7.1. Scheduling Checks 375 The ICE specification [rfc5245bis], Section 5.8, requires that agents 376 terminate the timer for a triggered check in relation to an active 377 check list once the agent has exhausted all frozen pairs in check 378 list. This will not work with Trickle ICE, because more pairs will 379 be added to the check list incrementally. 381 Therefore, a Trickle ICE agent SHOULD NOT terminate the timer until 382 the state of the check list is Completed or Failed as specified 383 herein (see Section 8.2). 385 7.2. Check List and Timer State Updates 387 The ICE specification [rfc5245bis], Section 7.1.3.3, requires that 388 agents update check lists and timer states upon completing a 389 connectivity check transaction. During such an update, Vanilla ICE 390 agents would set the state of a check list to Failed if both of the 391 following two conditions are satisfied: 393 o all of the pairs in the check list are either in the Failed or 394 Succeeded state; and 396 o there is not a pair in the valid list for each component of the 397 media stream. 399 With Trickle ICE, the above situation would often occur when 400 candidate gathering and trickling are still in progress, even though 401 it is quite possible that future checks will succeed. For this 402 reason, Trickle ICE agents add the following conditions to the above 403 list: 405 o all candidate gatherers have completed and the agent is not 406 expecting to discover any new local candidates; 408 o the remote agent has sent an end-of-candidates indication for that 409 check list as described in Section 8.2. 411 Vanilla ICE requires that agents then update all other check lists, 412 placing one pair from each of them into the Waiting state, 413 effectively unfreezing all remaining check lists. However, under 414 Trickle ICE other check lists might still be empty at that point. 415 Therefore a Trickle ICE agent SHOULD monitor whether a check list is 416 active or frozen independently of the state of the candidate pairs 417 that the check list contains. A Trickle ICE agent SHOULD consider a 418 check list to be active either when unfreezing the first candidate 419 pair in the check list or when there is no candidate pair in the 420 check list (i.e., when the check list is empty). 422 8. Discovering and Sending Additional Local Candidates 424 After an offer or an answer has been sent, agents will most likely 425 continue discovering new local candidates as STUN, TURN, and other 426 non-host candidate gathering mechanisms begin to yield results. 427 Whenever an agent discovers such a new candidate it will compute its 428 priority, type, foundation and component ID according to normal 429 Vanilla ICE procedures. 431 The new candidate is then checked for redundancy against the existing 432 list of local candidates. If its transport address and base match 433 those of an existing candidate, it will be considered redundant and 434 will be ignored. This would often happen for server reflexive 435 candidates that match the host addresses they were obtained from 436 (e.g., when the latter are public IPv4 addresses). Contrary to 437 Vanilla ICE, Trickle ICE agents will consider the new candidate 438 redundant regardless of its priority. 440 Next the agent sends (i.e., trickles) the newly discovered 441 candidate(s) to the remote agent. The actual delivery of the new 442 candidates are specified by using protocols such as SIP or XMPP. 443 Trickle ICE imposes no restrictions on the way this is done or 444 whether it is done at all. For example, some applications may choose 445 not to send trickle updates for server reflexive candidates and rely 446 on the discovery of peer reflexive ones instead. 448 When trickle updates are sent, each candidate MUST be delivered to 449 the receiving Trickle ICE implementation not more than once and in 450 the same order that they were sent. In other words, if there are any 451 candidate retransmissions, they must be hidden from the ICE 452 implementation. 454 Also, candidate trickling needs to be correlated to a specific ICE 455 negotiation session, so that if there is an ICE restart, any delayed 456 updates for a previous session can be recognized as such and ignored 457 by the receiving party. For example, applications that choose to 458 signal candidates via SDP may include a ufrag value in the SDP that 459 represents candidates such as: 461 a=candidate:1 1 UDP 2130706431 2001:db8::1 5000 typ host ufrag 8hhY 463 Or as another exmaple, WebRTC implementations may include a ufrag in 464 the JavaScript objects that represent candidates. 466 One important aspect of Vanilla ICE is that connectivity checks for a 467 specific foundation and component are attempted simultaneously by 468 both agents, so that any firewalls or NATs fronting the agents would 469 whitelist both endpoints and allow all except for the first 470 ("suicide") packets to go through. This is also crucial to 471 unfreezing candidates in the right time. 473 In order to preserve this feature in Trickle ICE, when trickling 474 candidates agents MUST respect the order of the components as they 475 appear (implicitly or explicitly) in the offer/answer descriptions. 476 Therefore a candidate for a specific component MUST NOT be sent prior 477 to candidates for other components within the same foundation. 479 For example, the following SDP description contains two components 480 (RTP and RTCP) and two foundations (host and server reflexive): 482 v=0 483 o=jdoe 2890844526 2890842807 IN IP6 2001:db8:a0b:12f0::1 484 s= 485 c=IN IP4 2001:db8:a0b:12f0::1 486 t=0 0 487 a=ice-pwd:asd88fgpdd777uzjYhagZg 488 a=ice-ufrag:8hhY 489 m=audio 5000 RTP/AVP 0 490 a=rtpmap:0 PCMU/8000 491 a=candidate:1 1 UDP 2130706431 2001:db8:a0b:12f0::1 5000 typ host 492 a=candidate:1 2 UDP 2130706431 2001:db8:a0b:12f0::1 5001 typ host 493 a=candidate:2 1 UDP 1694498815 2001:db8:a0b:12f0::3 5000 typ srflx 494 raddr 2001:db8:a0b:12f0::1 rport 8998 495 a=candidate:2 2 UDP 1694498815 2001:db8:a0b:12f0::3 5001 typ srflx 496 raddr 2001:db8:a0b:12f0::1 rport 8998 498 For this description the RTCP host candidate MUST NOT be sent prior 499 to the RTP host candidate. Similarly the RTP server reflexive 500 candidate MUST be sent together with or prior to the RTCP server 501 reflexive candidate. 503 Note that the order restriction only applies among candidates that 504 belong to the same foundation. 506 It is also equally important to preserve this order across media 507 streams, which is covered by the requirement to always start 508 unfreezing candidates starting from the first media stream as 509 described under Section 5.2. 511 Once the candidate has been sent to the remote party, the agent 512 checks if any remote candidates are currently known for this same 513 stream. If not, the new candidate will simply be added to the list 514 of local candidates. 516 Otherwise, if the agent has already learned of one or more remote 517 candidates for this stream and component, it will begin pairing the 518 new local candidates with them and adding the pairs to the existing 519 check lists according to their priority. 521 8.1. Pairing Newly Learned Candidates and Updating Check Lists 523 Forming candidate pairs works the way it is described by the ICE 524 specification [rfc5245bis]. However, actually adding the new pair to 525 a check list happens according to the rules described below. 527 If the check list where the pair is to be added already contains the 528 maximum number of candidate pairs (100 by default as per 529 [rfc5245bis]), the new pair is discarded. 531 If the new pair's local candidate is server reflexive, the server 532 reflexive candidate MUST be replaced by its base before adding the 533 pair to the list. 535 Once this is done, the agent examines the check list looking for 536 another pair that would be redundant with the new one. If such a 537 pair exists and its type is not peer reflexive, the pair with the 538 higher priority is kept and the one with the lower priority is 539 discarded. If, on the other hand, the type of the pre-existing pair 540 is peer reflexive, the agent MUST replace it with the new candidate 541 it received, regardless of their priorities. 543 Note: Replacing pre-existing pairs with seemingly equivalent 544 higher-priority ones helps guarantee that both agents will have 545 the same view of candidate priorities. This is particularly 546 important during aggressive nomination, when priority is sometimes 547 the only way a controlled agent can determine the selected pair. 548 It is for that same reason that peer-reflexive candidates need to 549 always be updated if equivalent alternatives are received through 550 signalling. 552 For all other pairs, including those with a server reflexive local 553 candidate that were not found to be redundant: 555 o if this check list is frozen then the new pair will be assigned a 556 state of Frozen. 558 o else if the check list is active and it is either empty or 559 contains only candidates in the Succeeded and Failed states, then 560 the new pair's state is set to Waiting. 562 o else if the check list is non-empty and active, then the state of 563 the new pair will be set to 564 Frozen: if there is at least one pair in the check list whose 565 foundation matches the one in the new pair and whose state is 566 neither Succeeded nor Failed (eventually the new pair will get 567 unfrozen after the ongoing check for the existing pair 568 concludes); 570 Waiting: if the list contains no pairs with the same foundation 571 as the new one, or, in case such pairs exist but they are all 572 in either the Succeeded or Failed states. 574 8.2. Announcing End of Candidates 576 Once all candidate gathering is completed or expires for a specific 577 media stream, the agents will generate an "end-of-candidates" 578 indication for that stream and send it to the remote agent via the 579 signalling channel. The exact form of the indication depends on the 580 application protocol. The indication can be sent in the following 581 ways: 583 o As part of an offer (which would typically be the case with half 584 trickle initial offers) 586 o Along with the last candidate an agent can send for a stream 588 o As a standalone notification (e.g., after STUN Binding requests or 589 TURN Allocate requests to a server timeout and the agent has no 590 other active gatherers) 592 A controlled Trickle ICE agent SHOULD send end-of-candidates 593 indications after gathering for a media stream has completed, unless 594 ICE processing terminates before the agent has had a chance to do so. 595 Sending the indication is necessary in order to avoid ambiguities and 596 speed up the conclusion of ICE processing. On the other hand, a 597 controlling agent MAY conclude ICE processing prior to sending end- 598 of-candidates indications for all streams. This would typically be 599 the case with aggressive nomination. However, it is RECOMMENDED that 600 controlling agents do send such indications whenever possible for the 601 sake of consistency and to keep middle boxes and controlled agents 602 up-to-date on the state of ICE processing. 604 When sending an end-of-candidate indication during trickling (rather 605 than as a part of an offer or an answer), it is the responsibility of 606 the using protocol to define methods for relating the indication to 607 one or more specific media streams. 609 Receiving an end-of-candidates indication enables an agent to update 610 check list states and, in case valid pairs do not exist for every 611 component in every media stream, determine that ICE processing has 612 failed. It also enables agents to speed up the conclusion of ICE 613 processing when a candidate pair has been validated but it involves 614 the use of lower-preference transports such as TURN. In such 615 situations, an implementations may choose to wait and see if higher- 616 priority candidates are received; in this case the end-of-candidates 617 indication provides a notificaiton that such candidates are not 618 forthcoming. 620 An agent MAY also choose to generate an end-of-candidates indication 621 before candidate gathering has actually completed, if the agent 622 determines that gathering has continued for more than an acceptable 623 period of time. However, an agent MUST NOT send any more candidates 624 after it has send an end-of-candidates indication. 626 When performing half trickle, an agent SHOULD send an end-of- 627 candidates indication together with its initial offer unless it is 628 planning to potentially send additional candidates (e.g., in case the 629 remote party turns out to support Trickle ICE). 631 When an end-of-candidates indication is sent as part of an offer or 632 an answer, it can be considered to apply to the session as a whole, 633 which is equivalent to having it apply to all media streams. 635 After an agent sends the end-of-candidates indication, it will update 636 the state of the corresponding check list as explained in 637 Section 7.2. Past that point, an agent MUST NOT send any new 638 candidates within this ICE session. After an agent has received an 639 end-of-candidates indication, it MUST also ignore any newly received 640 candidates for that media stream or media session. Therefore, adding 641 new candidates to the negotiation is possible only through an ICE 642 restart. 644 This specification does not override Vanilla ICE semantics for 645 concluding ICE processing. Therefore even if end-of-candidates 646 indications are sent agents will still have to go through pair 647 nomination. Also, if pairs have been nominated for components and 648 media streams, ICE processing will still conclude even if end-of- 649 candidate indications have not been received for all streams. 651 9. Receiving Additional Remote Candidates 653 At any point of ICE processing, a Trickle ICE agent may receive new 654 candidates from the remote agent. When this happens and no local 655 candidates are currently known for this same stream, the new remote 656 candidates are simply added to the list of remote candidates. 658 Otherwise, the new candidates are used for forming candidate pairs 659 with the pool of local candidates and they are added to the local 660 check lists as described in Section 8.1. 662 Once the remote agent has completed candidate gathering, it will send 663 an end-of-candidates indication. Upon receiving such an indication, 664 the local agent MUST update check list states as per Section 7.2. 665 This may lead to some check lists being marked as Failed. 667 10. Receiving an End-Of-Candidates Notification 669 When an agent receives an end-of-candidates indication for a specific 670 check list, it will update the state of the check list as per 671 Section 7.2. If the check list is still active state after the 672 update, the agent will persist the the fact that an end-of-candidates 673 indication has been received and take it into account in future 674 updates to the check list. 676 11. Trickle ICE and Peer Reflexive Candidates 678 Even though Trickle ICE does not explicitly modify the procedures for 679 handling peer reflexive candidates, their processing could be 680 impacted in implementations. With Trickle ICE, it is possible that 681 server reflexive candidates can be discovered as peer reflexive in 682 cases where incoming connectivity checks are received from these 683 candidates before the trickle updates that carry them. 685 While this would certainly increase the number of cases where ICE 686 processing nominates and selects candidates discovered as peer- 687 reflexive, it does not require any change in processing. 689 It is also likely that some applications would prefer not to trickle 690 server reflexive candidates to entities that are known to be publicly 691 accessible and where sending a direct STUN binding request is likely 692 to reach the destination faster than the trickle update that travels 693 through the signalling path. 695 12. Concluding ICE Processing 697 This specification does not directly modify the procedures ending ICE 698 processing described in Section 8 of [rfc5245bis], and Trickle ICE 699 implementations will follow the same rules. 701 13. Subsequent Offer/Answer Exchanges 703 Either agent MAY generate a subsequent offer at any time allowed by 704 [RFC3264]. When this happens agents will use [rfc5245bis] semantics 705 to determine whether or not the new offer requires an ICE restart. 707 If this is the case then agents would perform Trickle ICE as they 708 would in an initial offer/answer exchange. 710 The only differences between an ICE restart and a brand new media 711 session are that: 713 o during the restart, media can continue to be sent to the 714 previously validated pair. 716 o both agents are already aware whether or not their peer supports 717 Trickle ICE, and there is no longer need for performing half 718 trickle or confirming support with other mechanisms. 720 14. Unilateral Use of Trickle ICE (Half Trickle) 722 In half trickle mode, the offerer sends a regular, Vanilla ICE offer, 723 with a complete set of candidates. This ensures that the offer can 724 be processed by a Vanilla ICE answerer and is mostly meant for use in 725 cases where support for Trickle ICE cannot be confirmed prior to 726 sending an initial offer. The initial offer indicates support for 727 Trickle ICE, so that the answerer can respond with an incomplete set 728 of candidates and continue trickling the rest. Half trickle offers 729 typically contain an end-of-candidates indication, although this is 730 not mandatory because if trickle support is confirmed then the 731 offerer can choose to trickle additional candidates before it sends 732 an end-of-candidates indication. 734 The half trickle mechanism can be used in cases where there is no way 735 for an agent to verify in advance whether a remote party supports 736 Trickle ICE. Because the initial offer contains a full set of 737 candidates, it can thus be handled by a regular Vanilla ICE agent, 738 while still allowing a Trickle ICE agent to use the optimization 739 defined in this specification. This prevents negotiation from 740 failing in the former case while still giving roughly half the 741 Trickle ICE benefits in the latter (hence the name of the mechanism). 743 Use of half trickle is only necessary during an initial offer/answer 744 exchange. After both parties have received a session description 745 from their peer, they can each reliably determine Trickle ICE support 746 and use it for all subsequent offer/answer exchanges. 748 In some instances, using half trickle might bring more than just half 749 the improvement in terms of user experience. This can happen when an 750 agent starts gathering candidates upon user interface cues that the 751 user will soon be initiating an offer, such as activity on a keypad 752 or the phone going off hook. This would mean that some or all of the 753 candidate gathering could be completed before the agent actually 754 needs to send the offer. Because the answerer will be able to 755 trickle candidates, both agents will be able to start connectivity 756 checks and complete ICE processing earlier than with Vanilla ICE and 757 potentially even as early as with full trickle. 759 However, such anticipation is not always possible. For example, a 760 multipurpose user agent or a WebRTC web page where communication is a 761 non-central feature (e.g., calling a support line in case of a 762 problem with the main features) would not necessarily have a way of 763 distinguishing between call intentions and other user activity. In 764 such cases, using full trickle is most likely to result in an ideal 765 user experience. Even so, using half trickle would be an improvement 766 over vanilla ICE because it would result in a better experience for 767 answerers. 769 15. Example Flow 771 A typical successful Trickle ICE exchange with an Offer/Answer 772 protocol would look this way: 774 Alice Bob 775 | Offer | 776 |---------------------------------------------->| 777 | Additional Candidates | 778 |---------------------------------------------->| 779 | | 780 | Answer | 781 |<----------------------------------------------| 782 | Additional Candidates | 783 |<----------------------------------------------| 784 | | 785 | Additional Candidates and Connectivity Checks | 786 |<--------------------------------------------->| 787 | | 788 |<=============== MEDIA FLOWS =================>| 790 Figure 1: Example 792 16. IANA Considerations 794 This specification requests no actions from IANA. 796 17. Security Considerations 798 This specification inherits most of its semantics from [rfc5245bis] 799 and as a result all security considerations described there remain 800 the same. 802 18. Acknowledgements 804 The authors would like to thank Taylor Brandstetter for identifying 805 the need to replace pre-existing peer-reflexive candidates with 806 higher-priority ones received from trickling and the fact that not 807 doing so could break aggressive nomination. 809 The authors would also like to thank Bernard Aboba, Flemming 810 Andreasen, Rajmohan Banavi, Christer Holmberg, Jonathan Lennox, 811 Enrico Marocco, Pal Martinsen, Martin Thomson, Dale R. Worley, and 812 Brandon Williams for their reviews and suggestions on improving this 813 document. 815 19. References 817 19.1. Normative References 819 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 820 Requirement Levels", BCP 14, RFC 2119, 821 DOI 10.17487/RFC2119, March 1997, 822 . 824 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 825 with Session Description Protocol (SDP)", RFC 3264, 826 DOI 10.17487/RFC3264, June 2002, 827 . 829 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 830 Description Protocol", RFC 4566, DOI 10.17487/RFC4566, 831 July 2006, . 833 [rfc5245bis] 834 Keranen, A. and J. Rosenberg, "Interactive Connectivity 835 Establishment (ICE): A Protocol for Network Address 836 Translator (NAT) Traversal", draft-ietf-ice-rfc5245bis-00 837 (work in progress), October 2015. 839 19.2. Informative References 841 [I-D.ietf-mmusic-trickle-ice-sip] 842 Ivov, E., Thomas, T., Marocco, E., and C. Holmberg, "A 843 Session Initiation Protocol (SIP) usage for Trickle ICE", 844 draft-ietf-mmusic-trickle-ice-sip-04 (work in progress), 845 May 2016. 847 [RFC1918] Rekhter, Y., Moskowitz, B., Karrenberg, D., de Groot, G., 848 and E. Lear, "Address Allocation for Private Internets", 849 BCP 5, RFC 1918, DOI 10.17487/RFC1918, February 1996, 850 . 852 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 853 A., Peterson, J., Sparks, R., Handley, M., and E. 854 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 855 DOI 10.17487/RFC3261, June 2002, 856 . 858 [RFC4787] Audet, F., Ed. and C. Jennings, "Network Address 859 Translation (NAT) Behavioral Requirements for Unicast 860 UDP", BCP 127, RFC 4787, DOI 10.17487/RFC4787, January 861 2007, . 863 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 864 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 865 DOI 10.17487/RFC5389, October 2008, 866 . 868 [RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using 869 Relays around NAT (TURN): Relay Extensions to Session 870 Traversal Utilities for NAT (STUN)", RFC 5766, 871 DOI 10.17487/RFC5766, April 2010, 872 . 874 [XEP-0030] 875 Hildebrand, J., Millard, P., Eatmon, R., and P. Saint- 876 Andre, "XEP-0030: Service Discovery", XEP XEP-0030, June 877 2008. 879 [XEP-0176] 880 Beda, J., Ludwig, S., Saint-Andre, P., Hildebrand, J., 881 Egan, S., and R. McQueen, "XEP-0176: Jingle ICE-UDP 882 Transport Method", XEP XEP-0176, June 2009. 884 [XEP-0278] 885 Camargo, T., "XEP-0278: Jingle Relay Nodes", XEP XEP-0278, 886 June 2011. 888 Appendix A. Interaction with ICE 890 The ICE protocol was designed to be flexible enough to work in and 891 adapt to as many network environments as possible. Despite that 892 flexibility, ICE as specified in [rfc5245bis] does not by itself 893 support trickle ICE. This section describes how trickling of 894 candidates interacts with ICE. 896 [rfc5245bis] describes the conditions required to update check lists 897 and timer states while an ICE agent is in the Running state. These 898 conditions are verified upon transaction completion and one of them 899 stipulates that: 901 If there is not a pair in the valid list for each component of the 902 media stream, the state of the check list is set to Failed. 904 This could be a problem and cause ICE processing to fail prematurely 905 in a number of scenarios. Consider the following case: 907 1. Alice and Bob are both located in different networks with Network 908 Address Translation (NAT). Alice and Bob themselves have 909 different address but both networks use the same [RFC1918] block. 911 2. Alice sends Bob the candidate 2001:db8:a0b:12f0::10 which also 912 happens to correspond to an existing host on Bob's network. 914 3. Bob creates a check list consisting solely of 915 2001:db8:a0b:12f0::10 and starts checks. 917 4. These checks reach the host at 2001:db8:a0b:12f0::10 in Bob's 918 network, which responds with an ICMP "port unreachable" error and 919 per [rfc5245bis] Bob marks the transaction as Failed. 921 At this point the check list only contains Failed candidates and the 922 valid list is empty. This causes the media stream and potentially 923 all ICE processing to Fail. 925 A similar race condition would occur if the initial offer from Alice 926 only contains candidates that can be determined as unreachable from 927 any of the candidates that Bob has gathered (e.g., this would be the 928 case if Bob's candidates only contain IPv4 addresses and the first 929 candidate that he receives from Alice is an IPv6 one). 931 Another potential problem could arise when a non-trickle ICE 932 implementation sends an offer to a trickle one. Consider the 933 following case: 935 1. Alice's client has a non-Trickle ICE implementation 936 2. Bob's client has support for Trickle ICE. 938 3. Alice and Bob are behind NATs with address-dependent filtering 939 [RFC4787]. 941 4. Bob has two STUN servers but one of them is currently unreachable 943 After Bob's agent receives Alice's offer it would immediately start 944 connectivity checks. It would also start gathering candidates, which 945 would take a long time because of the unreachable STUN server. By 946 the time Bob's answer is ready and sent to Alice, Bob's connectivity 947 checks may well have failed: until Alice gets Bob's answer, she won't 948 be able to start connectivity checks and punch holes in her NAT. The 949 NAT would hence be filtering Bob's checks as originating from an 950 unknown endpoint. 952 Appendix B. Interaction with ICE Lite 954 The behavior of ICE lite agents that are capable of Trickle ICE does 955 not require any particular rules other than those already defined in 956 this specification and [rfc5245bis]. This section is hence provided 957 only for informational purposes. 959 Such an agent would generate offers or answers as per [rfc5245bis]. 960 Both its offers and answers will indicate support for Trickle ICE. 961 Given that they will contain a complete set of candidates (the 962 agent's host candidates), these offers and answers would also be 963 accompanied with an end-of-candidates indication. 965 When performing full trickle, a full ICE implementation could send an 966 offer or an answer with no candidates. After receiving an answer 967 that identifies the remote agent as an ICE lite implementation, the 968 offerer may choose to not send any additional candidates. The same 969 is also true in the case when the ICE lite agent is making the offer 970 and the full ICE one is answering. In these cases the connectivity 971 checks would be enough for the ICE lite implementation to discover 972 all potentially useful candidates as peer reflexive. The following 973 example illustrates one such ICE session using SDP syntax: 975 ICE Lite Bob 976 Agent 977 | Offer (a=ice-lite a=ice-options:trickle) | 978 |---------------------------------------------->| 979 | |no cand 980 | Answer (a=ice-options:trickle) |trickling 981 |<----------------------------------------------| 982 | Connectivity Checks | 983 |<--------------------------------------------->| 984 peer rflx| | 985 cand disco| | 986 | | 987 |<=============== MEDIA FLOWS =================>| 989 Figure 2: Example 991 In addition to reducing signaling traffic this approach also removes 992 the need to discover STUN bindings, or to make TURN or UPnP 993 allocations, which may considerably lighten ICE processing. 995 Appendix C. Changes from Earlier Versions 997 Note to the RFC-Editor: please remove this section prior to 998 publication as an RFC. 1000 C.1. Changes from draft-ietf-ice-trickle-02 1002 o Adjusted unfreezing behavior when there are disparate foundations. 1004 C.2. Changes from draft-ietf-ice-trickle-01 1006 o Changed examples to use IPv6. 1008 C.3. Changes from draft-ietf-ice-trickle-00 1010 o Removed dependency on SDP (which is to be provided in a separate 1011 specification). 1013 o Clarified text about the fact that a check list can be empty if no 1014 candidates have been sent or received yet. 1016 o Clarified wording about check list states so as not to define new 1017 states for "Active" and "Frozen" because those states are not 1018 defined for check lists (only for candidate pairs) in ICE core. 1020 o Removed open issues list because it was out of date. 1022 o Completed a thorough copy edit. 1024 C.4. Changes from draft-mmusic-trickle-ice-02 1026 o Addressed feedback from Rajmohan Banavi and Brandon Williams. 1028 o Clarified text about determining support and about how to proceed 1029 if it can be determined that the answering agent does not support 1030 Trickle ICE. 1032 o Clarified text about check list and timer updates. 1034 o Clarified when it is appropriate to use half trickle or to send no 1035 candidates in an offer or answer. 1037 o Updated the list of open issues. 1039 C.5. Changes from draft-ivov-01 and draft-mmusic-00 1041 o Added a requirement to trickle candidates by order of components 1042 to avoid deadlocks in the unfreezing algorithm. 1044 o Added an informative note on peer-reflexive candidates explaining 1045 that nothing changes for them semantically but they do become a 1046 more likely occurrence for Trickle ICE. 1048 o Limit the number of pairs to 100 to comply with 5245. 1050 o Added clarifications on the non-importance of how newly discovered 1051 candidates are trickled/sent to the remote party or if this is 1052 done at all. 1054 o Added transport expectations for trickled candidates as per Dale 1055 Worley's recommendation. 1057 C.6. Changes from draft-ivov-00 1059 o Specified that end-of-candidates is a media level attribute which 1060 can of course appear as session level, which is equivalent to 1061 having it appear in all m-lines. Also made end-of-candidates 1062 optional for cases such as aggressive nomination for controlled 1063 agents. 1065 o Added an example for ICE lite and Trickle ICE to illustrate how, 1066 when talking to an ICE lite agent doesn't need to send or even 1067 discover any candidates. 1069 o Added an example for ICE lite and Trickle ICE to illustrate how, 1070 when talking to an ICE lite agent doesn't need to send or even 1071 discover any candidates. 1073 o Added wording that explicitly states ICE lite agents have to be 1074 prepared to receive no candidates over signalling and that they 1075 should not freak out if this happens. (Closed the corresponding 1076 open issue). 1078 o It is now mandatory to use MID when trickling candidates and using 1079 m-line indexes is no longer allowed. 1081 o Replaced use of 0.0.0.0 to IP6 :: in order to avoid potential 1082 issues with RFC2543 SDP libraries that interpret 0.0.0.0 as an on- 1083 hold operation. Also changed the port number here from 1 to 9 1084 since it already has a more appropriate meaning. (Port change 1085 suggested by Jonathan Lennox). 1087 o Closed the Open Issue about use about what to do with cands 1088 received after end-of-cands. Solution: ignore, do an ICE restart 1089 if you want to add something. 1091 o Added more terminology, including trickling, trickled candidates, 1092 half trickle, full trickle, 1094 o Added a reference to the SIP usage for Trickle ICE as requested at 1095 the Boston interim. 1097 C.7. Changes from draft-rescorla-01 1099 o Brought back explicit use of Offer/Answer. There are no more 1100 attempts to try to do this in an O/A independent way. Also 1101 removed the use of ICE Descriptions. 1103 o Added SDP specification for trickled candidates, the trickle 1104 option and 0.0.0.0 addresses in m-lines, and end-of-candidates. 1106 o Support and Discovery. Changed that section to be less abstract. 1107 As discussed in IETF85, the draft now says implementations and 1108 usages need to either determine support in advance and directly 1109 use trickle, or do half trickle. Removed suggestion about use of 1110 discovery in SIP or about letting implementing protocols do what 1111 they want. 1113 o Defined Half Trickle. Added a section that says how it works. 1114 Mentioned that it only needs to happen in the first o/a (not 1115 necessary in updates), and added Jonathan's comment about how it 1116 could, in some cases, offer more than half the improvement if you 1117 can pre-gather part or all of your candidates before the user 1118 actually presses the call button. 1120 o Added a short section about subsequent offer/answer exchanges. 1122 o Added a short section about interactions with ICE Lite 1123 implementations. 1125 o Added two new entries to the open issues section. 1127 C.8. Changes from draft-rescorla-00 1129 o Relaxed requirements about verifying support following a 1130 discussion on MMUSIC. 1132 o Introduced ICE descriptions in order to remove ambiguous use of 1133 3264 language and inappropriate references to offers and answers. 1135 o Removed inappropriate assumption of adoption by RTCWEB pointed out 1136 by Martin Thomson. 1138 Authors' Addresses 1140 Emil Ivov 1141 Atlassian 1142 303 Colorado St#1600 1143 Austin 78701 1144 USA 1146 Phone: +1-512-640-3000 1147 Email: eivov@atlassian.com 1149 Eric Rescorla 1150 RTFM, Inc. 1151 2064 Edgewood Drive 1152 Palo Alto, CA 94303 1153 USA 1155 Phone: +1 650 678 2350 1156 Email: ekr@rtfm.com 1157 Justin Uberti 1158 Google 1159 747 6th St S 1160 Kirkland, WA 98033 1161 USA 1163 Phone: +1 857 288 8888 1164 Email: justin@uberti.name 1166 Peter Saint-Andre 1167 Filament 1169 Email: peter@filament.com 1170 URI: https://filament.com/