draft-ietf-mmusic-ice-11.txt   draft-ietf-mmusic-ice-12.txt 
MMUSIC J. Rosenberg MMUSIC J. Rosenberg
Internet-Draft Cisco Systems Internet-Draft Cisco Systems
Expires: April 9, 2007 October 6, 2006 Expires: April 26, 2007 October 23, 2006
Interactive Connectivity Establishment (ICE): A Methodology for Network Interactive Connectivity Establishment (ICE): A Methodology for Network
Address Translator (NAT) Traversal for Offer/Answer Protocols Address Translator (NAT) Traversal for Offer/Answer Protocols
draft-ietf-mmusic-ice-11 draft-ietf-mmusic-ice-12
Status of this Memo Status of this Memo
By submitting this Internet-Draft, each author represents that any By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware applicable patent or other IPR claims of which he or she is aware
have been or will be disclosed, and any of which he or she becomes have been or will be disclosed, and any of which he or she becomes
aware will be disclosed, in accordance with Section 6 of BCP 79. aware will be disclosed, in accordance with Section 6 of BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at page 1, line 34 skipping to change at page 1, line 34
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on April 9, 2007. This Internet-Draft will expire on April 26, 2007.
Copyright Notice Copyright Notice
Copyright (C) The Internet Society (2006). Copyright (C) The Internet Society (2006).
Abstract Abstract
This document describes a protocol for Network Address Translator This document describes a protocol for Network Address Translator
(NAT) traversal for multimedia session signaling protocols based on (NAT) traversal for multimedia session signaling protocols based on
the offer/answer model, such as the Session Initiation Protocol the offer/answer model, such as the Session Initiation Protocol
(SIP). This protocol is called Interactive Connectivity (SIP). This protocol is called Interactive Connectivity
Establishment (ICE). ICE makes use of the Simple Traversal Establishment (ICE). ICE makes use of the Simple Traversal
Underneath NAT (STUN) protocol, applying its binding discovery and Underneath NAT (STUN) protocol, applying its binding discovery and
relay usages, in addition to defining a new usage for checking relay usages, in addition to defining a new usage for checking
connectivity between peers. connectivity between peers.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
2. Overview of ICE . . . . . . . . . . . . . . . . . . . . . . . 4 2. Overview of ICE . . . . . . . . . . . . . . . . . . . . . . . 5
2.1. Gathering Candidate Addresses . . . . . . . . . . . . . . 6 2.1. Gathering Candidate Addresses . . . . . . . . . . . . . . 7
2.2. Connectivity Checks . . . . . . . . . . . . . . . . . . . 8 2.2. Connectivity Checks . . . . . . . . . . . . . . . . . . . 9
2.3. Sorting Candidates . . . . . . . . . . . . . . . . . . . . 10 2.3. Sorting Candidates . . . . . . . . . . . . . . . . . . . . 10
2.4. Frozen Candidates . . . . . . . . . . . . . . . . . . . . 10 2.4. Frozen Candidates . . . . . . . . . . . . . . . . . . . . 11
2.5. Security for Checks . . . . . . . . . . . . . . . . . . . 11 2.5. Security for Checks . . . . . . . . . . . . . . . . . . . 11
3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.6. Concluding ICE . . . . . . . . . . . . . . . . . . . . . . 11
4. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 13 2.7. Passive-Only Agents . . . . . . . . . . . . . . . . . . . 12
4.1. Gathering Candidates . . . . . . . . . . . . . . . . . . . 13 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2. Prioritizing Candidates . . . . . . . . . . . . . . . . . 16 4. Choosing a Mode . . . . . . . . . . . . . . . . . . . . . . . 15
4.3. Choosing In-Use Candidates . . . . . . . . . . . . . . . . 18 5. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 15
4.4. Encoding the SDP . . . . . . . . . . . . . . . . . . . . . 18 5.1. Gathering Candidates . . . . . . . . . . . . . . . . . . . 16
5. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 20 5.2. Prioritizing Candidates . . . . . . . . . . . . . . . . . 18
5.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 20 5.3. Choosing In-Use Candidates . . . . . . . . . . . . . . . . 20
5.2. Gathering Candidates . . . . . . . . . . . . . . . . . . . 20 5.4. Encoding the SDP . . . . . . . . . . . . . . . . . . . . . 20
5.3. Prioritizing Candidates . . . . . . . . . . . . . . . . . 21 6. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 22
5.4. Choosing In Use Candidates . . . . . . . . . . . . . . . . 21 6.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 22
5.5. Encoding the SDP . . . . . . . . . . . . . . . . . . . . . 21 6.2. Determining Role . . . . . . . . . . . . . . . . . . . . . 23
5.6. Forming the Check Lists . . . . . . . . . . . . . . . . . 21 6.3. Gathering Candidates . . . . . . . . . . . . . . . . . . . 23
5.7. Performing Periodic Checks . . . . . . . . . . . . . . . . 23 6.4. Prioritizing Candidates . . . . . . . . . . . . . . . . . 23
6. Receipt of the Initial Answer . . . . . . . . . . . . . . . . 24 6.5. Choosing In Use Candidates . . . . . . . . . . . . . . . . 23
6.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 24 6.6. Encoding the SDP . . . . . . . . . . . . . . . . . . . . . 23
6.2. Forming the Check List . . . . . . . . . . . . . . . . . . 24 6.7. Forming the Check Lists . . . . . . . . . . . . . . . . . 23
6.3. Performing Periodic Checks . . . . . . . . . . . . . . . . 24 6.8. Performing Periodic Checks . . . . . . . . . . . . . . . . 26
7. Connectivity Checks . . . . . . . . . . . . . . . . . . . . . 24 7. Receipt of the Initial Answer . . . . . . . . . . . . . . . . 27
7.1. Applicability . . . . . . . . . . . . . . . . . . . . . . 24 7.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 27
7.2. Client Discovery of Server . . . . . . . . . . . . . . . . 25 7.2. Determining Role . . . . . . . . . . . . . . . . . . . . . 27
7.3. Server Determination of Usage . . . . . . . . . . . . . . 25 7.3. Forming the Check List . . . . . . . . . . . . . . . . . . 27
7.4. New Requests or Indications . . . . . . . . . . . . . . . 25 7.4. Performing Periodic Checks . . . . . . . . . . . . . . . . 27
7.5. New Attributes . . . . . . . . . . . . . . . . . . . . . . 25 8. Connectivity Checks . . . . . . . . . . . . . . . . . . . . . 27
7.6. New Error Response Codes . . . . . . . . . . . . . . . . . 25 8.1. Client Procedures . . . . . . . . . . . . . . . . . . . . 28
7.7. Client Procedures . . . . . . . . . . . . . . . . . . . . 25 8.1.1. Sending the Request . . . . . . . . . . . . . . . . . 28
7.7.1. Sending the Request . . . . . . . . . . . . . . . . . 25 8.1.2. Processing the Response . . . . . . . . . . . . . . . 29
7.7.2. Processing the Response . . . . . . . . . . . . . . . 26 8.2. Server Procedures . . . . . . . . . . . . . . . . . . . . 30
7.8. Server Procedures . . . . . . . . . . . . . . . . . . . . 27 9. Concluding ICE . . . . . . . . . . . . . . . . . . . . . . . . 32
7.9. Security Considerations for Connectivity Check . . . . . . 29 10. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 33
8. Completing the ICE Checks . . . . . . . . . . . . . . . . . . 29 10.1. Generating the Offer . . . . . . . . . . . . . . . . . . . 33
9. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 30 10.2. Receiving the Offer and Generating an Answer . . . . . . . 34
9.1. Generating the Offer . . . . . . . . . . . . . . . . . . . 30 10.3. Updating the Check and Valid Lists . . . . . . . . . . . . 35
9.2. Receiving the Offer and Generating an Answer . . . . . . . 31 11. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.3. Updating the Check and Valid Lists . . . . . . . . . . . . 32 12. Media Handling . . . . . . . . . . . . . . . . . . . . . . . . 38
10. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . . 33 12.1. Sending Media . . . . . . . . . . . . . . . . . . . . . . 38
11. Media Handling . . . . . . . . . . . . . . . . . . . . . . . . 34 12.2. Receiving Media . . . . . . . . . . . . . . . . . . . . . 39
11.1. Sending Media . . . . . . . . . . . . . . . . . . . . . . 34 13. Usage with SIP . . . . . . . . . . . . . . . . . . . . . . . . 39
11.2. Receiving Media . . . . . . . . . . . . . . . . . . . . . 35 13.1. Latency Guidelines . . . . . . . . . . . . . . . . . . . . 39
12. Usage with SIP . . . . . . . . . . . . . . . . . . . . . . . . 35 13.2. Interactions with Forking . . . . . . . . . . . . . . . . 40
12.1. Latency Guidelines . . . . . . . . . . . . . . . . . . . . 35 13.3. Interactions with Preconditions . . . . . . . . . . . . . 41
12.2. Interactions with Forking . . . . . . . . . . . . . . . . 37 13.4. Interactions with Third Party Call Control . . . . . . . . 41
12.3. Interactions with Preconditions . . . . . . . . . . . . . 37 14. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
12.4. Interactions with Third Party Call Control . . . . . . . . 38 15. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
13. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 16. Security Considerations . . . . . . . . . . . . . . . . . . . 49
14. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 16.1. Attacks on Connectivity Checks . . . . . . . . . . . . . . 49
15. Security Considerations . . . . . . . . . . . . . . . . . . . 46 16.2. Attacks on Address Gathering . . . . . . . . . . . . . . . 52
15.1. Attacks on Connectivity Checks . . . . . . . . . . . . . . 46 16.3. Attacks on the Offer/Answer Exchanges . . . . . . . . . . 52
15.2. Attacks on Address Gathering . . . . . . . . . . . . . . . 49 16.4. Insider Attacks . . . . . . . . . . . . . . . . . . . . . 52
15.3. Attacks on the Offer/Answer Exchanges . . . . . . . . . . 49 16.4.1. The Voice Hammer Attack . . . . . . . . . . . . . . . 53
15.4. Insider Attacks . . . . . . . . . . . . . . . . . . . . . 50 16.4.2. STUN Amplification Attack . . . . . . . . . . . . . . 53
15.4.1. The Voice Hammer Attack . . . . . . . . . . . . . . . 50 17. Definition of Connectivity Check Usage . . . . . . . . . . . . 54
15.4.2. STUN Amplification Attack . . . . . . . . . . . . . . 50 17.1. Applicability . . . . . . . . . . . . . . . . . . . . . . 54
16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 51 17.2. Client Discovery of Server . . . . . . . . . . . . . . . . 54
16.1. candidate Attribute . . . . . . . . . . . . . . . . . . . 51 17.3. Server Determination of Usage . . . . . . . . . . . . . . 54
16.2. remote-candidates Attribute . . . . . . . . . . . . . . . 51 17.4. New Requests or Indications . . . . . . . . . . . . . . . 54
16.3. ice-pwd Attribute . . . . . . . . . . . . . . . . . . . . 52 17.5. New Attributes . . . . . . . . . . . . . . . . . . . . . . 54
16.4. ice-ufrag Attribute . . . . . . . . . . . . . . . . . . . 52 17.6. New Error Response Codes . . . . . . . . . . . . . . . . . 55
17. IAB Considerations . . . . . . . . . . . . . . . . . . . . . . 53 17.7. Client Procedures . . . . . . . . . . . . . . . . . . . . 55
17.1. Problem Definition . . . . . . . . . . . . . . . . . . . . 53 17.8. Server Procedures . . . . . . . . . . . . . . . . . . . . 55
17.2. Exit Strategy . . . . . . . . . . . . . . . . . . . . . . 53 17.9. Security Considerations for Connectivity Check . . . . . . 55
17.3. Brittleness Introduced by ICE . . . . . . . . . . . . . . 54 18. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 55
17.4. Requirements for a Long Term Solution . . . . . . . . . . 55 18.1. SDP Attributes . . . . . . . . . . . . . . . . . . . . . . 55
17.5. Issues with Existing NAPT Boxes . . . . . . . . . . . . . 55 18.1.1. candidate Attribute . . . . . . . . . . . . . . . . . 55
18. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 56 18.1.2. remote-candidates Attribute . . . . . . . . . . . . . 56
19. References . . . . . . . . . . . . . . . . . . . . . . . . . . 56 18.1.3. ice-passive Attribute . . . . . . . . . . . . . . . . 56
19.1. Normative References . . . . . . . . . . . . . . . . . . . 56 18.1.4. ice-pwd Attribute . . . . . . . . . . . . . . . . . . 57
19.2. Informative References . . . . . . . . . . . . . . . . . . 57 18.1.5. ice-ufrag Attribute . . . . . . . . . . . . . . . . . 57
Appendix A. Design Motivations . . . . . . . . . . . . . . . . . 58 18.2. STUN Attributes . . . . . . . . . . . . . . . . . . . . . 58
A.1. Applicability to Gateways and Servers . . . . . . . . . . 59 19. IAB Considerations . . . . . . . . . . . . . . . . . . . . . . 58
A.2. Pacing of STUN Transactions . . . . . . . . . . . . . . . 60 19.1. Problem Definition . . . . . . . . . . . . . . . . . . . . 58
A.3. Candidates with Multiple Bases . . . . . . . . . . . . . . 61 19.2. Exit Strategy . . . . . . . . . . . . . . . . . . . . . . 59
A.4. Purpose of the Translation . . . . . . . . . . . . . . . . 63 19.3. Brittleness Introduced by ICE . . . . . . . . . . . . . . 59
A.5. Importance of the STUN Username . . . . . . . . . . . . . 63 19.4. Requirements for a Long Term Solution . . . . . . . . . . 60
A.6. The Candidate Pair Sequence Number Formula . . . . . . . . 64 19.5. Issues with Existing NAPT Boxes . . . . . . . . . . . . . 60
A.7. The Frozen State . . . . . . . . . . . . . . . . . . . . . 65 20. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 61
A.8. The remote-candidates attribute . . . . . . . . . . . . . 65 21. References . . . . . . . . . . . . . . . . . . . . . . . . . . 61
A.9. Why are Keepalives Needed? . . . . . . . . . . . . . . . . 66 21.1. Normative References . . . . . . . . . . . . . . . . . . . 61
A.10. Why Prefer Peer Reflexive Candidates? . . . . . . . . . . 67 21.2. Informative References . . . . . . . . . . . . . . . . . . 62
A.11. Why Can't Offerers Send Media When a Pair Validates . . . 67 Appendix A. Passive-Only ICE . . . . . . . . . . . . . . . . . . 64
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 69 Appendix B. Design Motivations . . . . . . . . . . . . . . . . . 66
Intellectual Property and Copyright Statements . . . . . . . . . . 70 B.1. Pacing of STUN Transactions . . . . . . . . . . . . . . . 66
B.2. Candidates with Multiple Bases . . . . . . . . . . . . . . 67
B.3. Purpose of the Translation . . . . . . . . . . . . . . . . 69
B.4. Importance of the STUN Username . . . . . . . . . . . . . 69
B.5. The Candidate Pair Sequence Number Formula . . . . . . . . 70
B.6. The Frozen State . . . . . . . . . . . . . . . . . . . . . 71
B.7. The remote-candidates attribute . . . . . . . . . . . . . 71
B.8. Why are Keepalives Needed? . . . . . . . . . . . . . . . . 72
B.9. Why Prefer Peer Reflexive Candidates? . . . . . . . . . . 73
B.10. Why Send an Updated Offer? . . . . . . . . . . . . . . . . 73
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 74
Intellectual Property and Copyright Statements . . . . . . . . . . 75
1. Introduction 1. Introduction
RFC 3264 [4] defines a two-phase exchange of Session Description RFC 3264 [4] defines a two-phase exchange of Session Description
Protocol (SDP) messages [10] for the purposes of establishment of Protocol (SDP) messages [10] for the purposes of establishment of
multimedia sessions. This offer/answer mechanism is used by multimedia sessions. This offer/answer mechanism is used by
protocols such as the Session Initiation Protocol (SIP) [3]. protocols such as the Session Initiation Protocol (SIP) [3].
Protocols using offer/answer are difficult to operate through Network Protocols using offer/answer are difficult to operate through Network
Address Translators (NAT). Because their purpose is to establish a Address Translators (NAT). Because their purpose is to establish a
skipping to change at page 7, line 48 skipping to change at page 8, line 48
| Agent | | Agent |
| | | |
+--------+ +--------+
Figure 2 Figure 2
To find a server reflexive candidate, the agent sends a STUN Binding To find a server reflexive candidate, the agent sends a STUN Binding
Request, using the Binding Discovery Usage [11] from each host Request, using the Binding Discovery Usage [11] from each host
candidate, to its STUN server. (It is assumed that the address of candidate, to its STUN server. (It is assumed that the address of
the STUN server is configured, or learned in some way.) When the the STUN server is configured, or learned in some way.) When the
agents sends the Binding Request, the NAT (assuming there is one) agent sends the Binding Request, the NAT (assuming there is one) will
will allocate a binding, mapping this server reflexive candidate to allocate a binding, mapping this server reflexive candidate to the
the host candidate. Outgoing packets sent from the host candidate host candidate. Outgoing packets sent from the host candidate will
will be translated by the NAT to the server reflexive candidate. be translated by the NAT to the server reflexive candidate. Incoming
Incoming packets sent to the server relexive candidate will be packets sent to the server relexive candidate will be translated by
translated by the NAT to the host candidate and forwarded to the the NAT to the host candidate and forwarded to the agent. We call
agent. We call the host candidate associated with a given server the host candidate associated with a given server reflexive candidate
reflexive candidate the BASE. the BASE.
Note Note
"Base" refers to the address you'd send from for a particular "Base" refers to the address you'd send from for a particular
candidate. Thus, as a degenerate case host candidates also have a candidate. Thus, as a degenerate case host candidates also have a
base, but it's the same as the host candidate. base, but it's the same as the host candidate.
When there are multiple NATs between the agent and the STUN server, When there are multiple NATs between the agent and the STUN server,
the STUN request will create a binding on each NAT, but only the the STUN request will create a binding on each NAT, but only the
outermost server reflexive candidate will be discovered by the agent. outermost server reflexive candidate will be discovered by the agent.
skipping to change at page 9, line 25 skipping to change at page 10, line 25
<- STUN request \ R's <- STUN request \ R's
STUN response -> / check STUN response -> / check
Figure 3 Figure 3
As an optimization, as soon as R gets L's check message he As an optimization, as soon as R gets L's check message he
immediately sends his own check message to L on the same candidate immediately sends his own check message to L on the same candidate
pair. This accelerates the process of finding a valid candidate. pair. This accelerates the process of finding a valid candidate.
At the end of this handshake, both L and R know that they can send At the end of this handshake, both L and R know that they can send
(and receive) messages end-to-end in both directions. Note that as (and receive) messages end-to-end in both directions.
soon as R receives L's STUN response it knows that the R->L path
works and it can start sending media on that path right away, as
shown below. This allows for 'early media' to flow as fast as
possible:
L R
- -
STUN request -> \ L's
<- STUN response / check
<- STUN request \ R's
STUN response -> / check
<- RTP Data
Figure 4
Once any connectivity check for a candidate for a given media
component succeeds, ICE uses that candidate and immediately abandons
all other connectivity checks for that component. Note that due to
race conditions and packet loss, this may mean that the "best"
candidate isn't selected, but it does guarantee the selection of a
candidate that works, and because of the sorting process it will
generally be one of the most preferred ones.
2.3. Sorting Candidates 2.3. Sorting Candidates
Because the algorithm above searches all candidate pairs, if a Because the algorithm above searches all candidate pairs, if a
working pair exists it will eventually find it no matter what order working pair exists it will eventually find it no matter what order
the candidates are tried in. In order to produce faster (and better) the candidates are tried in. In order to produce faster (and better)
results, the candidates are sorted in a specified order. The results, the candidates are sorted in a specified order. The
algorithm is described in Section 4.2 but follows two general algorithm is described in Section 5.2 but follows two general
principles: principles:
o Each agent gives its candidates a numeric priority which is sent o Each agent gives its candidates a numeric priority which is sent
along with the candidate to the peer along with the candidate to the peer
o The local and remote priorities are combined so that each agent o The local and remote priorities are combined so that each agent
has the same ordering for the candidate pairs. has the same ordering for the candidate pairs.
The second property is important for getting ICE to work when there The second property is important for getting ICE to work when there
are NATs in front of A and B. Frequently, NATs will not allow packets are NATs in front of A and B. Frequently, NATs will not allow packets
skipping to change at page 11, line 26 skipping to change at page 11, line 49
Because ICE is used to discover which addresses can be used to send Because ICE is used to discover which addresses can be used to send
media between two agents, it is important to ensure that the process media between two agents, it is important to ensure that the process
cannot be hijacked to send media to the wrong location. Each STUN cannot be hijacked to send media to the wrong location. Each STUN
connectivity check is covered by a message authentication code (MAC) connectivity check is covered by a message authentication code (MAC)
computed using a key exchanged in the signalling channel. This MAC computed using a key exchanged in the signalling channel. This MAC
provides message integrity and data origin authentication, thus provides message integrity and data origin authentication, thus
stopping an attacker from forging or modifying connectivity check stopping an attacker from forging or modifying connectivity check
messages. The MAC also aids in disambiguating ICE exchanges from messages. The MAC also aids in disambiguating ICE exchanges from
forked calls. forked calls.
2.6. Concluding ICE
ICE checks are performed in a specific sequence, so that high
priority pairs are checked first, followed by lower priority ones.
One way to conclude ICE is to declare victory as soon as a check for
each component of each media stream completes successfully. Indeed,
this is a reasonable algorithm, and details for it are provided
below. However, it is possible that packet losses will cause a
higher priority check to take longer to complete, and allowing ICE to
run a little longer might produce better results. More
fundamentally, however, the prioritization defined by this
specification may not yield "optimal" results. As an example, if the
aim is to select low latency media paths, usage of a relay is a hint
that latencies may be higher, but it is nothing more than a hint. An
actual RTT measurement could be made, and it might demonstrate that a
pair with lower priority is actually better than one with higher
priority.
Consequently, ICE assigns one of the agents in the role of the
controlling agent, and the other as passive. The controlling agent
runs a selection algorithm, through which it can decide when to
conclude ICE checks, and which pairs get selected. When a
controlling agent selects a pair for a particular component of a
media stream, it generates a check for that pair and includes a flag
in the check indicating that the pair has been selected. This will
cause the passive agent to cease any other checks it has lined up for
that component, and mark the pair validated by that check as
"selected". Once there is a selected pair for each component of a
media stream, the ICE checks for that media stream are considered to
be completed, and media can flow in each direction for that stream,
as shown in Figure 4. Once all of the media streams are completed,
the controlling endpoint sends an updated offer if the currently in-
use candidates don't match the ones it selected.
L R
- -
STUN request + flag -> \ L's
<- STUN response / check
-> RTP Data
<- RTP Data
Figure 4
2.7. Passive-Only Agents
ICE requires both sides of a call to support it. However, certain
agents, such as those in gateways to the PSTN, media servers,
conferencing servers, and voicemail servers, are known to not be
behind a NAT or firewall. To make it easier for these devices to
support ICE, they can operate in a "passive-only" mode (in contrast
to a "full" mode). In passive-only mode, they don't need to gather
candidates and don't act as the controlling agent. They only need to
respond to checks, generate triggered checks, and follow the rules
for sending media and keepalives.
3. Terminology 3. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [1]. document are to be interpreted as described in RFC 2119 [1].
This specification makes use of the following terminology: This specification makes use of the following terminology:
Agent: As defined in RFC 3264, an agent is the protocol Agent: As defined in RFC 3264, an agent is the protocol
implementation involved in the offer/answer exchange. There are implementation involved in the offer/answer exchange. There are
skipping to change at page 13, line 30 skipping to change at page 15, line 15
Check List: An ordered set of STUN checks that an agent is to Check List: An ordered set of STUN checks that an agent is to
generate towards a peer. generate towards a peer.
Periodic Check: A connectivity check generated by an agent as a Periodic Check: A connectivity check generated by an agent as a
consequence of a timer that fires periodically, instructing it to consequence of a timer that fires periodically, instructing it to
send a check. send a check.
Triggered Check: A connectivity check generated as a consequence of Triggered Check: A connectivity check generated as a consequence of
the receipt of a connectivity check from the peer. the receipt of a connectivity check from the peer.
Valid List: An ordered set of candidate pairs that have been Valid List: An ordered set of candidate pairs for a media stream that
validated by a successful STUN transaction. have been validated by a successful STUN transaction.
4. Sending the Initial Offer Controlling Agent: The STUN agent which is responsible for selecting
the final choice of candidate pairs and signaling them through
STUN and an updated offer, if needed.
Passive Agent: The STUN agent which waits for the controlling agent
to select the final choice of candidate pairs.
4. Choosing a Mode
The first step in ICE processing is selection of a mode. An ICE
agent can operate in either full mode or passive-only mode. An agent
MUST NOT act in passive-only mode unless the following are all true:
1. The device definitively knows that it has a public IP address.
Usage of tests and heuristics like those defined in RFC 3489 [13]
are not sufficient to make this determination. Rather, knowledge
comes from explicit configuration due to known location in the
network. Typically, this limits passive-only mode to devices
like PSTN gateways, conferencing servers, voicemail servers and
so on.
2. The device will only provide one candidate for each component of
each media stream, matching the values in the m/c-line for each
media stream.
Full mode is meant for general purpose endpoints, such as softphones,
hard-phones, and other devices that may or may not be placed in
networks with public addresses.
5. Sending the Initial Offer
In order to send the initial offer in an offer/answer exchange, an In order to send the initial offer in an offer/answer exchange, an
agent must gather candidates, priorize them, choose ones for agent must gather candidates, priorize them, choose ones for
inclusion in the m/c-line, and then formulate and send the SDP. Each inclusion in the m/c-line, and then formulate and send the SDP. Each
of these steps is described in the subsections below. of these steps is described in the subsections below.
4.1. Gathering Candidates 5.1. Gathering Candidates
An agent gathers candidates when it believes that communications is An agent gathers candidates when it believes that communications is
imminent. An offerer can do this based on a user interface cue, or imminent. An offerer can do this based on a user interface cue, or
based on an explicit request to initiate a session. Every candidate based on an explicit request to initiate a session. Every candidate
is a transport address. It also has a type and a base. Three types is a transport address. It also has a type and a base. Three types
are defined and gathered by this specification - host candidates, are defined and gathered by this specification - host candidates,
server reflexive candidates, and relayed candidates. The base of a server reflexive candidates, and relayed candidates. The base of a
candidate is the candidate that an agent must send from when using candidate is the candidate that an agent must send from when using
that candidate. that candidate.
skipping to change at page 14, line 23 skipping to change at page 16, line 38
every candidate) is always associated with a specific component for every candidate) is always associated with a specific component for
which it is a candidate. Each component has an ID assigned to it, which it is a candidate. Each component has an ID assigned to it,
called the component ID. For RTP-based media streams, the RTP itself called the component ID. For RTP-based media streams, the RTP itself
has a component ID of 1, and RTCP a component ID of 2. If an agent has a component ID of 1, and RTCP a component ID of 2. If an agent
is using RTCP it MUST obtain a candidate for it. If an agent is is using RTCP it MUST obtain a candidate for it. If an agent is
using both RTP and RTCP, it would end up with 2*K host candidates if using both RTP and RTCP, it would end up with 2*K host candidates if
an agent has K interfaces. an agent has K interfaces.
The base for each host candidate is set to the candidate itself. The base for each host candidate is set to the candidate itself.
Once the agent has obtained host candidates, it obtains server Agents implementing passive-only mode MUST NOT gather server
reflexive and relayed candidates. The process for gathering server reflexive or relayed candidates. Agents implementing full mode
reflexive and relayed candidates depends on the transport protocol. SHOULD obtain relayed candidates and MUST obtain server reflexive
Procedures are specified here for UDP. candidates. The requirement to obtain relayed candidates is at
SHOULD strength to allow for provider variation. If they are not
Agents which serve end users directly, such softphones, hardphones, used, it is RECOMMENDED that it be implemented and just disabled
terminal adapters and so on, SHOULD obtain relayed candidates and through configuration, so that it can re-enabled through
MUST obtain server reflexive candidates. The requirement to obtain configuration if conditions change in the future.
relayed candidates is at SHOULD strength to allow for provider
variation. If they are not used, it is RECOMMENDED that it be
implemented and just disabled through configuration, so that it can
re-enabled through configuration if conditions change in the future.
Agents which represent network servers under the control of a service
provider, such as gateways to the telephone network, media servers,
or conferencing servers that are targeted at deployment only in
networks with public IP addresses MAY skip obtaining server reflexive
and relayed candidates.
The agent next pairs each host candidate with the STUN server with The full-mode agent next pairs each host candidate with the STUN
which it is configured or has discovered by some means. This server with which it is configured or has discovered by some means.
specification only considers usage of a single STUN server. Every Ta This specification only considers usage of a single STUN server.
seconds, the agent chooses another such pair (the order is Every Ta seconds, the full-mode agent chooses another such pair (the
inconsequential), and sends a STUN request to the server from that order is inconsequential), and sends a STUN request to the server
host candidate. If the agent is using both relayed and server from that host candidate. If the full-mode agent is using both
reflexive candidates, this request MUST be a STUN Allocate request relayed and server reflexive candidates, this request MUST be a STUN
from the relay usage [12]. If the agent is using only server Allocate request from the relay usage [12]. If the full-mode agent
reflexive candidates, the request MUST be a STUN Binding request is using only server reflexive candidates, the request MUST be a STUN
using the binding discovery usage [11]. Binding request using the binding discovery usage [11].
The value of Ta SHOULD be configurable, and SHOULD have a default of The value of Ta SHOULD be configurable, and SHOULD have a default of
50ms. Note that this pacing applies only to starting STUN 20ms. Note that this pacing applies only to starting STUN
transactions with source and destination transport addresses (i.e., transactions with source and destination transport addresses (i.e.,
the host candidate and STUN server respectively) for which a STUN the host candidate and STUN server respectively) for which a STUN
transaction has not previously been sent. Consequently, transaction has not previously been sent. Consequently,
retransmissions of a STUN request are governed entirely by the retransmissions of a STUN request are governed entirely by the
retransmission rules defined in [11]. Similarly, retries of a retransmission rules defined in [11]. Similarly, retries of a
request due to recoverable errors (such as an authentication request due to recoverable errors (such as an authentication
challenge) happen immediately and are not paced by timer Ta. Because challenge) happen immediately and are not paced by timer Ta. Because
of this pacing, it will take a certain amount of time to obtain all of this pacing, it will take a certain amount of time to obtain all
of the server reflexive and relayed candidates. Implementations of the server reflexive and relayed candidates. Implementations
should be aware of the time required to do this, and if the should be aware of the time required to do this, and if the
skipping to change at page 15, line 35 skipping to change at page 17, line 40
host candidate from which the Allocate or Binding request was sent. host candidate from which the Allocate or Binding request was sent.
The base of a relayed candidate is that candidate itself. A server The base of a relayed candidate is that candidate itself. A server
reflexive candidate obtained from an Allocate response is the called reflexive candidate obtained from an Allocate response is the called
the "translation" of the relayed candidate obtained from the same the "translation" of the relayed candidate obtained from the same
response. The agent will need to remember the translation for the response. The agent will need to remember the translation for the
relayed candidate, since it is placed into the SDP. If a relayed relayed candidate, since it is placed into the SDP. If a relayed
candidate is identical to a host candidate (which can happen in rare candidate is identical to a host candidate (which can happen in rare
cases), the relayed candidate MUST be discarded. Proper operation of cases), the relayed candidate MUST be discarded. Proper operation of
ICE depends on each base being unique. ICE depends on each base being unique.
Next, redundant candidates are eliminated. A candidate is redundant Next, a full-mode agent eliminates redundant candidates. A candidate
if its transport address equals another candidate, and its base is redundant if its transport address equals another candidate, and
equals the base of that other candidate. Note that two candidates its base equals the base of that other candidate. Note that two
can have the same transport address yet have different bases, and candidates can have the same transport address yet have different
these would not be considered redundant. bases, and these would not be considered redundant.
Finally, each candidate is assigned a foundation. The foundation is Finally, all agents assign each candidate a foundation. The
an identifier, scoped within a session. Two candidates MUST have the foundation is an identifier, scoped within a session. Two candidates
same foundation ID when they are of the same type (host, relayed, MUST have the same foundation ID when they are of the same type
server reflexive, peer reflexive or relayed), their bases have the (host, relayed, server reflexive, peer reflexive or relayed), their
same IP address (the ports can be different), and, for reflexive and bases have the same IP address (the ports can be different), and, for
relayed candidates, the STUN servers used to obtain them have the reflexive and relayed candidates, the STUN servers used to obtain
same IP address. Similarly, two candidates MUST have different them have the same IP address. Similarly, two candidates MUST have
foundations if their types are different, their bases have different different foundations if their types are different, their bases have
IP addresses, or the STUN servers used to obtain them have different different IP addresses, or the STUN servers used to obtain them have
IP addresses. different IP addresses.
4.2. Prioritizing Candidates 5.2. Prioritizing Candidates
The prioritization process results in the assignment of a priority to The prioritization process results in the assignment of a priority to
each candidate. An agent does this by determining a preference for each candidate. An agent does this by determining a preference for
each type of candidate (server reflexive, peer reflexive, relayed and each type of candidate (server reflexive, peer reflexive, relayed and
host), and, when the agent is multihomed, choosing a preference for host), and, when the agent is multihomed, choosing a preference for
its interfaces. These two preferences are then combined to compute its interfaces. These two preferences are then combined to compute
the priority for a candidate. That priority MUST be computed using the priority for a candidate. That priority MUST be computed using
the following formula: the following formula:
priority = (2^24)*(type preference) + priority = (2^24)*(type preference) +
skipping to change at page 16, line 28 skipping to change at page 18, line 32
The type preference MUST be an integer from 0 to 126 inclusive, and The type preference MUST be an integer from 0 to 126 inclusive, and
represents the preference for the type of the candidate (where the represents the preference for the type of the candidate (where the
types are local, server reflexive, peer reflexive and relayed). A types are local, server reflexive, peer reflexive and relayed). A
126 is the highest preference, and a 0 is the lowest. Setting the 126 is the highest preference, and a 0 is the lowest. Setting the
value to a 0 means that candidates of this type will only be used as value to a 0 means that candidates of this type will only be used as
a last resort. The type preference MUST be identical for all a last resort. The type preference MUST be identical for all
candidates of the same type and MUST be different for candidates of candidates of the same type and MUST be different for candidates of
different types. The type preference for peer reflexive candidates different types. The type preference for peer reflexive candidates
MUST be higher than that of server reflexive candidates. Note that MUST be higher than that of server reflexive candidates. Note that
candidates gathered based on the procedures of Section 4.1 will never candidates gathered based on the procedures of Section 5.1 will never
be peer reflexive candidates; candidates of these type are learned be peer reflexive candidates; candidates of these type are learned
from the STUN connectivity checks performed by ICE. The component ID from the STUN connectivity checks performed by ICE. The component ID
is the component ID for the candidate, and MUST be between 1 and 256 is the component ID for the candidate, and MUST be between 1 and 256
inclusive. The local preference MUST be an integer from 0 to 65535 inclusive. The local preference MUST be an integer from 0 to 65535
inclusive. It represents a preference for the particular interface inclusive. It represents a preference for the particular interface
from which the candidate was obtained, in cases where an agent is from which the candidate was obtained, in cases where an agent is
multihomed. 65535 represents the highest preference, and a zero, the multihomed. 65535 represents the highest preference, and a zero, the
lowest. When there is only a single interface, this value SHOULD be lowest. When there is only a single interface, this value SHOULD be
set to 65535. Generally speaking, if there are multiple candidates set to 65535. Generally speaking, if there are multiple candidates
for a particular component for a particular media stream which have for a particular component for a particular media stream which have
skipping to change at page 18, line 5 skipping to change at page 20, line 8
a VPN interface would have a higher local preference than any other a VPN interface would have a higher local preference than any other
interfaces. interfaces.
Another criteria for selecting preferences is topological awareness. Another criteria for selecting preferences is topological awareness.
This is most useful for candidates that make use of relays. In those This is most useful for candidates that make use of relays. In those
cases, if an agent has preconfigured or dynamically discovered cases, if an agent has preconfigured or dynamically discovered
knowledge of the topological proximity of the relays to itself, it knowledge of the topological proximity of the relays to itself, it
can use that to assign higher local preferences to candidates can use that to assign higher local preferences to candidates
obtained from closer relays. obtained from closer relays.
4.3. Choosing In-Use Candidates 5.3. Choosing In-Use Candidates
A candidate is said to be "in-use" if it appears in the m/c-line of A candidate is said to be "in-use" if it appears in the m/c-line of
an offer or answer. When communicating with an ICE peer, being in- an offer or answer. When communicating with an ICE peer, being in-
use implies that, should these candidates be selected by the ICE use implies that, should these candidates be selected by the ICE
algorithm, bidirectional media can flow and the candidates can be algorithm, bidirectional media can flow and the candidates can be
used. If a candidate is selected by ICE but is not in-use, only used. If a candidate is selected by ICE but is not in-use, only
unidirectional media can flow and only for a brief time; the unidirectional media can flow and only for a brief time; the
candidate must be made in-use through an updated offer/answer candidate must be made in-use through an updated offer/answer
exchange. When communicating with a peer that is not ICE-aware, the exchange. When communicating with a peer that is not ICE-aware, the
in-use candidates will be used exclusively for the exchange of media, in-use candidates will be used exclusively for the exchange of media,
skipping to change at page 18, line 36 skipping to change at page 20, line 39
enterprise. To reach non-ICE capable agents within the enterprise, enterprise. To reach non-ICE capable agents within the enterprise,
host candidates have to be used, since the enterprise policies may host candidates have to be used, since the enterprise policies may
prevent communication between elements using a relay on the public prevent communication between elements using a relay on the public
network. However, when communicating to peers outside of the network. However, when communicating to peers outside of the
enterprise, relayed candidates from a publically accessible STUN enterprise, relayed candidates from a publically accessible STUN
server are needed. server are needed.
Indeed, the difficulty in picking just one transport address that Indeed, the difficulty in picking just one transport address that
will work is the whole problem that motivated the development of this will work is the whole problem that motivated the development of this
specification in the first place. As such, it is RECOMMENDED that specification in the first place. As such, it is RECOMMENDED that
relayed candidates be selected to be in-use. Furthermore, ICE is full mode agents select relayed candidates to be in-use. Passive-
only truly effective when it is supported on both sides of the only agents will, naturally, select their only candidates - the host
session. It is therefore most prudent to deploy it to close-knit candidates - to be in use.
communities as a whole, rather than piecemeal. In the example above,
this would mean that ICE would ideally be deployed completely within
the enterprise, rather than just to parts of it.
4.4. Encoding the SDP 5.4. Encoding the SDP
The agent includes a single a=candidate media level attribute in the The agent includes a single a=candidate media level attribute in the
SDP for each candidate for that media stream. The a=candidate SDP for each candidate for that media stream. The a=candidate
attribute contains the IP address, port and transport protocol for attribute contains the IP address, port and transport protocol for
that candidate. A Fully Qualified Domain Name (FQDN) for a host MAY that candidate. A Fully Qualified Domain Name (FQDN) for a host MAY
be used in place of a unicast address. In that case, when receiving be used in place of a unicast address. In that case, when receiving
an offer or answer containing an FQDN in an a=candidate attribute, an offer or answer containing an FQDN in an a=candidate attribute,
the FQDN is looked up in the DNS using an A or AAAA record, and the the FQDN is looked up in the DNS using an A or AAAA record, and the
resulting IP address is used for the remainder of ICE processing. resulting IP address is used for the remainder of ICE processing.
The candidate attribute also includes the component ID for that The candidate attribute also includes the component ID for that
candidate. For media streams based on RTP, candidates for the actual candidate. For media streams based on RTP, candidates for the actual
RTP media MUST have a component ID of 1, and candidates for RTCP MUST RTP media MUST have a component ID of 1, and candidates for RTCP MUST
have a component ID of 2. Other types of media streams which require have a component ID of 2. Other types of media streams which require
multiple components MUST develop specifications which define the multiple components MUST develop specifications which define the
mapping of components to component IDs, and these component IDs MUST mapping of components to component IDs, and these component IDs MUST
be between 1 and 256. be between 1 and 256.
The candidate attribute also includes the priority, which is the The candidate attribute also includes the priority, which is the
value determined for the candidate as described in Section 4.2, and value determined for the candidate as described in Section 5.2, and
the foundation, which is the value determined for the candidate as the foundation, which is the value determined for the candidate as
described in Section 4.1. The agent SHOULD include a type for each described in Section 5.1. The agent SHOULD include a type for each
candidate by populating the candidate-types production with the candidate by populating the candidate-types production with the
appropriate value - "host" for host candidates, "srflx" for server appropriate value - "host" for host candidates, "srflx" for server
reflexive candidates, "prflx" for peer reflexive candidates (though reflexive candidates, "prflx" for peer reflexive candidates (though
these never appear in an initial offer/answer exchange), and "relay" these never appear in an initial offer/answer exchange), and "relay"
for relayed candidates. The related address MUST NOT be included if for relayed candidates. The related address MUST NOT be included if
a type was not included. If a type was included, the related address a type was not included. If a type was included, the related address
SHOULD be present for server reflexive, peer reflexive and relayed SHOULD be present for server reflexive, peer reflexive and relayed
candidates. If a candidate is server or peer reflexive, the related candidates. If a candidate is server or peer reflexive, the related
address is equal to the base for that server or peer reflexive address is equal to the base for that server or peer reflexive
candidate. If the candidate is relayed, the related address is equal candidate. If the candidate is relayed, the related address is equal
skipping to change at page 19, line 52 skipping to change at page 22, line 5
identical ice-pwd's. The ice-ufrag and ice-pwd attributes MUST be identical ice-pwd's. The ice-ufrag and ice-pwd attributes MUST be
chosen randomly at the beginning of a session. The ice-ufrag chosen randomly at the beginning of a session. The ice-ufrag
attribute MUST contain at least 24 bits of randomness, and the ice- attribute MUST contain at least 24 bits of randomness, and the ice-
pwd attribute MUST contain at least 128 bits of randomness. This pwd attribute MUST contain at least 128 bits of randomness. This
means that the ice-ufrag attribute will be at least 4 characters means that the ice-ufrag attribute will be at least 4 characters
long, and the ice-pwd at least 22 characters long, since the grammar long, and the ice-pwd at least 22 characters long, since the grammar
for these attributes allows for 6 bits of randomness per character. for these attributes allows for 6 bits of randomness per character.
The attributes MAY be longer than 4 and 21 characters respectively, The attributes MAY be longer than 4 and 21 characters respectively,
of course. of course.
If an agent is operating in passive-only mode, it MUST include the
"a=ice-passive" session level attribute in its offer. If an agent is
in full mode, it MUST NOT include this attribute.
The m/c-line is populated with the candidates that are in-use. For The m/c-line is populated with the candidates that are in-use. For
streams based on RTP, this is done by placing the RTP candidate into streams based on RTP, this is done by placing the RTP candidate into
the m and c lines respectively. If the agent is utilizing RTCP, it the m and c lines respectively. If the agent is utilizing RTCP, it
MUST encode the RTCP candidate into the m/c-line using the a=rtcp MUST encode the RTCP candidate into the m/c-line using the a=rtcp
attribute as defined in RFC 3605 [2]. If RTCP is not in use, the attribute as defined in RFC 3605 [2]. If RTCP is not in use, the
agent MUST signal that using b=RS:0 and b=RR:0 as defined in RFC 3556 agent MUST signal that using b=RS:0 and b=RR:0 as defined in RFC 3556
[5]. [5].
There MUST be a candidate attribute for each component of the media There MUST be a candidate attribute for each component of the media
stream in the m/c-line. stream in the m/c-line.
Once an offer or answer are sent, an agent MUST be prepared to Once an offer or answer are sent, an agent MUST be prepared to
receive both STUN and media packets on each candidate. As discussed receive both STUN and media packets on each candidate. As discussed
in Section 11.1, media packets can be sent to a candidate prior to in Section 12.1, media packets can be sent to a candidate prior to
its appearence in the m/c-line. its appearence in the m/c-line.
5. Receiving the Initial Offer 6. Receiving the Initial Offer
When an agent receives an initial offer, it will check if the offeror When an agent receives an initial offer, it will check if the offeror
supports ICE, gather candidates, prioritize them, choose one for in- supports ICE, determine its role, gather candidates, prioritize them,
use, encode and send an answer, and then form the check lists and choose one for in-use, encode and send an answer, and then form the
begin connectivity checks. check lists and begin connectivity checks.
5.1. Verifying ICE Support 6.1. Verifying ICE Support
The agent will proceed with the ICE procedures defined in this The answerer will proceed with the ICE procedures defined in this
specification if the following are both true: specification if the following are true:
o There is at least one a=candidate attribute for each media stream o There is at least one a=candidate attribute for each media stream
in the SDP it just received. in the offer it just received.
o For each media stream, at least one of the candidates is a match o For each media stream, at least one of the candidates is a match
for its respective in-use component in the m/c-line. for its respective in-use component in the m/c-line.
If both of these conditions are not met, the agent MUST process the If both of these conditions are not met, the agent MUST process the
SDP based on normal RFC 3264 procedures, without using any of the ICE SDP based on normal RFC 3264 procedures, without using any of the ICE
mechanisms described in the remainder of this specification, with the mechanisms described in the remainder of this specification, with the
exception of Section 10, which describes keepalive procedures. exception of Section 11, which describes keepalive procedures.
5.2. Gathering Candidates In addition, if the offer contains the "a=ice-passive" attribute, and
the answerer is also passive-only, the agent MUST process the SDP
based on normal RFC 3264 procedures, as if it didn't support ICE,
with the exception of Section 11, which describes keepalive
procedures.
6.2. Determining Role
If the agent is in passive-only mode, it assumes the passive role for
this session. If the agent is in full-mode, but its peer is in
passive-only mode (as indicated by the a=ice-passive attribute in the
SDP), the agent assumes the controlling role for this session. If
the agent and its peer are both in full-mode, the agent which
generated the offer which started the ICE processing takes on the
controlling role, and the other takes the passive role.
Based on this definition, once roles are determined for a session,
they persist unless ICE is restarted, as discussed below. A restart
causes a new selection of roles.
6.3. Gathering Candidates
The process for gathering candidates at the answerer is identical to The process for gathering candidates at the answerer is identical to
the process for the offerer as described in Section 4.1. It is the process for the offerer as described in Section 5.1. It is
RECOMMENDED that this process begin immediately on receipt of the RECOMMENDED that this process begin immediately on receipt of the
offer, prior to user acceptance of a session. Such gathering MAY offer, prior to user acceptance of a session. Such gathering MAY
even be done pre-emptively when an agent starts. even be done pre-emptively when an agent starts.
5.3. Prioritizing Candidates 6.4. Prioritizing Candidates
The process for prioritizing candidates at the answerer is identical The process for prioritizing candidates at the answerer is identical
to the process followed by the offerer, as described in Section 4.2. to the process followed by the offerer, as described in Section 5.2.
5.4. Choosing In Use Candidates 6.5. Choosing In Use Candidates
The process for selecting in-use candidates at the answerer is The process for selecting in-use candidates at the answerer is
identical to the process followed by the offerer, as described in identical to the process followed by the offerer, as described in
Section 4.3. Section 5.3.
5.5. Encoding the SDP 6.6. Encoding the SDP
The process for encoding the SDP at the answerer is identical to the The process for encoding the SDP at the answerer is identical to the
process followed by the offerer, as described in Section 4.4. process followed by the offerer, as described in Section 5.4.
5.6. Forming the Check Lists 6.7. Forming the Check Lists
Next, the agent forms the check lists. There is one check list per A full-mode agent MUST form the check lists as described in this
in-use media stream resulting from the offer/answer exchange. A section. A passive-only agent MAY do so, but there is no need.
media stream is in-use as long as its port is non-zero (which is used
in RFC 3264 to reject a media stream). Each check list is a sequence There is one check list per in-use media stream resulting from the
of STUN connectivity checks that are performed by the agent. To form offer/answer exchange. A media stream is in-use as long as its port
the check list for a media stream, the agent forms candidate pairs, is non-zero (which is used in RFC 3264 to reject a media stream).
computes a candidate pair priority, orders the pairs by priority,
prunes them, and sets their states. These steps are described in Consequently, a media stream is in-use even if it is marked as
this section. a=inactive or has a bandwidth value of zero. Each check list is a
sequence of STUN connectivity checks that are performed by the agent.
To form the check list for a media stream, the agent forms candidate
pairs, computes a candidate pair priority, orders the pairs by
priority, prunes them, and sets their states. These steps are
described in this section.
First, the agent takes each of its candidates for a media stream First, the agent takes each of its candidates for a media stream
(called local candidates) and pairs them with the candidates it (called local candidates) and pairs them with the candidates it
received from its peer (called remote candidates) for that media received from its peer (called remote candidates) for that media
stream. A local candidate is paired with a remote candidate if and stream. A local candidate is paired with a remote candidate if and
only if the two candidates have the same component ID and have the only if the two candidates have the same component ID and have the
same IP address version. It is possible that some of the local same IP address version. It is possible that some of the local
candidates don't get paired with a remote candidate, and some of the candidates don't get paired with a remote candidate, and some of the
remote candidates don't get paired with local candidates. This can remote candidates don't get paired with local candidates. This can
happen if one agent didn't include candidates for the all of the happen if one agent didn't include candidates for the all of the
skipping to change at page 22, line 32 skipping to change at page 25, line 12
redundant pairs. A pair is redundant if its local and remote redundant pairs. A pair is redundant if its local and remote
candidates are identical to the local and remote candidates of a pair candidates are identical to the local and remote candidates of a pair
higher up on the priority list. The result is called the check list higher up on the priority list. The result is called the check list
for that media stream, and each candidate pair on it is called a for that media stream, and each candidate pair on it is called a
check. check.
Each check is also said to have a foundation, which is merely the Each check is also said to have a foundation, which is merely the
combination of the foundations of the local and remote candidates in combination of the foundations of the local and remote candidates in
the check. the check.
Finally, each check in the check list is associated with a state. Each check in the check list is associated with a state. This state
This state is assigned once the check list for each media stream has is assigned once the check list for each media stream has been
been computed. There are five potential values that the state can computed. There are five potential values that the state can have:
have:
Waiting: This check has not been performed, and can be performed as Waiting: This check has not been performed, and can be performed as
soon as it is the highest priority Waiting check on the check soon as it is the highest priority Waiting check on the check
list. list.
In-Progress: A request has been sent for this check, but the In-Progress: A request has been sent for this check, but the
transaction is in progress. transaction is in progress.
Succeeded: This check was already done and produced a successful Succeeded: This check was already done and produced a successful
result. result.
skipping to change at page 23, line 21 skipping to change at page 25, line 46
the first media stream (a media stream is the first media stream when the first media stream (a media stream is the first media stream when
it is described by the first m-line in the SDP offer and answer), and it is described by the first m-line in the SDP offer and answer), and
sets its state to Waiting. It then finds all of the other checks in sets its state to Waiting. It then finds all of the other checks in
that check list with the same component ID, but different that check list with the same component ID, but different
foundations, and sets all of their states to Waiting as well. Once foundations, and sets all of their states to Waiting as well. Once
this is done, one of the check lists will have some number of checks this is done, one of the check lists will have some number of checks
in the Waiting state, and the other check lists will have all of in the Waiting state, and the other check lists will have all of
their checks in the Frozen state. A check list with at least one their checks in the Frozen state. A check list with at least one
check that is not Frozen is called an active check list. check that is not Frozen is called an active check list.
5.7. Performing Periodic Checks The check list itself is associated with a state, which captures the
state of ICE checks for that media stream. There are two states:
Running: In this state, ICE checks are still in progress for this
media stream.
Completed: In this state, the controlling agent has signaled that a
candidate pair has been selected for each component.
Consequently, no further ICE checks are performed.
When a check list is first constructed as the consequence of an
offer/answer exchange, it is placed in the Running state.
ICE processing across all media streams also has a state associated
with it. This state is equal to Running while checks are in
progress. The state is Completed when all checks have been
completed, Rules for transitioning between states are described
below.
6.8. Performing Periodic Checks
An agent performs two types of checks. The first type are periodic An agent performs two types of checks. The first type are periodic
checks. These checks occur periodically for each media stream, and checks. These checks occur periodically for each media stream, and
involve choosing the highest priority check in the Waiting state from involve choosing the highest priority check in the Waiting state from
each check list, and performing it. The other type of check is each check list, and performing it. The other type of check is
called a triggered check. This is a check that is performed on called a triggered check. This is a check that is performed on
receipt of a connectivity check from the peer. This section receipt of a connectivity check from the peer. Full mode agents MUST
describes how periodic checks are performed. generate periodic checks, and all agents MUST generate triggered
checks. This section describes how periodic checks are performed,
and thus applies only to full mode agents.
Once the agent has computed the check lists as described in Once the full-mode agent has computed the check lists as described in
Section 5.6, it sets a timer for each active check list. The timer Section 6.7, it sets a timer for each active check list. The timer
fires every Ta/N seconds, where N is the number of active check lists fires every Ta/N seconds, where N is the number of active check lists
(initially, there is only one active check list). Implementations (initially, there is only one active check list). Implementations
MAY set the timer to fire less frequently than this. Ta is the same MAY set the timer to fire less frequently than this. Ta is the same
value used to pace the gathering of candidates, as described in value used to pace the gathering of candidates, as described in
Section 4.1. The first timer for each active check list fires Section 5.1. The first timer for each active check list fires
immediately, so that the agent performs a connectivity check the immediately, so that the agent performs a connectivity check the
moment the offer/answer exchange has been done, followed by the next moment the offer/answer exchange has been done, followed by the next
periodic check Ta seconds later. periodic check Ta seconds later.
When the timer fires, the agent MUST find the highest priority check When the timer fires, the full-mode agent MUST find the highest
in that check list that is in the Waiting state. The agent then priority check in that check list that is in the Waiting state. The
sends a STUN check from the local candidate of that check to the agent then sends a STUN check from the local candidate of that check
remote candidate of that check. The procedures for forming the STUN to the remote candidate of that check. The procedures for forming
request for this purpose are described in Section 7.7.1. If none of the STUN request for this purpose are described in Section 8.1.1. If
the checks in that check list are in the Waiting state, but there are none of the checks in that check list are in the Waiting state, but
checks in the Frozen state, the highest priority check in the Frozen there are checks in the Frozen state, the highest priority check in
state is moved into the Waiting state, and that check is performed. the Frozen state is moved into the Waiting state, and that check is
When a check is performed, its state is set to In-Progress. If there performed. When a check is performed, its state is set to In-
are no checks in either the Waiting or Frozen state, then the timer Progress. If there are no checks in either the Waiting or Frozen
for that check list is stopped. state, then the timer for that check list is stopped.
Performing the connectivity check requires the agent to know the Performing the connectivity check requires the agent to know the
username fragment for the local and remote candidates, and the username fragment for the local and remote candidates, and the
password for the remote candidate. For periodic checks, the remote password for the remote candidate. For periodic checks, the remote
username fragment and password are learned directly from the SDP username fragment and password are learned directly from the SDP
received from the peer, and the local username fragment is known by received from the peer, and the local username fragment is known by
the agent. the agent.
6. Receipt of the Initial Answer 7. Receipt of the Initial Answer
This section describes the procedures that an agent follows when it This section describes the procedures that an agent follows when it
receives the answer from the peer. It verifies that its peer receives the answer from the peer. It verifies that its peer
supports ICE, forms the check list and begins performing periodic supports ICE, determines its role, forms the check list and begins
checks. performing periodic checks.
6.1. Verifying ICE Support 7.1. Verifying ICE Support
The offerer follows the same procedures described for the answerer in The answerer will proceed with the ICE procedures defined in this
Section 5.1. specification if there is at least one a=candidate attribute for each
media stream in the answer it just received. If this condition is
not met, the agent MUST process the SDP based on normal RFC 3264
procedures, without using any of the ICE mechanisms described in the
remainder of this specification, with the exception of Section 11,
which describes keepalive procedures.
6.2. Forming the Check List 7.2. Determining Role
The offerer follows the same procedures described for the answerer in The offerer follows the same procedures described for the answerer in
Section 5.6. Section 6.2.
6.3. Performing Periodic Checks 7.3. Forming the Check List
The offerer follows the same procedures described for the answerer in The offerer follows the same procedures described for the answerer in
Section 5.7. Section 6.7.
7. Connectivity Checks
This section describes how connectivity checks are performed.
Connectivity checks are a STUN usage, and the behaviors described
here meet the guidelines for definitions of new usages as outlined in
[11]
Note that all ICE implementations are required to be compliant to
[11], as opposed to the older [13].
7.1. Applicability
This STUN usage provides a connectivity check between two peers
participating in an offer/answer exchange. This check serves to
validate a pair of candidates for usage of exchange of media.
Connectivity checks also allow agents to discover reflexive
candidates towards their peers, called peer reflexive candidates.
Finally, connectivity checks serve to keep NAT bindings alive.
It is fundamental to this STUN usage that the addresses and ports
used for media are the same ones used for the Binding Requests and
responses. Consequently, it will be necessary to demultiplex STUN
traffic from whatever the media traffic is. This demultiplexing is
done using the techniques described in [11].
7.2. Client Discovery of Server
The client does not follow the DNS-based procedures defined in [11].
Rather, the remote candidate of the check to be performed is used as
the transport address of the STUN server. Note that the STUN server
is a logical entity, and is not a physically distinct server in this
usage.
7.3. Server Determination of Usage
The server is aware of this usage because it signaled this port
through the offer/answer exchange. Any STUN packets received on this
port will be for the connectivity check usage.
7.4. New Requests or Indications
This usage does not define any new message types.
7.5. New Attributes
This usage defines a new attribute, PRIORITY. This attribute 7.4. Performing Periodic Checks
indicates the priority that is to be associated with a peer reflexive
candidate, should one be discovered by this check. It is a 32 bit
unsigned integer, and has an attribute type of 0x0024.
7.6. New Error Response Codes The offerer follows the same procedures described for the answerer in
Section 6.8.
This usage does not define any new error response codes. 8. Connectivity Checks
7.7. Client Procedures This section describes how connectivity checks are performed. All
ICE implementations are required to be compliant to [11], as opposed
to the older [13].
This section defines additional procedures for the Binding Request 8.1. Client Procedures
transaction, beyond those described in [11].
7.7.1. Sending the Request 8.1.1. Sending the Request
The agent acting as the client generates a connectivity check either The agent acting as the client generates a connectivity check either
periodically, or triggered. In either case, the check is generated periodically, or triggered. In either case, the check is generated
by sending a Binding Request from a local candidate, to a remote by sending a Binding Request from a local candidate, to a remote
candidate. The agent must know the username fragment for both candidate. The agent must know the username fragment for both
candidates and the password for the remote candidate. candidates and the password for the remote candidate.
A Binding Request serving as a connectivity check MUST utilize a STUN A Binding Request serving as a connectivity check MUST utilize a STUN
short term credential. Rather than being learned from a Shared short term credential. Rather than being learned from a Shared
Secret request, the short term credential is exchanged in the offer/ Secret request, the short term credential is exchanged in the offer/
skipping to change at page 26, line 22 skipping to change at page 28, line 32
colon (":"). The password is equal to the password provided by the colon (":"). The password is equal to the password provided by the
peer. For example, consider the case where agent A is the offerer, peer. For example, consider the case where agent A is the offerer,
and agent B is the answerer. Agent A included a username fragment of and agent B is the answerer. Agent A included a username fragment of
AFRAG for its candidates, and a password of APASS. Agent B provided AFRAG for its candidates, and a password of APASS. Agent B provided
a username fragment of BFRAG and a password of BPASS. A connectivity a username fragment of BFRAG and a password of BPASS. A connectivity
check from A to B (and its response of course) utilize the username check from A to B (and its response of course) utilize the username
BFRAG:AFRAG and a password of BPASS. A connectivity check from B to BFRAG:AFRAG and a password of BPASS. A connectivity check from B to
A (and its response) utilize the username AFRAG:BFRAG and a password A (and its response) utilize the username AFRAG:BFRAG and a password
of APASS. of APASS.
All Binding Requests for the connectivity check usage MUST contain A full-mode agent MUST include the PRIORITY attribute in its Binding
the PRIORITY attribute. This MUST be set equal to the priority that Request. This attribute MAY be omitted for passive-only agents. The
would be assigned, based on the algorithm in Section 4.2, to a peer attribute MUST be set equal to the priority that would be assigned,
reflexive candidate learned from this check. Such a peer reflexive based on the algorithm in Section 5.2, to a peer reflexive candidate
candidate has a stream ID, component ID and local preference that are learned from this check. Such a peer reflexive candidate has a
equal to the host candidate from which the check is being sent, but a stream ID, component ID and local preference that are equal to the
type preference equal to the value associated with peer reflexive host candidate from which the check is being sent, but a type
preference equal to the value associated with peer reflexive
candidates. candidates.
The Binding Request by an agent MUST include the USERNAME and The Binding Request by an agent MUST include the USERNAME and
MESSAGE-INTEGRITY attributes. That is, an agent MUST NOT wait to be MESSAGE-INTEGRITY attributes. That is, an agent MUST NOT wait to be
challenged for short term credentials. Rather, it MUST provide them challenged for short term credentials. Rather, it MUST provide them
in the Binding Request right away. in the Binding Request right away.
7.7.2. Processing the Response The controlling agent MAY include the USE-CANDIDATE attribute in the
Binding Request. The passive agent MUST NOT include it in its
Binding Request. This attribute signals that the controlling agent
wishes to cease checks for this component, and use the candidate pair
resulting from the check for this component. Section 9 provides
guidance on determining when to include it.
If the agent is using Diffserv Codepoint markings [25] in its media
packets, it SHOULD apply those same markings to its connectivity
checks.
8.1.2. Processing the Response
If the STUN transaction generates an unrecoverable failure response If the STUN transaction generates an unrecoverable failure response
or times out, the agent sets the state of the check to Failed. The or times out, a full-mode agent sets the state of the check to Failed
(passive-only agents do not maintain the state machinery). The
remainder of this section applies to processing of successful remainder of this section applies to processing of successful
responses (any response from 200 to 299). responses (any response from 200 to 299).
The agent MUST check that the source IP address and port of the The agent MUST check that the source IP address and port of the
response equals the destination IP address and port that the Binding response equals the destination IP address and port that the Binding
Request was sent to, and that the destination IP address and port of Request was sent to, and that the destination IP address and port of
the response match the source IP address and port that the Binding the response match the source IP address and port that the Binding
Request was sent from. If these do not match, the agent sets the Request was sent from. If these do not match, the processing
state of the check to Failed. The processing described in the described in the remainder of this section MUST NOT be performed. In
remainder of this section MUST NOT be performed. addition, a full-mode agent sets the state of the check to Failed.
If the check succeeds, processing continues and the agent changes the If the check succeeds, processing continues. The agent creates a
state for this check to Succeeded. Next, the agent sees if the candidate pair whose local candidate equals the mapped address of the
success of this check can cause other checks to be unfrozen. If the response, and whose remote candidate equals the destination address
check had a component ID of one, the agent MUST change the states for to which the request was sent. This is called a validated pair,
all other Frozen checks for the same media stream and same since it has been validated by a STUN connectivity check. It is very
foundation, but different component IDs, to Waiting. If the important to note that this validated pair will often not be
component ID for the check was equal to the number of components for identical to the check itself; in many cases, the local candidate
the media stream, the agent MUST change the state for all other (learned through the mapped address in the response) will be
Frozen checks for the first component of different media streams (and different than the local candidate the request was sent from.
thus in different check lists) but the same foundation, to Waiting.
Next, the agent checks the mapped address from the STUN response. If Next, the agent computes the priority for the pair based on the
the transport address does not match any of the local candidates that priority of each candidate, using the algorithm in Section 6.7. For
the agent knows about, the mapped address representes a new peer a passive-only agent, the priority of the local candidate is the one
reflexive candidate. Its type is equal to peer reflexive. Its base it signaled for the candidate in its SDP, and the priority of the
is set equal to the candidate from which the STUN check was sent. remote candidate is known either from the SDP, or if not there, from
Its username fragment and password are identical to the candidate the value of the PRIORITY attribute in the Binding Request which
from which the check was sent. It is assigned the priority value triggered the check that just completed. For a full-mode agent, if
that was placed in the PRIORITY attribute of the request. Its the local candidate was not one it signaled in its SDP, the priority
foundation is selected as described in Section 4.1. The peer of the local candidate might additionally be equal to the PRIORITY
reflexive candidate is then added to the list of local candidates attribute the agent placed in the Binding Request which just
known by the agent (though it is not paired with other remote completed.
candidates at this time).
In addition, the agent creates a candidate pair whose local candidate Once the priority of the candidate pair has been computed, the pair
equals the mapped address of the response, and whose remote candidate is added to the valid list for that media stream. If the response is
equals the destination address to which the request was sent. This a consequence of a triggered check, and the request which caused the
is called a validated pair, since it has been validated by a STUN triggered check included the USE-CANDIDATE attribute, the candidate
connectivity check. It is very important to note that this validated pair is additionally marked as selected. If a full-mode agent had
pair will often not be identical to the check itself; in many cases, included the USE-CANDIDATE attribute in the request that produced the
the local candidate (learned through the mapped address in the success response, the agent marks the candidate pair as selected.
response) will be different than the local candidate the request was
sent from. However, the agent will know, either from the SDP or
through the PRIORITY attribute that was present in a STUN request,
the priorities of the local and remote candidates of the validated
pair. Based on these priorities, a priority for the validated pair
itself is computed if it was not already known, using the algorithm
in Section 5.6, and the pair is added to the valid list.
7.8. Server Procedures Next, a full-mode agent updates its ICE states. The full-mode agent
checks the mapped address from the STUN response. If the transport
address does not match any of the local candidates that the agent
knows about, the mapped address representes a new peer reflexive
candidate. Its type is equal to peer reflexive. Its base is set
equal to the candidate from which the STUN check was sent. Its
username fragment and password are identical to the candidate from
which the check was sent. It is assigned the priority value that was
placed in the PRIORITY attribute of the request. Its foundation is
selected as described in Section 5.1. The peer reflexive candidate
is then added to the list of local candidates known by the agent
(though it is not paired with other remote candidates at this time).
Next, the full-mode agent changes the state for this check to
Succeeded. The full-mode agent sees if the success of this check can
cause other checks to be unfrozen. If the check had a component ID
of one, the full-mode agent MUST change the states for all other
Frozen checks for the same media stream and same foundation, but
different component IDs, to Waiting. If the component ID for the
check was equal to the number of components for the media stream, the
full-mode agent MUST change the state for all other Frozen checks for
the first component of different media streams (and thus in different
check lists) but the same foundation, to Waiting.
8.2. Server Procedures
An agent MUST be prepared to receive a Binding Request on the base of An agent MUST be prepared to receive a Binding Request on the base of
each candidate it included in its most recent offer or answer. each candidate it included in its most recent offer or answer.
Receipt of a Binding Request on a transport address that the agent Receipt of a Binding Request on a transport address that the agent
had included in a candidate attribute is an indication that the had included in a candidate attribute is an indication that the
connectivity check usage applies to the request. connectivity check usage applies to the request.
The agent MUST use a short term credential to authenticate the The agent MUST use a short term credential to authenticate the
request and perform a message integrity check. The agent MUST accept request and perform a message integrity check. The agent MUST accept
a credential if the username consists of two values separated by a a credential if the username consists of two values separated by a
skipping to change at page 28, line 23 skipping to change at page 31, line 13
For requests being received on a relayed candidate, the source For requests being received on a relayed candidate, the source
transport address used for STUN processing (namely, generation of the transport address used for STUN processing (namely, generation of the
XOR-MAPPED-ADDRESS attribute) is the transport address as seen by the XOR-MAPPED-ADDRESS attribute) is the transport address as seen by the
relay. That source transport address will be present in the REMOTE- relay. That source transport address will be present in the REMOTE-
ADDRESS attribute of a STUN Data Indication message, if the Binding ADDRESS attribute of a STUN Data Indication message, if the Binding
Request was delivered through a Data Indication. If the Binding Request was delivered through a Data Indication. If the Binding
Request was not encapsulated in a Data Indication, that source Request was not encapsulated in a Data Indication, that source
address is equal to the current active destination for the STUN relay address is equal to the current active destination for the STUN relay
session. session.
When the agent receives a STUN Binding Request for which it generates If the agent is using Diffserv Codepoint markings [25] in its media
a successful response, the agent checks the source transport address packets, it SHOULD apply those same markings to its responses to
of the request. If this transport address does not match any Binding Requests.
existing remote candidates, it represents a new peer reflexive remote
candidate. This candidate is given a priority equal to the PRIORITY
attribute from the request. The type of the candidate is equal to
peer reflexive. Its foundation is set to an arbitrary value,
different from the foundation for all other remote candidates. The
username fragment for this candidate is equal to the bottom half (the
part after the colon) of the username in the Binding Request that was
just received. The password for this username fragment is taken from
the SDP from the peer. If agent has not yet received this SDP (a
likely case for the offerer in the initial offer/answer exchange), it
MUST wait for the SDP to be received, and then proceed with rest of
the processing described in the remainder of this section. This
candidate is then added to the list of remote candidates. However,
it is not paired with any local candidates.
Next, the agent MUST generate a triggered check in the reverse If the STUN request resulted in an error response, no further
processing is performed.
Otherwise, the agent MUST generate a triggered check in the reverse
directon if it has not already sent such a check. The triggered directon if it has not already sent such a check. The triggered
check has a local candidate equal to the candidate on which the STUN check has a local candidate equal to the candidate on which the STUN
request was received, and a remote candidate equal to the source request was received, and a remote candidate equal to the source
transport address where the request came from (which may be a newly transport address where the request came from (which may not be
formed peer reflexive candidate). The agent knows the priorities for amongst the candidates signaled previously from the peer in its SDP).
the local and remote candidates of this check, and so can compute the The username fragment and password of the peer are readily determined
priority for the check itself. If there is already a check on the from the SDP and from the check that was just received. The username
check list with this same local and remote candidates, and the state fragment for this candidate is equal to the bottom half (the part
of that check is Waiting or Frozen, its state is changed to In- after the colon) of the USERNAME in the Binding Request that was just
Progress and the check is performed. If there was already a check on received. Using that username fragment, the agent can check the SDP
the check list with this same local and remote candidates, and its messages received from its peer (there may be more than one in cases
state was In-Progress, the agent SHOULD generate an immediate of forking), and find this username fragment. The corresponding
retransmit of the Binding Request. This is to facilitate rapid password is then selected. If agent has not yet received this SDP (a
completion of ICE when both agents are behind NAT. If there was a likely case for the offerer in the initial offer/answer exchange), it
check in the list already and its state was Succeeded or Failed, MUST wait for the SDP to be received, and then proceed with the
nothing further is done. If there was no matching check on the check triggered check and the rest of the processing described in the
list, it is inserted into the check list based on its priority, its remainder of this section.
state is set to In-Progress, and the check is performed.
7.9. Security Considerations for Connectivity Check The remainder of the processing in this section applies to state
updates performed by full-mode agents.
Security considerations for the connectivity check are discussed in If the source transport address of the request does not match any
Section 15. existing remote candidates, it represents a new peer reflexive remote
candidate. The full-mode agent gives the candidate a priority equal
to the PRIORITY attribute from the request. The type of the
candidate is equal to peer reflexive. Its foundation is set to an
arbitrary value, different from the foundation for all other remote
candidates. This candidate is then added to the list of remote
candidates. However, the full-mode agent does not pair this
candidate with any local candidates.
8. Completing the ICE Checks A full-mode agent knows the priorities for the local and remote
candidates of the triggered check described above, and so can compute
the priority for the check itself. If there is already a check on
the check list with this same local and remote candidates, and the
state of that check is Waiting or Frozen, its state is changed to In-
Progress. If there was already a check on the check list with this
same local and remote candidates, and its state was In-Progress, the
agent SHOULD generate an immediate retransmit of the Binding Request.
This is to facilitate rapid completion of ICE when both agents are
behind NAT. If there was a check in the list already and its state
was Succeeded, and the Binding Request just received contained the
USE-CANDIDATE attribute, it means that the pair resulting from that
previous check has been selected. The agent MUST take the candidate
pair in the valid list that was learned from that previous successful
check, and mark it as selected. If there was a check on the check
list with this same local and remote candidates, and its state was
Failed, nothing further is done. If there was no matching check on
the check list, it is inserted into the check list based on its
priority, and its state is set to In-Progress.
When a pair is added to the valid list, and the agent was the offeror 9. Concluding ICE
in the most recent offer/answer exchange, the agent MUST check to see
if there is a pair on the validated list for each component of each
media stream. If there is, the offeror MUST stop timer Ta, and MUST
cease retransmitting any Binding Requests for transactions in
progress. It MUST ignore any responses which may subsequently arrive
to transactions previously in progress. The offeror MUST generate an
updated offer as described in Section 9. It does this regardless of
whether the highest priority pairs in the check list match the
current in-use candidate pairs.
When a pair is aded to the valid list, and the agent was the answerer Concluding ICE involves selection of pairs by the controlling agent,
in the most recent offer/answer exchange, the agent MAY begin sending updating of state machinery by full-mode agents, and possibly the
media using that candidate pair, as described in Section 11.1. In generation of an updated offer by the controlling agent. Since a
addition, if there is a candidate pair on the valid list for each passive-only agent can never be in the controlling role, the
component of each media stream, the answerer MUST stop timer Ta, and processing in this section only applies to full-mode agents.
MUST cease retransmitting any Binding Requests for transactions in
progress. It MUST ignore any responses which may subsequently arrive
to transactions previously in progress.
Note that only agent that was the answerer in the most recent offer/ The controlling agent can use any algorithm it likes for deciding
answer exchange gets to send media right away. The offeror must wait when to select a candidate pair. However, it MUST eventually include
for a subsequent offer/answer exchange if the valid candidates don't a USE-CANDIDATE attribute in a check for each component of each media
match those in the m/c-line. stream. The following trivial algorithm chooses the first candidate
pair that validates for each media stream: the controlling agent
includes the USE-CANDIDATE attribute in every check it sends.
OPEN ISSUE: It is possible that higher priority checks may still Once a candidate pair in the Valid list is marked as selected, a
succeed, if we allowed things to continue. This can happen for full-mode agent MUST NOT generate any further periodic checks for
several reasons. First, an in-progress check of higher priority that component of that media stream, and SHOULD cease any
had some packet loss and thus hasn't completed. Timer Tws was retransmissions in progress for checks for that component of that
meant to handle this (I removed this timer from -10 to simplify). media stream. Once there is at least one candidate pair for each
More interestingly, higher priority checks may have not been done component of a media stream that is marked as selected, a full-mode
because a triggered check of lower priority succeeded. This agent MUST change the state of processing for its check list to
happens in cases where the number of checks at each agent are Completed. Once all of the media streams enter the Completed state,
assymetric. It is possible to fix both of these problems by the controlling agent takes the highest priority candidate pair for
delaying the completion of the ICE procedures for a bit more time. each component of each media stream which has been marked as
This adds complexity and latency. The basic algorithm would be selected. If any of those candidate pairs differ from the in-use
this. You take the lowest priority pair in the valid list. You candidates in m/c-lines of the most recent offer/answer exchange, the
keep doing checks as long as there are higher priority checks on controlling agent MUST generate an updated offer as described in
the list in the Waiting state. If there are none, you wait a Section 10.
brief time (say 50ms) and then consider ICE finished.
9. Subsequent Offer/Answer Exchanges 10. Subsequent Offer/Answer Exchanges
An agent MAY generate a subsequent offer at any time. However, the An agent MAY generate a subsequent offer at any time. However, the
rules in Section 7.7.2 will cause the offerer to generate an updated rules in Section 9 will cause the controlling agent to send an
offer when the candidates in the valid list are not all in-use. updated offer at the conclusion of ICE processing when ICE has
selected different candidate pairs from the in-use pairs.
9.1. Generating the Offer 10.1. Generating the Offer
When an agent generates an updated offer, the set of candidate An agent MAY change the ice-pwd and/or ice-ufrag for a media stream
attributes to include depend on the state of ICE processing. If ICE in an offer. Doing so is a signal to restart ICE processing for that
is "done", which occurs when the valid list includes a candidate pair media stream. When an agent restarts ICE for a media stream, it MUST
for each component of each media stream, the agent MUST include a NOT include the a=remote-candidates attribute, since the state of the
candidate attribute for each local candidate amongst the pairs in the media stream would not be Completed at this point. Note that it is
valid list (including peer reflexive candidates), and SHOULD NOT permissible to use a session-level attribute in one offer, but to
include any others. This will cause STUN keepalives to be sent for provide the same password as a media-level attribute in a subsequent
the in-use candidates, and thats it. offer. This is not a change in password, just a change in its
representation.
If, however, the valid list does not yet include a candidate pair for An agent MUST restart ICE processing if the offer is being generated
each component of each media stream, the agent SHOULD include all for the purposes of changing the target of the media stream. In
current candidates, including any peer reflexive candidates it has other words, if an agent wants to generated an updated offer which,
learned since the last offer or answer it sent. This MAY include had ICE not been in use, would result in a new value for the
candidates it did not offer previously, but which it has gathered transport address in the m/c-line, the agent MUST restart ICE for
since the last offer/answer exchange. that media stream. This implies that setting the IP address in the c
line to 0.0.0.0 will cause an ICE restart. Consequently, ICE
implementations SHOULD NOT utilize this mechanism for call hold, and
instead use a=inactive as described in [4]
If an agent removes a media stream by setting its port to zero, it
MUST NOT include any candidate attributes for that media stream.
When a full-mode agent generates an updated offer, the set of
candidate attributes to include for each media stream depend on the
state of ICE processing for that media stream. If the processing for
that media stream is in the Completed state, a full-mode agent MUST
include a candidate attribute for the local candidate of each pair
that has been chosen for use by ICE for that media stream. A pair is
chosen if it is the highest priority selected pair in the valid list
for a component of that media stream. A full-mode agent SHOULD NOT
include any other candidate attributes for that media stream. If ICE
processing for a media stream is in the Running state, the agent MUST
include all current candidates (including peer reflexive candidates
learned through ICE processing) for that media stream. It MAY
include candidates it did not offer previously, but which it has
gathered since the last offer/answer exchange. If a media stream is
new or ICE checks are restarting for that stream, a full-mode agent
includes the set of candidates it wishes to utilize. This MAY
include some, none, or all of the previous candidates for that stream
in the case of a restart, and MAY include a totally new set of
candidates gathered as described in Section 5.1.
A passive-only agent includes its one and only candidate for each
component of each media stream in an a=candidate attribute in any
subsequent offer.
If a candidate was sent in a previous offer/answer exchange, it If a candidate was sent in a previous offer/answer exchange, it
SHOULD have the same priority. For a peer reflexive candidate, the SHOULD have the same priority. For a peer reflexive candidate, the
priority SHOULD be the same as determined by the processing in priority SHOULD be the same as determined by the processing in
Section 7.7.2. The foundation SHOULD be the same. The username Section 8.1.2. The foundation SHOULD be the same. The username
fragments and passwords for a media stream SHOULD remain the same as fragments and passwords for a media stream SHOULD remain the same as
the previous offer or answer. the previous offer or answer.
Population of the m/c-lines also depends on the state of ICE Population of the m/c-lines for full-mode agents also depends on the
processing. If, for a particular media stream, the valid list has state of ICE processing. If ICE processing for a media stream is in
candidate pairs for all of the components of that media stream, those the Completed state, the m/c-line MUST use the local candidate from
pairs are used. In particular, the m/c-line would be constructed by the highest priority selected pair in the valid list for each
from the local candidate from each of those candidate pairs. In component of that media stream. If ICE processing is in the Running
addition, the agent MUST include the a=remote-candidates attribute state, a full-mode agent SHOULD populate the m/c-line for that media
for that media stream, and include in it the remote candidates for stream based on the considerations in Section 5.3.
each of the pairs that were used.
If, for a particular media stream, the valid list does not have pairs A passive agent populates the m/c-lines with its one and only one
for all of the components of the stream, the agent SHOULD populate candidate for each component of each media stream.
the m/c-line for that media stream based on the considerations in
Section 4.3.
The agent MUST use the same ice-pwd and ice-ufrag for a media stream In addition, the controlling agent MUST include the a=remote-
as its previous offer or answer. Note that it is permissible to use candidates attribute for each media stream that is in the Completed
a session-level attribute in one offer, but to provide the same state. The attribute contains the remote candidates from the highest
password as a media-level attribute in a subsequent offer. This is priority selected pair in the valid list for each component of that
not a change in password, just a change in its representation. media stream.
9.2. Receiving the Offer and Generating an Answer An agent MUST NOT change its mode (passive-only or full) by adding or
removing the a=ice-passive attribute from an updated offer, unless
ICE processing is being restarted for all media streams in the offer.
Note that an agent can add a new media stream at any time, even if
ICE has long finished for the existing media streams. Based on the
rules described here, checks will begin for this new stream as if it
was in an initial offer.
10.2. Receiving the Offer and Generating an Answer
When receiving a subsequent offer within an existing session, an
agent MUST re-apply the verification procedures in Section 6.1
without regard to the results of verification from any previous
offer/answer exchanges. Indeed, it is possible that a previous
offer/answer exchange resulted in ICE not being used, but it is used
as a consequence of a subsequent exchange.
When the answerer generates its answer, it must decide what When the answerer generates its answer, it must decide what
candidates to include in the answer, and how to populate the m/c- candidates to include in the answer, how to populate the m/c-line,
line. and how to adjust the states of ICE processing.
For each media stream in the offer, the agent checks to see if the The rules for inclusion of candidate attributes in an answer are
stream contained the remote-candidates attribute. If it did, it identical to the rules followed by the offerer as described in
means that the offerer believed that ICE processing has completed for Section 10.1.
However, the rules for setting the contents of the m/c-line are
different. For a full-mode agent, processing of the offer depends on
the presence or absence of the a=remote-candidates attribute in a
media stream. If present, it means that the offerer (acting as the
controlling agent) believed that ICE processing has completed for
that media stream. In this case, the remote-candidates attribute that media stream. In this case, the remote-candidates attribute
contains the candidates that the answerer is supposed to use. It is contains the candidates that the answerer is supposed to use. It is
possible that the agent doesn't even know of these candidates yet; possible that the agent doesn't even know of these candidates yet;
they will be discovered shortly through a response to an in-progress they will be discovered shortly through a response to an in-progress
check. The agent MUST populate the m/c-line with the candidates from check. The full-mode agent MUST populate the m/c-line with the
the a=remote-candidates attribute. In addition, it MUST include an candidates from the a=remote-candidates attribute.
a=candidate attribute in its answer for each candidate in the
a=remote-candidates attribute. If the agent is not aware of the
candidate yet, it will need to generate a priority value for it. The
type preference in the computation is peer-reflexive, and the stream
ID and component ID are known from the offer. The agent chooses an
arbitrary local preference value if it is multi-homed, since it won't
yet know the interface associated with this candidate.
If a media stream does not yet contain the a=remote-candidates If the offer did not contain the a=remote-candidates attribute, or
attribute, it means that the offerer believes that ICE checks are the agent is a passive-only agent, the agent follows the same
still in progress for that media stream. In this case, the answerer procedures for populating the m/c-line as described for the offerer
SHOULD include an a=candidate attribute for all of the candidates for in Section 10.1.
that media stream it knows about (including peer-reflexive
candidates). The m/c-line is populated based on the considerations
in Section 4.3.
Construction of the ice-pwd and ice-ufrag are identical to the An agent MUST NOT include the a=remote-candidates attribute in an
procedures followed by the offerer, as described in Section 9.1. answer. An agent MUST NOT change the a=ice-ufrag or a=ice-pwd
attributes in an answer relative to the last SDP it provided. Such a
change can only take place in an offer. However, if the offer
contained a change in the a=ice-ufrag or a=ice-pwd attributes
compared to the previous SDP from the peer, it is a signal that ICE
is restarting for this media stream.
Note that the a=remote-candidates attribute SHOULD NOT be included in An agent MUST NOT change its mode from a previous answer unless,
the answer, and if included, will just be ignored by the offerer, based on the offer, ICE procedures are being restarted for all media
since it is not used in any processing of the answer. streams in the offer. In that case, it MAY change its mode.
9.3. Updating the Check and Valid Lists 10.3. Updating the Check and Valid Lists
Once the subsequent offer/answer exchange has completed, each agent Once the subsequent offer/answer exchange has completed, each agent
needs to compute the new check lists resulting from this exchange, needs to determine the impact, if any, on the Check and Valid lists.
and then remove any pairs from the valid list which are no longer Unless there is an ICE restart, an offer/answer exchange has no
usable. Once these adjustments are made, ICE processing continues impact on the state of ICE processing for each media stream; that is
using these new lists. determined entirely by the checks themselves. An updated offer/
answer exchange can impact the transmission rules for media, as
described in Section 12.1.
Each agent recomputes the check lists using the procedures described If the offer had a change in the ice-ufrag and/or ice-pwd for a media
in Section 5.6. If a check on the new check lists was also on the stream, the agent MUST start a new Valid list for that media stream.
previous check lists, and its state was Waiting, In-Progress, However, it retains the old Valid list for the purposes of sending
media until ICE processing completes, at which point the old Valid
list is discarded and the new one is utilized to determine media and
keepalive targets. A full-mode agent MUST also flush the check list
for the affected media streams, and then recompute the check list and
its states as described in Section 6.7.
If the subsequent offer added a new media stream, a full-mode agent
MUST create a new check list for it (and an empty Valid list to start
of course), as described in Section 6.7.
If the subsequent offer removed a media stream, or an answer rejected
an offered media stream, an agent MUST flush the Valid list for that
media stream. It MUST terminate any STUN transactions in progress
for that media stream. A full-mode agent MUST remove the check list
for that media stream and cancel any pending periodic checks for it.
If a media stream existed previously, and remains after the offer/
answer exchange, the agent MUST NOT modify the Valid list for that
media stream. However, if a full-mode agent is in the Running state
for that media stream, the check list is updated. To do that, the
full-mode agent recomputes the check lists using the procedures
described in Section 6.7. If a check on the new check lists was also
on the previous check lists, and its state was Waiting, In-Progress,
Succeeded or Failed, its state is copied over. If a check on the new Succeeded or Failed, its state is copied over. If a check on the new
check lists does not have a state (because its a new check on an check lists does not have a state (because its a new check on an
existing check list, or a check on a new check list, or the check was existing check list, or a check on a new check list, or the check was
on an old check list but its state was not copied over) its state is on an old check list but its state was not copied over) its state is
set to Frozen. set to Frozen.
If none of the check lists are active (meaning that the checks in If none of the check lists are active (meaning that the checks in
each check list are Frozen), the agent sets the first check in the each check list are Frozen), the full-mode agent sets the first check
check list for the first media stream to Waiting, and then sets the in the check list for the first media stream to Waiting, and then
state of all other checks in that check list for the same component sets the state of all other checks in that check list for the same
ID and with the same foundation to Waiting as well. component ID and with the same foundation to Waiting as well.
Next, the agent goes through each check list, starting with the Next, the full-mode agent goes through each check list, starting with
highest priority check. If a check has a state of Succeeded, and it the highest priority check. If a check has a state of Succeeded, and
has a component ID of 1, then all Frozen checks in the same check it has a component ID of 1, then all Frozen checks in the same check
list with the same foundation whose component IDs are not one, have list with the same foundation whose component IDs are not one, have
their state set to Waiting. If, for a particular check list, there their state set to Waiting. If, for a particular check list, there
are checks for each component of that media stream in the Succeeded are checks for each component of that media stream in the Succeeded
state, the agent moves the state of all Frozen checks for the first state, the agent moves the state of all Frozen checks for the first
component of all other media streams (and thus in different check component of all other media streams (and thus in different check
lists) with the same foundation to Waiting. lists) with the same foundation to Waiting.
If a check was on the old check list, but was not on the new check 11. Keepalives
list, and had a state of In-Progress, the corresponding STUN
transaction is abandoned. No further retransmits will be sent for
the STUN request, and any response that might be received is ignored.
Next, the agent prunes the valid list. For each pair on the valid
list, the agent examines each candidate in the pair. If the
candidate was not peer reflexive, and was not present in the most
recent offer/answer exchange, the candidate pair is removed from the
valid list.
OPEN ISSUE: This means that you cannot forcefully remove a peer
reflexive candidate. This feature was possible, at much
complexity, in previous versions of the spec. An alternative is
to remove a peer reflexive candidate if it was not present in the
offer/answer, and was discovered more than 500ms ago.
10. Keepalives
STUN connectivity checks are also used to keep NAT bindings open once STUN connectivity checks are also used to keep NAT bindings open once
a session is underway. This is accomplished by periodically re- ICE processing has completed. This is accomplished by periodically
starting the check process, as described in this section. generating a check on the candidate pair currently being used for
media.
Once the initial offer/answer exchange has taken place, the agent Specifically, once ICE processing allows media to begin flowing, as
sets a timer to fire in Tr seconds. Tr SHOULD be configurable and described in Section 12.1, the agent sets a timer to fire in Tr
SHOULD have a default of 15 seconds. When Tr fires, the agent MUST seconds. Tr SHOULD be configurable and SHOULD have a default of 15
reset the states for all of the checks in the check list using the seconds. When Tr fires, the agent creates a connectivity check for
procedures defined in Section 5.6 and then begin performing periodic each component of that media stream. This check is sent on the
checks as described in Section 5.7. By the time the timer fires for candidate pair currently being used to send media, as described in
the first time, the check list will include only the in-use Section 12.1.
candidates. Reperforming these checks will therefore performing a
period keepalive.
OPEN ISSUE: ICE isn't saying anything about what happens if these This specification makes no recommendations on the behaviors should
periodic keepalives should fail. It they do, something really bad the keepalive itself fail. However, an agent SHOULD NOT blindly
has happened, like a NAT reboot or failure. I think we should restart ICE processing for that stream; if the keepalive was lost due
keep that out of scope. to congestion, the ICE restart will only aggravate the problem.
When an ICE agent is communicating with an agent that is not ICE- When an ICE agent is communicating with an agent that is not ICE-
aware, keepalives still need to be utilized. Indeed, these aware, keepalives still need to be utilized. Indeed, these
keepalives are essential even if neither endpoint implements ICE. As keepalives are essential even if neither endpoint implements ICE. As
such, this specification defines keepalive behavior generally, for such, this specification defines keepalive behavior generally, for
endpoints that support ICE, and those that do not. endpoints that support ICE, and those that do not.
All endpoints MUST send keepalives for each media session. These All endpoints MUST send keepalives for each media session. These
keepalives MUST be sent regardless of whether the media stream is keepalives MUST be sent regardless of whether the media stream is
currently inactive, sendonly, recvonly or sendrecv. The keepalive currently inactive, sendonly, recvonly or sendrecv, and regardless of
the presence or value of the bandwidth attribute. The keepalive
SHOULD be sent using a format which is supported by its peer. ICE SHOULD be sent using a format which is supported by its peer. ICE
endpoints allow for STUN-based keepalives for UDP streams, and as endpoints allow for STUN-based keepalives for UDP streams, and as
such, STUN keepalives MUST be used when an agent is communicating such, STUN keepalives MUST be used when an agent is communicating
with a peer that supports ICE. An agent can determine that its peer with a peer that supports ICE. An agent can determine that its peer
supports ICE by the presence of the a=candidate attributes for each supports ICE by the presence of a=candidate attributes for each media
media session. If the peer does not support ICE, the choice of a session. If the peer does not support ICE, the choice of a packet
packet format for keepalives is a matter of local implementation. A format for keepalives is a matter of local implementation. A format
format which allows packets to easily be sent in the absence of which allows packets to easily be sent in the absence of actual media
actual media content is RECOMMENDED. Examples of formats which content is RECOMMENDED. Examples of formats which readily meet this
readily meet this goal are RTP No-Op [27] and RTP comfort noise [23]. goal are RTP No-Op [27] and RTP comfort noise [23]. If the peer
If the peer doesn't support any formats that are particularly well doesn't support any formats that are particularly well suited for
suited for keepalives, an agent SHOULD send RTP packets with an keepalives, an agent SHOULD send RTP packets with an incorrect
incorrect version number, or some other form of error which would version number, or some other form of error which would cause them to
cause them to be discarded by the peer. be discarded by the peer.
STUN-based keepalives will be sent periodically every Tr seconds as STUN-based keepalives will be sent periodically every Tr seconds as
described above. If STUN keepalives are not in use (because the peer described above. If STUN keepalives are not in use (because the peer
does not support ICE), an agent SHOULD ensure that a media packet is does not support ICE), an agent SHOULD ensure that a media packet is
sent every Tr seconds. If one is not sent as a consequence of normal sent every Tr seconds. If one is not sent as a consequence of normal
media communications, a keepalive packet using one of the formats media communications, a keepalive packet using one of the formats
discussed above SHOULD be sent. discussed above SHOULD be sent.
11. Media Handling 12. Media Handling
11.1. Sending Media 12.1. Sending Media
Agents always send media using a candidate pair. An agent will send Agents always send media using a candidate pair. An agent will send
media to the remote candidate in the pair (setting the destination media to the remote candidate in the pair (setting the destination
address and port of the packet equal to that remote candidate), and address and port of the packet equal to that remote candidate), and
will send it from the local candidate. When the local candidate is will send it from the local candidate. When the local candidate is
server or peer reflexive, media is originated from the base. Media server or peer reflexive, media is originated from the base. Media
sent from a relayed candidate is sent through that relay, using sent from a relayed candidate is sent through that relay, using
procedures defined in [12]. procedures defined in [12].
If an agent was the offerer in the most recent offer/answer exchange, If the state of a media stream is Running, there is no old Valid list
when it sends media, it MUST use the candidates in the m/c-line for for that media stream (which would be due to an ICE restart), a full-
each media stream. However, it MUST only send media once those mode agent MUST NOT send media. For passive-only agents, which do
candidates also appear in the valid list. If the candidates in the not retain states about ICE processing, it MUST NOT send media until
m/c-line are not the ones that are ultimately selected by ICE, this there is a selected candidate pair in either the old or new Valid
implies that the offerer will need to wait for the subsequent offer/ list for each component of the media stream.
answer exchange to complete before it can send media.
If an agent was the answerer in the most recent offer/answer
exchange, the rules are different. When the agent wishes to send
media, and the candidate pairs in the m/c-lines are also the highest
priority ones in the valid list for each media stream, it uses those
candidate pairs. If, however, the highest priority pairs in the
valid list for a media stream are not the same as the ones in the
m/c-lines, the agent MUST use the highest priority pairs in the valid
list. However, the agent MUST discontinue using those candidate
pairs Tlo seconds after the next opportunity its peer would have to
send an updated offer. In the case of an answer delivered in a 200
OK to an offer in a SIP INVITE (regardless of whether that same
answer appeared in an earlier unreliable provisional response), this
would be Tlo seconds after receipt of the ACK. Tlo SHOULD be
configurable and SHOULD have a default of 5 seconds. This time
represents the amount of time it should take the offerer to perform
its connectivity checks, arrive at the same conclusion about the
candidate pair, and then generate an updated offer. If, after Tlo
seconds, no updated offer arrives, the answerer MUST cease sending
media, and will need to wait for the updated offer.
OPEN ISSUE: In previous versions of ICE, once this timer fired, When an agent sends media, it MUST send it using the highest priority
you just sent media to the one in the m/c-line. This causes the selected pair for each component in either the old Valid list for a
media streams to flip back and forth between addresses, which I am media stream (if it exists), else the new Valid list for that media
trying to avoid. Since this timer should never go off anyway, I stream. In several cases, this will not be the same candidate pairs
removed this feature. present in the m/c-line. When ICE first completes, if the selected
pairs aren't a match for the m/c-line, an updated offer/answer
exchange will take place to remedy this disparity. However, until
that update offer arrives, there will not be a match. Furthermore,
in very unusual cases, the m/c-lines in the updated offer/answer will
not be a match.
ICE has interactions with jitter buffer adaptation mechanisms. An ICE has interactions with jitter buffer adaptation mechanisms. An
RTP stream can begin using one candidate, and switch to another one, RTP stream can begin using one candidate, and switch to another one,
though this happens rarely with ICE. The newer candidate may result though this happens rarely with ICE. The newer candidate may result
in RTP packets taking a different path through the network - one with in RTP packets taking a different path through the network - one with
different delay characteristics. As discussed below, agents are different delay characteristics. As discussed below, agents are
encouraged to re-adjust jitter buffers when there are changes in encouraged to re-adjust jitter buffers when there are changes in
source or destination address. Furthermore, many audio codecs use source or destination address. Furthermore, many audio codecs use
the marker bit to signal the beginning of a talkspurt, for the the marker bit to signal the beginning of a talkspurt, for the
purposes of jitter buffer adaptation. For such codecs, it is purposes of jitter buffer adaptation. For such codecs, it is
RECOMMENDED that the sender change the marker bit when an agent RECOMMENDED that the sender change the marker bit when an agent
switches transmission of media from one candidate pair to another. switches transmission of media from one candidate pair to another.
11.2. Receiving Media 12.2. Receiving Media
ICE implementations MUST be prepared to receive media on any ICE implementations MUST be prepared to receive media on any
candidates provided in the most recent offer/answer exchange. candidates provided in the most recent offer/answer exchange.
It is RECOMMENDED that, when an agent receives an RTP packet with a It is RECOMMENDED that, when an agent receives an RTP packet with a
new source or destination IP address for a particular media stream, new source or destination IP address for a particular media stream,
that the agent re-adjust its jitter buffers. that the agent re-adjust its jitter buffers.
RFC 3550 [20] describes an algorithm in Section 8.2 for detecting RFC 3550 [20] describes an algorithm in Section 8.2 for detecting
SSRC collisions and loops. These algorithms are based, in part, on SSRC collisions and loops. These algorithms are based, in part, on
seeing different source transport addresses with the same SSRC. seeing different source transport addresses with the same SSRC.
However, when ICE is used, such changes will sometimes occur as the However, when ICE is used, such changes will sometimes occur as the
media streams switch between candidates. An agent will be able to media streams switch between candidates. An agent will be able to
determine that a media stream is from the same peer as a consequence determine that a media stream is from the same peer as a consequence
of the STUN exchange that proceeds media transmission. Thus, if of the STUN exchange that proceeds media transmission. Thus, if
there is a change in source transport address, but the media packets there is a change in source transport address, but the media packets
come from the same peer agent, this SHOULD NOT be treated as an SSRC come from the same peer agent, this SHOULD NOT be treated as an SSRC
collision. collision.
12. Usage with SIP 13. Usage with SIP
12.1. Latency Guidelines 13.1. Latency Guidelines
ICE requires a series of STUN-based connectivity checks to take place ICE requires a series of STUN-based connectivity checks to take place
between endpoints. These checks start from the answerer on between endpoints. These checks start from the answerer on
generation of its answer, and start from the offerer when it receives generation of its answer, and start from the offerer when it receives
the answer. These checks can take time to complete, and as such, the the answer. These checks can take time to complete, and as such, the
selection of messages to use with offers and answers can effect selection of messages to use with offers and answers can effect
perceived user latency. Two latency figures are of particular perceived user latency. Two latency figures are of particular
interest. These are the post-pickup delay and the post-dial delay. interest. These are the post-pickup delay and the post-dial delay.
The post-pickup delay refers to the time between when a user "answers The post-pickup delay refers to the time between when a user "answers
the phone" and when any speech they utter can be delivered to the the phone" and when any speech they utter can be delivered to the
skipping to change at page 36, line 31 skipping to change at page 40, line 14
If an offer is received in an INVITE request, the callee SHOULD If an offer is received in an INVITE request, the callee SHOULD
immediately gather its candidates and then generate an answer in a immediately gather its candidates and then generate an answer in a
provisional response. When reliable provisional responses are not provisional response. When reliable provisional responses are not
used, the SDP in the provisional response is the answer, and that used, the SDP in the provisional response is the answer, and that
exact same answer reappears in the 200 OK. To deal with possible exact same answer reappears in the 200 OK. To deal with possible
losses of the provisional response, it SHOULD be retransmitted until losses of the provisional response, it SHOULD be retransmitted until
some indication of receipt. This indication can either be through some indication of receipt. This indication can either be through
PRACK [9], or through the receipt of a successful STUN Binding PRACK [9], or through the receipt of a successful STUN Binding
Request. Even if PRACK is not used, the provisional response SHOULD Request. Even if PRACK is not used, the provisional response SHOULD
be retransmitted using the exponential backoff described in [9]. be retransmitted using the exponential backoff and timers described
Furthermore, once the answer has been sent, the agent SHOULD begin in [9]. Note, however, that if PRACK is not used, the rules for when
its connectivity checks. Once candidate pairs for each component of an agent can send an updated offer or answer do not change from those
a media stream enter the valid list, the callee can begin sending specified in RFC 3262, even though the provisional response has been
media on that media stream. delivered "reliably". Specifically, if the offer contained an
INVITE, the same answer appears in all of the 1xx and in the 2xx
response to the INVITE. Only after that 2xx has been sent can an
updated offer/answer exchange occur.
Once the answer has been sent, the agent SHOULD begin its
connectivity checks. Once candidate pairs for each component of a
media stream enter the valid list, the callee can begin sending media
on that media stream.
However, prior to this point, any media that needs to be sent towards However, prior to this point, any media that needs to be sent towards
the caller (such as SIP early media [25] cannot be transmitted. For the caller (such as SIP early media [24] cannot be transmitted. For
this reason, implementations SHOULD delay alerting the called party this reason, implementations SHOULD delay alerting the called party
until candidates for each component of each media stream have entered until candidates for each component of each media stream have entered
the valid list. In the case of a PSTN gateway, this would mean that the valid list. In the case of a PSTN gateway, this would mean that
the setup message into the PSTN is delayed until this point. Doing the setup message into the PSTN is delayed until this point. Doing
this increases the post-dial delay, but has the effect of eliminating this increases the post-dial delay, but has the effect of eliminating
'ghost rings'. Ghost rings are cases where the called party hears 'ghost rings'. Ghost rings are cases where the called party hears
the phone ring, picks up, but hears nothing and cannot be heard. the phone ring, picks up, but hears nothing and cannot be heard.
This technique works without requiring support for, or usage of, This technique works without requiring support for, or usage of,
preconditions [6], since its a localized decision. It also has the preconditions [6], since its a localized decision. It also has the
benefit of guaranteeing that not a single packet of media will get benefit of guaranteeing that not a single packet of media will get
clipped, so that post-pickup delay is zero. If an agent chooses to clipped, so that post-pickup delay is zero. If an agent chooses to
delay local alerting in this way, it SHOULD generate a 180 response delay local alerting in this way, it SHOULD generate a 180 response
once alerting begins. once alerting begins.
Based on the rules in Section 11.1, the offerer will not be able to As discussed in Section 16, offer/answer exchanges SHOULD be secured
send media until the highest priority valid candidates match the m/c-
line. When used with SIP, if the initial offer is sent in the
INVITE, and the answer is sent in both the provisional and final 200
OK response, the offerer will generally not be able to send media
until it sends a re-INVITE and receives the 200 OK response to that
re-INVITE. This can take several hundred milliseconds. If this
latency is an issue (it is generally not considered an issue for
voice systems), reliable provisional responses [9] MAY be used, in
which case an UPDATE [24] can be used to send an updated offer prior
to the call being answered.
As discussed in Section 15, offer/answer exchanges SHOULD be secured
against eavesdropping and man-in-the-middle attacks. To do that, the against eavesdropping and man-in-the-middle attacks. To do that, the
usage of SIPS [3] is RECOMMENDED when used in concert with ICE. usage of SIPS [3] is RECOMMENDED when used in concert with ICE.
12.2. Interactions with Forking 13.2. Interactions with Forking
ICE interacts very well with forking. Indeed, ICE fixes some of the ICE interacts very well with forking. Indeed, ICE fixes some of the
problems associated with forking. Without ICE, when a call forks and problems associated with forking. Without ICE, when a call forks and
the caller receives multiple incoming media streams, it cannot the caller receives multiple incoming media streams, it cannot
determine which media stream corresponds to which callee. determine which media stream corresponds to which callee.
With ICE, this problem is resolved. The connectivity checks which With ICE, this problem is resolved. The connectivity checks which
occur prior to transmission of media carry username fragments, which occur prior to transmission of media carry username fragments, which
in turn are correlated to a specific callee. Subsequent media in turn are correlated to a specific callee. Subsequent media
packets which arrive on the same 5-tuple as the connectivity check packets which arrive on the same 5-tuple as the connectivity check
will be associated with that same callee. Thus, the caller can will be associated with that same callee. Thus, the caller can
perform this correlation as long as it has received an answer. perform this correlation as long as it has received an answer.
12.3. Interactions with Preconditions 13.3. Interactions with Preconditions
Quality of Service (QoS) preconditions, which are defined in RFC 3312 Quality of Service (QoS) preconditions, which are defined in RFC 3312
[6] and RFC 4032 [7], apply only to the transport addresses listed in [6] and RFC 4032 [7], apply only to the transport addresses listed in
the m/c lines in an offer/answer. If ICE changes the transport the m/c lines in an offer/answer. If ICE changes the transport
address where media is received, this change is reflected in the m/c address where media is received, this change is reflected in the m/c
lines of a new offer/answer. As such, it appears like any other re- lines of a new offer/answer. As such, it appears like any other re-
INVITE would, and is fully treated in RFC 3312 and 4032, which apply INVITE would, and is fully treated in RFC 3312 and 4032, which apply
without regard to the fact that the m/c lines are changing due to ICE without regard to the fact that the m/c lines are changing due to ICE
negotiations ocurring "in the background". negotiations ocurring "in the background".
Indeed, an agent SHOULD NOT indicate that Qos preconditions have been Indeed, an agent SHOULD NOT indicate that Qos preconditions have been
met until the ICE checks have completed and selected the candidate met until the ICE checks have completed and selected the candidate
pairs to be used for media. pairs to be used for media.
ICE also has (purposeful) interactions with connectivity ICE also has (purposeful) interactions with connectivity
preconditions [26]. Those interactions are described there. Note preconditions [26]. Those interactions are described there. Note
that the procedures described in Section 12.1 describe their own type that the procedures described in Section 13.1 describe their own type
of "preconditions", albeit with less functionality than those of "preconditions", albeit with less functionality than those
provided by the explicit preconditions in [26]. provided by the explicit preconditions in [26].
12.4. Interactions with Third Party Call Control 13.4. Interactions with Third Party Call Control
ICE works with Flows I and IV as described in [16]. Flow I works
without the controller supporting or being aware of ICE. Flow IV
will work as long as the controller passes along the ICE attributes
without alteration. Flow III may disrupt ICE processing, since it
will distort the stream ID values used in the computation of
priorities. When there is but a single media stream, Flow III will
work as long as the controller passes through the ICE attributes
unmodified. Flow II is fundamentally incompatible with ICE; each
agent will believe itself to be the answerer and thus never generate
a re-INVITE.
OPEN ISSUE: Its really too bad flow III doesn't work with ICE works with Flows I, III and IV as described in [16]. Flow I
multimedia; should consider ways to make it work. There are works without the controller supporting or being aware of ICE. Flow
several ways. IV will work as long as the controller passes along the ICE
attributes without alteration. Flow II is fundamentally incompatible
with ICE; each agent will believe itself to be the answerer and thus
never generate a re-INVITE.
The flows for continued operation, as described in Section 7 of RFC The flows for continued operation, as described in Section 7 of RFC
3725, require additional behavior of ICE implementations to support. 3725, require additional behavior of ICE implementations to support.
In particular, if an agent receives a mid-dialog re-INVITE that In particular, if an agent receives a mid-dialog re-INVITE that
contains no offer, it MUST go through the process of gathering contains no offer, it MUST restart ICE for each media stream and go
candidates, prioritizing them and generating an offer, as if this was through the process of gathering new candidates. Furthermore, that
an initial offer for a session. Furthermore, that list of candidates list of candidates SHOULD include the ones currently in-use.
SHOULD include the ones currently in-use.
13. Grammar 14. Grammar
This specification defines four new SDP attributes - the "candidate", This specification defines five new SDP attributes - the "candidate",
"remote-candidates", "ice-ufrag" and "ice-pwd" attributes. "remote-candidates", "ice-passive", "ice-ufrag" and "ice-pwd"
attributes.
The candidate attribute is a media-level attribute only. It contains The candidate attribute is a media-level attribute only. It contains
a transport address for a candidate that can be used for connectivity a transport address for a candidate that can be used for connectivity
checks. checks.
The syntax of this attribute is defined using Augmented BNF as The syntax of this attribute is defined using Augmented BNF as
defined in RFC 4234 [8]: defined in RFC 4234 [8]:
candidate-attribute = "candidate" ":" foundation SP component-id SP candidate-attribute = "candidate" ":" foundation SP component-id SP
transport SP transport SP
skipping to change at page 39, line 49 skipping to change at page 43, line 16
protocols to be used with ICE, such as TCP or the Datagram Congestion protocols to be used with ICE, such as TCP or the Datagram Congestion
Control Protocol (DCCP) [28]. Control Protocol (DCCP) [28].
The cand-type production encodes the type of candidate. This The cand-type production encodes the type of candidate. This
specification defines the values "host", "srflx", "prflx" and "relay" specification defines the values "host", "srflx", "prflx" and "relay"
for host, server reflexive, peer reflexive and relayed candidates, for host, server reflexive, peer reflexive and relayed candidates,
respectively. The set of candidate types is extensible for the respectively. The set of candidate types is extensible for the
future. Inclusion of the candidate type is optional. The rel-addr future. Inclusion of the candidate type is optional. The rel-addr
and rel-port productions convey information the related transport and rel-port productions convey information the related transport
addresses. Rules for inclusion of these values is described in addresses. Rules for inclusion of these values is described in
Section 4.4. Section 5.4.
The a=candidate attribute can itself be extended. The grammar allows The a=candidate attribute can itself be extended. The grammar allows
for new name/value pairs to be added at the end of the attribute. An for new name/value pairs to be added at the end of the attribute. An
implementation MUST ignore any name/value pairs it doesn't implementation MUST ignore any name/value pairs it doesn't
understand. understand.
The syntax of the "remote-candidates" attribute is defined using The syntax of the "remote-candidates" attribute is defined using
Augmented BNF as defined in RFC 4234 [8]. The remote-candidates Augmented BNF as defined in RFC 4234 [8]. The remote-candidates
attribute is a media level attribute only. attribute is a media level attribute only.
remote-candidate-att = "remote-candidates" ":" remote-candidate remote-candidate-att = "remote-candidates" ":" remote-candidate
0*(SP remote-candidate) 0*(SP remote-candidate)
remote-candidate = component-ID SP connection-address SP port remote-candidate = component-ID SP connection-address SP port
The attribute contains a connection-address and port for each The attribute contains a connection-address and port for each
component. The ordering of components is irrelevant. However, a component. The ordering of components is irrelevant. However, a
value MUST be present for each component of a media stream. value MUST be present for each component of a media stream.
The syntax of the "ice-passive" candidate is:
ice-passive = "ice-passive"
The syntax of the "ice-pwd" and "ice-ufrag" attributes are defined The syntax of the "ice-pwd" and "ice-ufrag" attributes are defined
as: as:
ice-pwd-att = "ice-pwd" ":" password ice-pwd-att = "ice-pwd" ":" password
ice-ufrag-att = "ice-ufrag" ":" ufrag ice-ufrag-att = "ice-ufrag" ":" ufrag
password = 22*ice-char password = 22*ice-char
ufrag = 4*ice-char ufrag = 4*ice-char
The "ice-pwd" and "ice-ufrag" attributes can appear at either the The "ice-pwd" and "ice-ufrag" attributes can appear at either the
session-level or media-level. When present in both, the value in the session-level or media-level. When present in both, the value in the
media-level takes precedence. Thus, the value at the session level media-level takes precedence. Thus, the value at the session level
is effectively a default that applies to all media streams, unless is effectively a default that applies to all media streams, unless
overriden by a media-level value. overriden by a media-level value.
14. Example 15. Example
Two agents, L and R, are using ICE. Both agents have a single IPv4 Two agents, L and R, are using ICE. Both are full-mode ICE
interface. For agent L, it is 10.0.1.1, and for agent R, 192.0.2.1. implementations. Both agents have a single IPv4 interface. For
Both are configured with a single STUN server each (indeed, the same agent L, it is 10.0.1.1, and for agent R, 192.0.2.1. Both are
one for each), which is listening for STUN requests at an IP address configured with a single STUN server each (indeed, the same one for
of 192.0.2.2 and port 3478. This STUN server supports both the each), which is listening for STUN requests at an IP address of
Binding Discovery usage and the Relay usage. Agent L is behind a 192.0.2.2 and port 3478. This STUN server supports only the Binding
NAT, and agent R is on the public Internet. The NAT has an endpoint Discovery usage; relays are not used in this example. Agent L is
independent mapping property and an address dependent filtering behind a NAT, and agent R is on the public Internet. The NAT has an
property. The public side of the NAT has an IP address of 192.0.2.3. endpoint independent mapping property and an address dependent
filtering property. The public side of the NAT has an IP address of
192.0.2.3.
To facilitate understanding, transport addresses are listed using To facilitate understanding, transport addresses are listed using
variables that have mnemonic names. The format of the name is variables that have mnemonic names. The format of the name is
entity-type-seqno, where entity refers to the entity whose interface entity-type-seqno, where entity refers to the entity whose interface
the transport address is on, and is one of "L", "R", "STUN", or the transport address is on, and is one of "L", "R", "STUN", or
"NAT". The type is either "PUB" for transport addresses that are "NAT". The type is either "PUB" for transport addresses that are
public, and "PRIV" for transport addresses that are private. public, and "PRIV" for transport addresses that are private.
Finally, seq-no is a sequence number that is different for each Finally, seq-no is a sequence number that is different for each
transport address of the same type on a particular entity. Each transport address of the same type on a particular entity. Each
variable has an IP address and port, denoted by varname.IP and variable has an IP address and port, denoted by varname.IP and
varname.PORT, respectively, where varname is the name of the varname.PORT, respectively, where varname is the name of the
variable. variable.
The STUN server has advertised transport address STUN-PUB-1 (which is The STUN server has advertised transport address STUN-PUB-1 (which is
192.0.2.2:3478) for both the binding discovery usage and the relay 192.0.2.2:3478) for the binding discovery usage.
usage. However, neither agent is using the relay usage.
In the call flow itself, STUN messages are annotated with several In the call flow itself, STUN messages are annotated with several
attributes. The "S=" attribute indicates the source transport attributes. The "S=" attribute indicates the source transport
address of the message. The "D=" attribute indicates the destination address of the message. The "D=" attribute indicates the destination
transport address of the message. The "MA=" attribute is used in transport address of the message. The "MA=" attribute is used in
STUN Binding Response messages and refers to the mapped address. STUN Binding Response messages and refers to the mapped address.
The call flow examples omit STUN authentication operations and RTCP, The call flow examples omit STUN authentication operations and RTCP,
and focus on RTP for a single media stream. and focus on RTP for a single media stream.
skipping to change at page 42, line 36 skipping to change at page 46, line 8
| |(12) Bind Res | | | |(12) Bind Res | |
| |S=$R-PUB-1 | | | |S=$R-PUB-1 | |
| |D=$NAT-PUB-1 | | | |D=$NAT-PUB-1 | |
| |MA=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | |
| |<----------------------------| | |<----------------------------|
|(13) Bind Res | | | |(13) Bind Res | | |
|S=$R-PUB-1 | | | |S=$R-PUB-1 | | |
|D=$L-PRIV-1 | | | |D=$L-PRIV-1 | | |
|MA=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | | |
|<-------------| | | |<-------------| | |
|(14) Offer | | | |RTP flows | | |
|------------------------------------------->| | |(14) Bind Req | |
|(15) Answer | | |
|<-------------------------------------------|
| |(16) Bind Req | |
| |S=$R-PUB-1 | | | |S=$R-PUB-1 | |
| |D=$NAT-PUB-1 | | | |D=$NAT-PUB-1 | |
| |<----------------------------| | |<----------------------------|
|(17) Bind Req | | | |(15) Bind Req | | |
|S=$R-PUB-1 | | | |S=$R-PUB-1 | | |
|D=$L-PRIV-1 | | | |D=$L-PRIV-1 | | |
|<-------------| | | |<-------------| | |
|(18) Bind Res | | | |(16) Bind Res | | |
|S=$L-PRIV-1 | | | |S=$L-PRIV-1 | | |
|D=$R-PUB-1 | | | |D=$R-PUB-1 | | |
|MA=$R-PUB-1 | | | |MA=$R-PUB-1 | | |
|------------->| | | |------------->| | |
| |(19) Bind Res | | | |(17) Bind Res | |
| |S=$NAT-PUB-1 | | | |S=$NAT-PUB-1 | |
| |D=$R-PUB-1 | | | |D=$R-PUB-1 | |
| |MA=$R-PUB-1 | | | |MA=$R-PUB-1 | |
| |---------------------------->| | |---------------------------->|
|RTP flows | | | | | | |RTP flows
Figure 9 Figure 10
First, agent L obtains a host candidate from its local interface (not First, agent L obtains a host candidate from its local interface (not
shown), and from that, sends a STUN Binding Request to the STUN shown), and from that, sends a STUN Binding Request to the STUN
server to get a server reflexive candidate (messages 1-4). Recall server to get a server reflexive candidate (messages 1-4). Recall
that the NAT has the address and port independent mapping property. that the NAT has the address and port independent mapping property.
Here, it creates a binding of NAT-PUB-1 for this UDP request, and Here, it creates a binding of NAT-PUB-1 for this UDP request, and
this becomes the server reflexive candidate for RTP. this becomes the server reflexive candidate for RTP.
Agent L sets a type preference of 126 for the host candidate and 100 Agent L sets a type preference of 126 for the host candidate and 100
for the server reflexive. The local preference is 65535. Based on for the server reflexive. The local preference is 65535. Based on
skipping to change at page 45, line 4 skipping to change at page 48, line 19
v=0 v=0
o=bob 2808844564 2808844564 IN IP4 192.0.2.1 o=bob 2808844564 2808844564 IN IP4 192.0.2.1
s= s=
c=IN IP4 192.0.2.1 c=IN IP4 192.0.2.1
t=0 0 t=0 0
a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh
a=ice-ufrag:9uB6 a=ice-ufrag:9uB6
m=audio 3478 RTP/AVP 0 m=audio 3478 RTP/AVP 0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2130706178 192.0.2.1 3478 typ local a=candidate:1 1 UDP 2130706178 192.0.2.1 3478 typ local
Since neither side indicated that they are passive-only, the agent
which sent the offer that began ICE processing (agent L) becomes the
controlling agent.
Agents L and R both pair up the candidates. They both initially have Agents L and R both pair up the candidates. They both initially have
two. However, agent L will prune the pair containing its server two. However, agent L will prune the pair containing its server
reflexive candidate, resulting in just one. At agent L, this pair reflexive candidate, resulting in just one. At agent L, this pair
(the check) has a local candidate of $L_PRIV_1 and remote candidate (the check) has a local candidate of $L_PRIV_1 and remote candidate
of $R_PUB_1, and has a candidate pair priority of 4.57566E+18 (note of $R_PUB_1, and has a candidate pair priority of 4.57566E+18 (note
that an implementation would represent this as a 64 bit integer so as that an implementation would represent this as a 64 bit integer so as
not to lose precision). At agent R, there are two checks. The not to lose precision). At agent R, there are two checks. The
highest priority has a local candidate of $R_PUB_1 and remote highest priority has a local candidate of $R_PUB_1 and remote
candidate of $L_PRIV_1 and has a priority of 4.57566E+18, and the candidate of $L_PRIV_1 and has a priority of 4.57566E+18, and the
second has a local candidate of $R_PUB_1 and remote candidate of second has a local candidate of $R_PUB_1 and remote candidate of
$NAT_PUB_1 and priority 3.63891E+18. $NAT_PUB_1 and priority 3.63891E+18.
Agent R begins its connectivity check (message 9) for the first pair Agent R begins its connectivity check (message 9) for the first pair
(between the two host candidates). The host candidate from agent L (between the two host candidates). Since R is the passive agent for
is private and behind a different NAT, and thus this check is this session, the check omits the USE-CANDIDATE attribute. The host
discarded. candidate from agent L is private and behind a different NAT, and
thus this check is discarded.
When agent L gets the answer, it performs its one and only When agent L gets the answer, it performs its one and only
connectivity check (messages 10-13). This will succeed. This causes connectivity check (messages 10-13). It implements the default
agent L to create a new pair, whos local candidate is from the mapped algorithm for candidate selection, and thus includes a USE-CANDIDATE
address in the binding response (NAT-PUB-1 from message 13) and whose attribute in this check. Since the check succeeds, agent L creates a
remote candidate is the destination of the request (R-PUB-1 from new pair, whose local candidate is from the mapped address in the
message 10). This is added to the valid list. At this point, agent binding response (NAT-PUB-1 from message 13) and whose remote
L examines the valid list and sees that there is a candidate there candidate is the destination of the request (R-PUB-1 from message
for each component of each media stream (which is just RTP for the 10). This is added to the valid list. In addition, it is marked as
single audio stream). It therefore considers ICE checks complete and selected since the Binding Request contained the USE-CANDIDATE
sends an updated offer (message 14). This offer serves only to attribute. Since there is a selected candidate in the Valid list for
remove the candidate that was not selected and indicate the remote the one component of this media stream, ICE processing for this
candidates; the m/c-line remains unchanged. This offer looks like: stream moves into the Completed state. Agent L can now send media if
it so chooses.
v=0
o=jdoe 2890844528 2890842809 IN IP4 10.0.1.1
s=
c=IN IP4 192.0.2.3
t=0 0
a=ice-pwd:asd88fgpdd777uzjYhagZg
a=ice-ufrag:8hhY
m=audio 45664 RTP/AVP 0
a=remote-candidates 1 192.0.2.1 3478
a=rtpmap:0 PCMU/8000
a=candidate:2 1 UDP 1694498562 192.0.2.3 45664 typ srflx raddr
10.0.1.1 rport 8998
Agent R can construct the answer. Since the remote-candidates listed
in the offer match the ones that agent R had already selected for the
m/c-line in the previous answer, there is no change there. Its
answer therefore looks like:
v=0
o=bob 2808844565 2808844566 IN IP4 192.0.2.1
s=
c=IN IP4 192.0.2.1
t=0 0
a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh
a=ice-ufrag:9uB6
m=audio 3478 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=candidate:1 1 UDP 2130706178 192.0.2.1 3478 typ local
Upon receipt of the check from agent L (message 11), agent R will Upon receipt of the check from agent L (message 11), agent R will
generate its triggered check. This check happens to match the next generate its triggered check. This check happens to match the next
one on its check list - from its host candidate to agent L's server one on its check list - from its host candidate to agent L's server
reflexive candidate. This check (messages 16-19) will succeed. reflexive candidate. This check (messages 14-17) will succeed.
Consequently, agent R constructs a new candidate pair using the Consequently, agent R constructs a new candidate pair using the
mapped address from the response as the local candidate (R-PUB-1) and mapped address from the response as the local candidate (R-PUB-1) and
the destination of the request (NAT-PUB-1) as the remote candidate. the destination of the request (NAT-PUB-1) as the remote candidate.
This pair is added to the valid list. Since this pair matches the This pair is added to the Valid list for that media stream. Since
pair in the m/c-lines, agent R can send media as well. the check was generated in the reverse direction of a check that
contained the USE-CANDIDATE attribute, the candidate pair is marked
as selected. Consequently, processing for this stream moves into the
Completed state, and agent R can also send media.
15. Security Considerations 16. Security Considerations
There are several types of attacks possible in an ICE system. This There are several types of attacks possible in an ICE system. This
section considers these attacks and their countermeasures. section considers these attacks and their countermeasures.
15.1. Attacks on Connectivity Checks 16.1. Attacks on Connectivity Checks
An attacker might attempt to disrupt the STUN connectivity checks. An attacker might attempt to disrupt the STUN connectivity checks.
Ultimately, all of these attacks fool an agent into thinking Ultimately, all of these attacks fool an agent into thinking
something incorrect about the results of the connectivity checks. something incorrect about the results of the connectivity checks.
The possible false conclusions an attacker can try and cause are: The possible false conclusions an attacker can try and cause are:
False Invalid: An attacker can fool a pair of agents into thinking a False Invalid: An attacker can fool a pair of agents into thinking a
candidate pair is invalid, when it isn't. This can be used to candidate pair is invalid, when it isn't. This can be used to
cause an agent to prefer a different candidate (such as one cause an agent to prefer a different candidate (such as one
injected by the attacker), or to disrupt a call by forcing all injected by the attacker), or to disrupt a call by forcing all
skipping to change at page 49, line 4 skipping to change at page 51, line 47
public Internet), this attack can be hard to coordinate, since it public Internet), this attack can be hard to coordinate, since it
needs to occur against two different endpoints on different parts of needs to occur against two different endpoints on different parts of
the network at the same time. the network at the same time.
If the attacker themself is identified by the fake candidate the If the attacker themself is identified by the fake candidate the
attack is easier to coordinate. However, if SRTP is used [21], the attack is easier to coordinate. However, if SRTP is used [21], the
attacker will not be able to play the media packets, they will only attacker will not be able to play the media packets, they will only
be able to discard them, effectively disabling the media stream for be able to discard them, effectively disabling the media stream for
the call. However, this attack requires the agent to disrupt packets the call. However, this attack requires the agent to disrupt packets
in order to block the connectivity check from reaching the target. in order to block the connectivity check from reaching the target.
In that case, if the goal is to disrupt the media stream, its much In that case, if the goal is to disrupt the media stream, its much
easier to just disrupt it with the same mechanism, rather than attack easier to just disrupt it with the same mechanism, rather than attack
ICE. ICE.
15.2. Attacks on Address Gathering 16.2. Attacks on Address Gathering
ICE endpoints make use of STUN for gathering candidates rom a STUN ICE endpoints make use of STUN for gathering candidates rom a STUN
server in the network. This is corresponds to the Binding Discovery server in the network. This is corresponds to the Binding Discovery
usage of STUN described in [11]. As a consequence, the attacks usage of STUN described in [11]. As a consequence, the attacks
against STUN itself that are described in that specification can against STUN itself that are described in that specification can
still be used against the binding discovery usage when utilized with still be used against the binding discovery usage when utilized with
ICE. ICE.
However, the additional mechanisms provided by ICE actually However, the additional mechanisms provided by ICE actually
counteract such attacks, making binding discovery with STUN more counteract such attacks, making binding discovery with STUN more
skipping to change at page 49, line 42 skipping to change at page 52, line 38
If the attacker elects not to attack the connectivity checks, the If the attacker elects not to attack the connectivity checks, the
worst it can do is prevent the server reflexive candidate from being worst it can do is prevent the server reflexive candidate from being
used. However, if the peer agent has at least one candidate that is used. However, if the peer agent has at least one candidate that is
reachable by the agent under attack, the STUN connectivity checks reachable by the agent under attack, the STUN connectivity checks
themselves will provide a peer reflexive candidate that can be used themselves will provide a peer reflexive candidate that can be used
for the exchange of media. Peer reflexive candidates are generally for the exchange of media. Peer reflexive candidates are generally
preferred over server reflexive candidates. As such, an attack preferred over server reflexive candidates. As such, an attack
solely on the STUN address gathering will normally have no impact on solely on the STUN address gathering will normally have no impact on
a session at all. a session at all.
15.3. Attacks on the Offer/Answer Exchanges 16.3. Attacks on the Offer/Answer Exchanges
An attacker that can modify or disrupt the offer/answer exchanges An attacker that can modify or disrupt the offer/answer exchanges
themselves can readily launch a variety of attacks with ICE. They themselves can readily launch a variety of attacks with ICE. They
could direct media to a target of a DoS attack, they could insert could direct media to a target of a DoS attack, they could insert
themselves into the media stream, and so on. These are similar to themselves into the media stream, and so on. These are similar to
the general security considerations for offer/answer exchanges, and the general security considerations for offer/answer exchanges, and
the security considerations in RFC 3264 [4] apply. These require the security considerations in RFC 3264 [4] apply. These require
techniques for message integrity and encryption for offers and techniques for message integrity and encryption for offers and
answers, which are satisfied by the SIPS mechanism [3] when SIP is answers, which are satisfied by the SIPS mechanism [3] when SIP is
used. As such, the usage of SIPS with ICE is RECOMMENDED. used. As such, the usage of SIPS with ICE is RECOMMENDED.
15.4. Insider Attacks 16.4. Insider Attacks
In addition to attacks where the attacker is a third party trying to In addition to attacks where the attacker is a third party trying to
insert fake offers, answers or stun messages, there are several insert fake offers, answers or stun messages, there are several
attacks possible with ICE when the attacker is an authenticated and attacks possible with ICE when the attacker is an authenticated and
valid participant in the ICE exchange. valid participant in the ICE exchange.
15.4.1. The Voice Hammer Attack 16.4.1. The Voice Hammer Attack
The voice hammer attack is an amplification attack. In this attack, The voice hammer attack is an amplification attack. In this attack,
the attacker initiates sessions to other agents, and includes the IP the attacker initiates sessions to other agents, and includes the IP
address and port of a DoS target in the m/c-line of their SDP. This address and port of a DoS target in the m/c-line of their SDP. This
causes substantial amplification; a single offer/answer exchange can causes substantial amplification; a single offer/answer exchange can
create a continuing flood of media packets, possibly at high rates create a continuing flood of media packets, possibly at high rates
(consider video sources). This attack is not specific to ICE, but (consider video sources). This attack is not specific to ICE, but
ICE can help provide remediation. ICE can help provide remediation.
Specifically, if ICE is used, the agent receiving the malicious SDP Specifically, if ICE is used, the agent receiving the malicious SDP
will first peform connectivity checks to the target of media before will first peform connectivity checks to the target of media before
sending it there. If this target is a third party host, the checks sending it there. If this target is a third party host, the checks
will not succeed, and media is never sent. will not succeed, and media is never sent.
Unfortunately, ICE doesn't help if its not used, in which case an Unfortunately, ICE doesn't help if its not used, in which case an
attacker could simply send the offer without the ICE parameters. attacker could simply send the offer without the ICE parameters.
However, in environments where the set of clients are known, and However, in environments where the set of clients are known, and
limited to ones that support ICE, the server can reject any offers or limited to ones that support ICE, the server can reject any offers or
answers that don't indicate ICE support. answers that don't indicate ICE support.
15.4.2. STUN Amplification Attack 16.4.2. STUN Amplification Attack
The STUN amplification attack is similar to the voice hammer. The STUN amplification attack is similar to the voice hammer.
However, instead of voice packets being directed to the target, STUN However, instead of voice packets being directed to the target, STUN
connectivity checks are directed to the target. This attack is connectivity checks are directed to the target. This attack is
accomplished by having the offerer send an offer with a large number accomplished by having the offerer send an offer with a large number
of candidates, say 50. The answerer receives the offer, and starts of candidates, say 50. The answerer receives the offer, and starts
its checks, which are directed at the target, and consequently, never its checks, which are directed at the target, and consequently, never
generate a response. The answerer will start a new connectivity generate a response. The answerer will start a new connectivity
check every 50ms, and each check is a STUN transaction consisting of check every 50ms, and each check is a STUN transaction consisting of
9 retransmits of a message 65 bytes in length (plus 28 bytes for the 9 retransmits of a message 65 bytes in length (plus 28 bytes for the
skipping to change at page 51, line 7 skipping to change at page 54, line 5
158 transactions in progress at once (7.9 seconds divided by 50ms), 158 transactions in progress at once (7.9 seconds divided by 50ms),
for a total of 132 kbps, just for STUN requests. for a total of 132 kbps, just for STUN requests.
It is impossible to eliminate the amplification, but the volume can It is impossible to eliminate the amplification, but the volume can
be reduced through a variety of heuristics. For example, agents can be reduced through a variety of heuristics. For example, agents can
limit the number of candidates they'll accept in an offer or answer, limit the number of candidates they'll accept in an offer or answer,
they can increase the value of Ta, or exponentially increase Ta as they can increase the value of Ta, or exponentially increase Ta as
time goes on. All of these ultimately trade off the time for the ICE time goes on. All of these ultimately trade off the time for the ICE
exchanges to complete, with the amount of traffic that gets sent. exchanges to complete, with the amount of traffic that gets sent.
OPEN ISSUE: Need better remediation for this. Especially an issue OPEN ISSUE: Need better remediation for this.
if we reduce Ta to be as fast as media packets themselves, in
which case this attack is as equally devastating as the voice
hammer.
16. IANA Considerations 17. Definition of Connectivity Check Usage
This specification defines four new SDP attributes per the procedures STUN [11] requires that new usages provide a specific set of
information as part of their formal definition. This section meets
the requirements spelled out there.
17.1. Applicability
This STUN usage provides a connectivity check between two peers
participating in an offer/answer exchange. This check serves to
validate a pair of candidates for usage of exchange of media.
Connectivity checks also allow agents to discover reflexive
candidates towards their peers, called peer reflexive candidates.
Finally, connectivity checks serve to keep NAT bindings alive.
It is fundamental to this STUN usage that the addresses and ports
used for media are the same ones used for the Binding Requests and
responses. Consequently, it will be necessary to demultiplex STUN
traffic from whatever the media traffic is. This demultiplexing is
done using the techniques described in [11].
17.2. Client Discovery of Server
The client does not follow the DNS-based procedures defined in [11].
Rather, the remote candidate of the check to be performed is used as
the transport address of the STUN server. Note that the STUN server
is a logical entity, and is not a physically distinct server in this
usage.
17.3. Server Determination of Usage
The server is aware of this usage because it signaled this port
through the offer/answer exchange. Any STUN packets received on this
port will be for the connectivity check usage.
17.4. New Requests or Indications
This usage does not define any new message types.
17.5. New Attributes
This usage defines two new attributes, PRIORITY and USE-CANDIDATE.
The PRIORITY attribute indicates the priority that is to be
associated with a peer reflexive candidate, should one be discovered
by this check. It is a 32 bit unsigned integer, and has an attribute
type of 0x0024.
The USE-CANDIDATE attribute indicates that the candidate pair
resulting from this check should be used for transmission of media.
The attribute has no content (the Length field of the attribute is
zero); it serves as a flag. It has an attribute type of 0x0025.
17.6. New Error Response Codes
This usage does not define any new error response codes.
17.7. Client Procedures
Client procedures are defined in Section 8.1.
17.8. Server Procedures
Server procedures are defined in Section 8.2.
17.9. Security Considerations for Connectivity Check
Security considerations for the connectivity check are discussed in
Section 16.
18. IANA Considerations
This specification registers new SDP attributes and new STUN
attributes.
18.1. SDP Attributes
This specification defines five new SDP attributes per the procedures
of Section 8.2.4 of [10]. The required information for the of Section 8.2.4 of [10]. The required information for the
registrations are included here. registrations are included here.
16.1. candidate Attribute 18.1.1. candidate Attribute
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
Attribute Name: candidate Attribute Name: candidate
Long Form: candidate Long Form: candidate
Type of Attribute: media level Type of Attribute: media level
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides one of many possible candidate Establishment (ICE), and provides one of many possible candidate
addresses for communication. These addresses are validated with addresses for communication. These addresses are validated with
an end-to-end connectivity check using Simple Traversal Underneath an end-to-end connectivity check using Simple Traversal Underneath
NAT (STUN). NAT (STUN).
skipping to change at page 51, line 37 skipping to change at page 56, line 15
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides one of many possible candidate Establishment (ICE), and provides one of many possible candidate
addresses for communication. These addresses are validated with addresses for communication. These addresses are validated with
an end-to-end connectivity check using Simple Traversal Underneath an end-to-end connectivity check using Simple Traversal Underneath
NAT (STUN). NAT (STUN).
Appropriate Values: See Section 13 of RFC XXXX [Note to RFC-ed: Appropriate Values: See Section 14 of RFC XXXX [Note to RFC-ed:
please replace XXXX with the RFC number of this specification]. please replace XXXX with the RFC number of this specification].
16.2. remote-candidates Attribute 18.1.2. remote-candidates Attribute
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
Attribute Name: remote-candidates Attribute Name: remote-candidates
Long Form: remote-candidates Long Form: remote-candidates
Type of Attribute: media level Type of Attribute: media level
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides the identity of the remote Establishment (ICE), and provides the identity of the remote
candidates that the offerer wishes the answerer to use in its candidates that the offerer wishes the answerer to use in its
answer. answer.
skipping to change at page 52, line 14 skipping to change at page 56, line 36
Type of Attribute: media level Type of Attribute: media level
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides the identity of the remote Establishment (ICE), and provides the identity of the remote
candidates that the offerer wishes the answerer to use in its candidates that the offerer wishes the answerer to use in its
answer. answer.
Appropriate Values: See Section 13 of RFC XXXX [Note to RFC-ed: Appropriate Values: See Section 14 of RFC XXXX [Note to RFC-ed:
please replace XXXX with the RFC number of this specification]. please replace XXXX with the RFC number of this specification].
16.3. ice-pwd Attribute 18.1.3. ice-passive Attribute
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
Attribute Name: ice-passive
Long Form: ice-passive
Type of Attribute: session level
Charset Considerations: The attribute is not subject to the charset
attribute.
Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and indicates that an agent can only operate
in ICE's passive mode.
Appropriate Values: See Section 14 of RFC XXXX [Note to RFC-ed:
please replace XXXX with the RFC number of this specification].
18.1.4. ice-pwd Attribute
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
Attribute Name: ice-pwd Attribute Name: ice-pwd
Long Form: ice-pwd Long Form: ice-pwd
Type of Attribute: session or media level Type of Attribute: session or media level
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides the password used to protect Establishment (ICE), and provides the password used to protect
STUN connectivity checks. STUN connectivity checks.
Appropriate Values: See Section 13 of RFC XXXX [Note to RFC-ed: Appropriate Values: See Section 14 of RFC XXXX [Note to RFC-ed:
please replace XXXX with the RFC number of this specification]. please replace XXXX with the RFC number of this specification].
16.4. ice-ufrag Attribute 18.1.5. ice-ufrag Attribute
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
Attribute Name: ice-ufrag Attribute Name: ice-ufrag
Long Form: ice-ufrag Long Form: ice-ufrag
Type of Attribute: session or media level Type of Attribute: session or media level
Charset Considerations: The attribute is not subject to the charset Charset Considerations: The attribute is not subject to the charset
attribute. attribute.
Purpose: This attribute is used with Interactive Connectivity Purpose: This attribute is used with Interactive Connectivity
Establishment (ICE), and provides the fragments used to construct Establishment (ICE), and provides the fragments used to construct
the username in STUN connectivity checks. the username in STUN connectivity checks.
Appropriate Values: See Section 13 of RFC XXXX [Note to RFC-ed: Appropriate Values: See Section 14 of RFC XXXX [Note to RFC-ed:
please replace XXXX with the RFC number of this specification]. please replace XXXX with the RFC number of this specification].
17. IAB Considerations 18.2. STUN Attributes
This section registers two new STUN attributes per the procedures in
[11].
0x0024 PRIORITY
0x0025 USE-CANDIDATE
19. IAB Considerations
The IAB has studied the problem of "Unilateral Self Address Fixing", The IAB has studied the problem of "Unilateral Self Address Fixing",
which is the general process by which a agent attempts to determine which is the general process by which a agent attempts to determine
its address in another realm on the other side of a NAT through a its address in another realm on the other side of a NAT through a
collaborative protocol reflection mechanism [19]. ICE is an example collaborative protocol reflection mechanism [19]. ICE is an example
of a protocol that performs this type of function. Interestingly, of a protocol that performs this type of function. Interestingly,
the process for ICE is not unilateral, but bilateral, and the the process for ICE is not unilateral, but bilateral, and the
difference has a signficant impact on the issues raised by IAB. difference has a signficant impact on the issues raised by IAB.
Indeed, ICE can be considered a B-SAF (Bilateral Self-Address Fixing) Indeed, ICE can be considered a B-SAF (Bilateral Self-Address Fixing)
protocol, rather than an UNSAF protocol. Regardless, the IAB has protocol, rather than an UNSAF protocol. Regardless, the IAB has
mandated that any protocols developed for this purpose document a mandated that any protocols developed for this purpose document a
specific set of considerations. This section meets those specific set of considerations. This section meets those
requirements. requirements.
17.1. Problem Definition 19.1. Problem Definition
From RFC 3424 any UNSAF proposal must provide: From RFC 3424 any UNSAF proposal must provide:
Precise definition of a specific, limited-scope problem that is to Precise definition of a specific, limited-scope problem that is to
be solved with the UNSAF proposal. A short term fix should not be be solved with the UNSAF proposal. A short term fix should not be
generalized to solve other problems; this is why "short term fixes generalized to solve other problems; this is why "short term fixes
usually aren't". usually aren't".
The specific problems being solved by ICE are: The specific problems being solved by ICE are:
Provide a means for two peers to determine the set of transport Provide a means for two peers to determine the set of transport
addresses which can be used for communication. addresses which can be used for communication.
Provide a means for resolving many of the limitations of other Provide a means for resolving many of the limitations of other
UNSAF mechanisms by wrapping them in an additional layer of UNSAF mechanisms by wrapping them in an additional layer of
processing (the ICE methodology). processing (the ICE methodology).
Provide a means for a agent to determine an address that is Provide a means for a agent to determine an address that is
reachable by another peer with which it wishes to communicate. reachable by another peer with which it wishes to communicate.
17.2. Exit Strategy 19.2. Exit Strategy
From RFC 3424, any UNSAF proposal must provide: From RFC 3424, any UNSAF proposal must provide:
Description of an exit strategy/transition plan. The better short Description of an exit strategy/transition plan. The better short
term fixes are the ones that will naturally see less and less use term fixes are the ones that will naturally see less and less use
as the appropriate technology is deployed. as the appropriate technology is deployed.
ICE itself doesn't easily get phased out. However, it is useful even ICE itself doesn't easily get phased out. However, it is useful even
in a globally connected Internet, to serve as a means for detecting in a globally connected Internet, to serve as a means for detecting
whether a router failure has temporarily disrupted connectivity, for whether a router failure has temporarily disrupted connectivity, for
skipping to change at page 54, line 29 skipping to change at page 59, line 36
used, because higher priority connectivity exists to the native host used, because higher priority connectivity exists to the native host
candidates. Therefore, the servers get used less and less, and can candidates. Therefore, the servers get used less and less, and can
eventually be remove when their usage goes to zero. eventually be remove when their usage goes to zero.
Indeed, ICE can assist in the transition from IPv4 to IPv6. It can Indeed, ICE can assist in the transition from IPv4 to IPv6. It can
be used to determine whether to use IPv6 or IPv4 when two dual-stack be used to determine whether to use IPv6 or IPv4 when two dual-stack
hosts communicate with SIP (IPv6 gets used). It can also allow a hosts communicate with SIP (IPv6 gets used). It can also allow a
network with both 6to4 and native v6 connectivity to determine which network with both 6to4 and native v6 connectivity to determine which
address to use when communicating with a peer. address to use when communicating with a peer.
17.3. Brittleness Introduced by ICE 19.3. Brittleness Introduced by ICE
From RFC3424, any UNSAF proposal must provide: From RFC3424, any UNSAF proposal must provide:
Discussion of specific issues that may render systems more Discussion of specific issues that may render systems more
"brittle". For example, approaches that involve using data at "brittle". For example, approaches that involve using data at
multiple network layers create more dependencies, increase multiple network layers create more dependencies, increase
debugging challenges, and make it harder to transition. debugging challenges, and make it harder to transition.
ICE actually removes brittleness from existing UNSAF mechanisms. In ICE actually removes brittleness from existing UNSAF mechanisms. In
particular, traditional STUN (as described in RFC 3489 [13]) has particular, traditional STUN (as described in RFC 3489 [13]) has
skipping to change at page 55, line 24 skipping to change at page 60, line 31
shared NAT between each agent and the STUN server, traditional STUN shared NAT between each agent and the STUN server, traditional STUN
may not work. With ICE, that restriction is removed. may not work. With ICE, that restriction is removed.
Traditional STUN also introduces some security considerations. Traditional STUN also introduces some security considerations.
Fortunately, those security considerations are also mitigated by ICE. Fortunately, those security considerations are also mitigated by ICE.
Consequently, ICE serves to repair the brittleness introduced in Consequently, ICE serves to repair the brittleness introduced in
other UNSAF mechanisms, and does not introduce any additional other UNSAF mechanisms, and does not introduce any additional
brittleness into the system. brittleness into the system.
17.4. Requirements for a Long Term Solution 19.4. Requirements for a Long Term Solution
From RFC 3424, any UNSAF proposal must provide: From RFC 3424, any UNSAF proposal must provide:
Identify requirements for longer term, sound technical solutions Identify requirements for longer term, sound technical solutions
-- contribute to the process of finding the right longer term -- contribute to the process of finding the right longer term
solution. solution.
Our conclusions from STUN remain unchanged. However, we feel ICE Our conclusions from STUN remain unchanged. However, we feel ICE
actually helps because we believe it can be part of the long term actually helps because we believe it can be part of the long term
solution. solution.
17.5. Issues with Existing NAPT Boxes 19.5. Issues with Existing NAPT Boxes
From RFC 3424, any UNSAF proposal must provide: From RFC 3424, any UNSAF proposal must provide:
Discussion of the impact of the noted practical issues with Discussion of the impact of the noted practical issues with
existing, deployed NA[P]Ts and experience reports. existing, deployed NA[P]Ts and experience reports.
A number of NAT boxes are now being deployed into the market which A number of NAT boxes are now being deployed into the market which
try and provide "generic" ALG functionality. These generic ALGs hunt try and provide "generic" ALG functionality. These generic ALGs hunt
for IP addresses, either in text or binary form within a packet, and for IP addresses, either in text or binary form within a packet, and
rewrite them if they match a binding. This interferes with rewrite them if they match a binding. This interferes with
skipping to change at page 56, line 15 skipping to change at page 61, line 21
Existing NAPT boxes have non-deterministic and typically short Existing NAPT boxes have non-deterministic and typically short
expiration times for UDP-based bindings. This requires expiration times for UDP-based bindings. This requires
implementations to send periodic keepalives to maintain those implementations to send periodic keepalives to maintain those
bindings. ICE uses a default of 15s, which is a very conservative bindings. ICE uses a default of 15s, which is a very conservative
estimate. Eventually, over time, as NAT boxes become compliant to estimate. Eventually, over time, as NAT boxes become compliant to
behave [30], this minimum keepalive will become deterministic and behave [30], this minimum keepalive will become deterministic and
well-known, and the ICE timers can be adjusted. Having a way to well-known, and the ICE timers can be adjusted. Having a way to
discover and control the minimum keepalive interval would be far discover and control the minimum keepalive interval would be far
better still. better still.
18. Acknowledgements 20. Acknowledgements
The authors would like to thank Flemming Andreasen, Rohan Mahy, Dean The authors would like to thank Flemming Andreasen, Rohan Mahy, Dean
Willis, Eric Cooper, Dan Wing, Douglas Otis, Tim Moore, and Francois Willis, Eric Cooper, Dan Wing, Douglas Otis, Tim Moore, and Francois
Audet for their comments and input. A special thanks goes to Bill Audet for their comments and input. A special thanks goes to Bill
May, who suggested several of the concepts in this specification, May, who suggested several of the concepts in this specification,
Philip Matthews, who suggested many of the key performance Philip Matthews, who suggested many of the key performance
optimizations in this specification, Eric Rescorla, who drafted the optimizations in this specification, Eric Rescorla, who drafted the
text in the introduction, and Magnus Westerlund, for doing several text in the introduction, and Magnus Westerlund, for doing several
detailed reviews on the various revisions of this specification. detailed reviews on the various revisions of this specification.
19. References 21. References
19.1. Normative References 21.1. Normative References
[1] Bradner, S., "Key words for use in RFCs to Indicate Requirement [1] Bradner, S., "Key words for use in RFCs to Indicate Requirement
Levels", BCP 14, RFC 2119, March 1997. Levels", BCP 14, RFC 2119, March 1997.
[2] Huitema, C., "Real Time Control Protocol (RTCP) attribute in [2] Huitema, C., "Real Time Control Protocol (RTCP) attribute in
Session Description Protocol (SDP)", RFC 3605, October 2003. Session Description Protocol (SDP)", RFC 3605, October 2003.
[3] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., [3] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A.,
Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP: Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP:
Session Initiation Protocol", RFC 3261, June 2002. Session Initiation Protocol", RFC 3261, June 2002.
skipping to change at page 57, line 23 skipping to change at page 62, line 29
June 2002. June 2002.
[10] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session [10] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
Description Protocol", RFC 4566, July 2006. Description Protocol", RFC 4566, July 2006.
[11] Rosenberg, J., "Simple Traversal Underneath Network Address [11] Rosenberg, J., "Simple Traversal Underneath Network Address
Translators (NAT) (STUN)", draft-ietf-behave-rfc3489bis-04 Translators (NAT) (STUN)", draft-ietf-behave-rfc3489bis-04
(work in progress), July 2006. (work in progress), July 2006.
[12] Rosenberg, J., "Obtaining Relay Addresses from Simple Traversal [12] Rosenberg, J., "Obtaining Relay Addresses from Simple Traversal
of UDP Through NAT (STUN)", draft-ietf-behave-turn-01 (work in Underneath NAT (STUN)", draft-ietf-behave-turn-02 (work in
progress), June 2006. progress), October 2006.
19.2. Informative References 21.2. Informative References
[13] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy, "STUN [13] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy, "STUN
- Simple Traversal of User Datagram Protocol (UDP) Through - Simple Traversal of User Datagram Protocol (UDP) Through
Network Address Translators (NATs)", RFC 3489, March 2003. Network Address Translators (NATs)", RFC 3489, March 2003.
[14] Senie, D., "Network Address Translator (NAT)-Friendly [14] Senie, D., "Network Address Translator (NAT)-Friendly
Application Design Guidelines", RFC 3235, January 2002. Application Design Guidelines", RFC 3235, January 2002.
[15] Srisuresh, P., Kuthan, J., Rosenberg, J., Molitor, A., and A. [15] Srisuresh, P., Kuthan, J., Rosenberg, J., Molitor, A., and A.
Rayhan, "Middlebox communication architecture and framework", Rayhan, "Middlebox communication architecture and framework",
skipping to change at page 58, line 19 skipping to change at page 63, line 26
[21] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. [21] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K.
Norrman, "The Secure Real-time Transport Protocol (SRTP)", Norrman, "The Secure Real-time Transport Protocol (SRTP)",
RFC 3711, March 2004. RFC 3711, March 2004.
[22] Carpenter, B. and K. Moore, "Connection of IPv6 Domains via [22] Carpenter, B. and K. Moore, "Connection of IPv6 Domains via
IPv4 Clouds", RFC 3056, February 2001. IPv4 Clouds", RFC 3056, February 2001.
[23] Zopf, R., "Real-time Transport Protocol (RTP) Payload for [23] Zopf, R., "Real-time Transport Protocol (RTP) Payload for
Comfort Noise (CN)", RFC 3389, September 2002. Comfort Noise (CN)", RFC 3389, September 2002.
[24] Rosenberg, J., "The Session Initiation Protocol (SIP) UPDATE [24] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing Tone
Method", RFC 3311, October 2002.
[25] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing Tone
Generation in the Session Initiation Protocol (SIP)", RFC 3960, Generation in the Session Initiation Protocol (SIP)", RFC 3960,
December 2004. December 2004.
[25] Blake, S., Black, D., Carlson, M., Davies, E., Wang, Z., and W.
Weiss, "An Architecture for Differentiated Services", RFC 2475,
December 1998.
[26] Andreasen, F., "Connectivity Preconditions for Session [26] Andreasen, F., "Connectivity Preconditions for Session
Description Protocol Media Streams", Description Protocol Media Streams",
draft-ietf-mmusic-connectivity-precon-02 (work in progress), draft-ietf-mmusic-connectivity-precon-02 (work in progress),
June 2006. June 2006.
[27] Andreasen, F., "A No-Op Payload Format for RTP", [27] Andreasen, F., "A No-Op Payload Format for RTP",
draft-ietf-avt-rtp-no-op-00 (work in progress), May 2005. draft-ietf-avt-rtp-no-op-00 (work in progress), May 2005.
[28] Kohler, E., Handley, M., and S. Floyd, "Datagram Congestion [28] Kohler, E., Handley, M., and S. Floyd, "Datagram Congestion
Control Protocol (DCCP)", RFC 4340, March 2006. Control Protocol (DCCP)", RFC 4340, March 2006.
[29] Hellstrom, G. and P. Jones, "RTP Payload for Text [29] Hellstrom, G. and P. Jones, "RTP Payload for Text
Conversation", RFC 4103, June 2005. Conversation", RFC 4103, June 2005.
[30] Audet, F. and C. Jennings, "NAT Behavioral Requirements for [30] Audet, F. and C. Jennings, "NAT Behavioral Requirements for
Unicast UDP", draft-ietf-behave-nat-udp-07 (work in progress), Unicast UDP", draft-ietf-behave-nat-udp-08 (work in progress),
June 2006. October 2006.
[31] Jennings, C. and R. Mahy, "Managing Client Initiated [31] Jennings, C. and R. Mahy, "Managing Client Initiated
Connections in the Session Initiation Protocol (SIP)", Connections in the Session Initiation Protocol (SIP)",
draft-ietf-sip-outbound-04 (work in progress), June 2006. draft-ietf-sip-outbound-04 (work in progress), June 2006.
Appendix A. Design Motivations Appendix A. Passive-Only ICE
ICE contains a number of normative behaviors which may themselves be
simple, but derive from complicated or non-obvious thinking or use
cases which merit further discussion. Since these design motivations
are not neccesary to understand for purposes of implementation, they
are discussed here in an appendix to the specification. This section
is non-normative.
A.1. Applicability to Gateways and Servers
Section 4.1 discusses procedures for gathering candidates, including ICE allows for two modes of operation in an agent - passive-only and
host, server reflexive and relayed. In that section, recommendations full. Passive-only mode is applicable to entities like PSTN
are given for when an agent should obtain each of these three types. gateways, media servers and conferencing servers that are always
In particular, for agents embedded in PSTN gateways, media servers, publicly connected and are not behind a firewall or NAT.
conferencing servers, and so on, ICE specifies that an agent can
stick with just host candidates, since it has a public IP address.
This leads to an important question - why would such an endpoint even This leads to an important question - why would such an endpoint even
bother with ICE? If it has a public IP address, what additional bother with ICE? If it has a public IP address, what additional
value do the ICE procedures bring? There are many, actually. value do the ICE procedures bring? There are many, actually.
First, doing so greatly facilitates NAT traversal for clients that First, doing so greatly facilitates NAT traversal for clients that
connect to it. Consider a PC softphone behind a NAT whose mapping connect to it. Consider a PC softphone behind a NAT whose mapping
policy is address and port dependent. The softphone initiates a call policy is address and port dependent. The softphone initiates a call
through a gateway that implements ICE. The gateway doesn't obtain through a gateway that implements ICE. The gateway doesn't obtain
any server reflexive or relayed candidates, but it implements ICE, any server reflexive or relayed candidates, but it implements ICE,
skipping to change at page 59, line 48 skipping to change at page 64, line 44
Second, implementation of the STUN connectivity checks allows for NAT Second, implementation of the STUN connectivity checks allows for NAT
bindings along the way to be kept open. Keeping these bindings open bindings along the way to be kept open. Keeping these bindings open
is essential for continued communications between the gateway and is essential for continued communications between the gateway and
softphone. softphone.
Third, ICE prevents a fairly destructive attack in multimedia Third, ICE prevents a fairly destructive attack in multimedia
systems, called the voice hammer. The STUN connectivity check used systems, called the voice hammer. The STUN connectivity check used
by an ICE endpoint allows it to be certain that the target of media by an ICE endpoint allows it to be certain that the target of media
packets is, in fact, the same entity that requested the packets packets is, in fact, the same entity that requested the packets
through the offer/answer exchange. See Section 15 for a more through the offer/answer exchange. See Section 16 for a more
complete discussion on this attack. complete discussion on this attack.
A.2. Pacing of STUN Transactions Because of the benefits of implementing ICE in endpoints that don't
themselves require NAT traversal, ICE reduces the cost of
implementation by allowing them to run in passive-only mode. The
rules for passive-only endpoints are described throughout the
specification. What follows is an informative summary to give
implementors a good sense of what is required:
o A passive-only agent obtains candidates just from its host
interfaces, just like it would do without ICE. It doesn't need to
implement the STUN Binding Discovery usage [11] or the relay usage
[12] to gather server reflexive or relayed candidates. It needs
to assign its candidates a foundation ID; however it can use the
IP address itself as the foundation ID.
o The prioritization in Section 5.2 is trivially accomplished for
passive-only agents utilizing RTP. The type preference is set to
126 and the local preference to 65535, resulting in a priority of
2130706431 for RTP and 2130706430 for RTCP.
o In use candidates Section 5.3 are trivially selected - they are
equal to the host candidates.
o A passive-only agent will need to select a username and password
for each session. An SDP offer (and answer) constructed by an
RTP-based audio-only agent will contain two a=candidate lines,
which mirror the RTP and RTCP transport addresses in the m/c-line.
Each a=candidate line contains the priority and foundation
computed above, and indicates that it is a host candidate
Section 5.4.
o A passive-only agent doesn't need to construct check lists or
maintain the states of ICE processing Section 6.7. It only needs
to maintain the valid list, which are the list of checks it has
completed. Once it places its candidate lines into an offer or
answer, it waits for the receipt of checks.
o A passive-only agent doesn't generate periodic checks. It only
generates triggered checks, which are checks that are created as a
consequence of receiving a check. A passive-only agent does need
to be able to respond to a STUN check it receives.
o A passive-only agent does not add the PRIORITY or USE-CANDIDATE
attributes to its STUN requests. Its STUN requests only contain
the USERNAME and MESSAGE-INTEGRITY attributes, set based on the
username fragments and passwords exchanged in the offer and
answer.
o Handling of subsequent offer/answer exchanges is done trivially -
the passive-only agent includes its one and only candidate for
each component of each media stream in an a=candidate attribute
and in the m/c-line, just like an initial offer or answer.
o A passive-only agent never needs to compute or include the
a=remote-candidates attribute in any offer it sends. It never
needs to generate an updated offer as a consequence of ICE
processing.
o A passive-only agent sends media once a selected candidate pair
appears in its Valid list for that media stream.
Appendix B. Design Motivations
ICE contains a number of normative behaviors which may themselves be
simple, but derive from complicated or non-obvious thinking or use
cases which merit further discussion. Since these design motivations
are not neccesary to understand for purposes of implementation, they
are discussed here in an appendix to the specification. This section
is non-normative.
B.1. Pacing of STUN Transactions
STUN transactions used to gather candidates and to verify STUN transactions used to gather candidates and to verify
connectivity are paced out at an approximate rate of one new connectivity are paced out at an approximate rate of one new
transaction every Ta seconds, where Ta has a default of 50ms. Why transaction every Ta seconds, where Ta has a default of 50ms. Why
are these transactions paced, and why was 50ms chosen as default? are these transactions paced, and why was 50ms chosen as default?
Sending of these STUN requests will often have the effect of creating Sending of these STUN requests will often have the effect of creating
bindings on NAT devices between the client and the STUN servers. bindings on NAT devices between the client and the STUN servers.
Experience has shown that many NAT devices have upper limits on the Experience has shown that many NAT devices have upper limits on the
rate at which they will create new bindings. Furthermore, rate at which they will create new bindings. Furthermore,
skipping to change at page 61, line 11 skipping to change at page 67, line 29
Given that these numbers are close to, if not greater than, the Given that these numbers are close to, if not greater than, the
bandwidths utilized by many voice codecs, this seems a reasonable bandwidths utilized by many voice codecs, this seems a reasonable
value to use. value to use.
OPEN ISSUE: There is some debate about whether to reduce this OPEN ISSUE: There is some debate about whether to reduce this
pacing interval smaller, say 20ms, to speed up ICE, or perhaps pacing interval smaller, say 20ms, to speed up ICE, or perhaps
make it equal to the bandwidth that would be utilized by the media make it equal to the bandwidth that would be utilized by the media
streams themselves. streams themselves.
A.3. Candidates with Multiple Bases B.2. Candidates with Multiple Bases
Section 4.1 talks about merging together candidates that are Section 5.1 talks about merging together candidates that are
identical but have different bases. When can an agent have two identical but have different bases. When can an agent have two
candidates that have the same IP address and port, but different candidates that have the same IP address and port, but different
bases? Consider the topology of Figure 16: bases? Consider the topology of Figure 16:
+----------+ +----------+
| STUN Srvr| | STUN Srvr|
+----------+ +----------+
| |
| |
----- -----
skipping to change at page 63, line 14 skipping to change at page 69, line 14
(10.0.1.1:2498) and a host candidate on its interface on network A (10.0.1.1:2498) and a host candidate on its interface on network A
(192.168.1.1:3344). It performs a STUN query to its configured STUN (192.168.1.1:3344). It performs a STUN query to its configured STUN
server from 192.168.1.1:3344. This query passes through the NAT, server from 192.168.1.1:3344. This query passes through the NAT,
which happens to assign the binding 10.0.1.1:2498. The STUN server which happens to assign the binding 10.0.1.1:2498. The STUN server
reflects this in the STUN Binding Response. Now, the offerer has reflects this in the STUN Binding Response. Now, the offerer has
obtained a server reflexive candidate with a transport address that obtained a server reflexive candidate with a transport address that
is identical to a host candidate (10.0.1.1:2498). However, the is identical to a host candidate (10.0.1.1:2498). However, the
server reflexive candidate has a base of 192.168.1.1:3344, and the server reflexive candidate has a base of 192.168.1.1:3344, and the
host candidate has a base of 10.0.1.1:2498. host candidate has a base of 10.0.1.1:2498.
A.4. Purpose of the Translation B.3. Purpose of the Translation
When a candidate is relayed, the SDP offer or answer contain both the When a candidate is relayed, the SDP offer or answer contain both the
relayed candidate and its translation. However, the translation is relayed candidate and its translation. However, the translation is
never used by ICE itself. Why is it present in the message? never used by ICE itself. Why is it present in the message?
There are two motivations for its inclusion. The first is There are two motivations for its inclusion. The first is
diagnostic. It is very useful to know the relationship between the diagnostic. It is very useful to know the relationship between the
different types of candidates. By including the translation, an different types of candidates. By including the translation, an
agent can know which relayed candidate is associated with which agent can know which relayed candidate is associated with which
reflexive candidate, which in turn is associated with a specific host reflexive candidate, which in turn is associated with a specific host
skipping to change at page 63, line 46 skipping to change at page 69, line 46
providing it a guaranteed rate, or marking its Diffserv codepoints providing it a guaranteed rate, or marking its Diffserv codepoints
appropriately. When a residential NAT is present, and a relayed appropriately. When a residential NAT is present, and a relayed
candidate gets selected for media, this relayed candidate will be a candidate gets selected for media, this relayed candidate will be a
transport address on an actual STUN relay. That address says nothing transport address on an actual STUN relay. That address says nothing
about the actual transport address in the access router that would be about the actual transport address in the access router that would be
used to classify packets for QoS treatment. Rather, the translation used to classify packets for QoS treatment. Rather, the translation
of that relayed address is needed. By carrying the translation in of that relayed address is needed. By carrying the translation in
the SDP, the proxy can use that transport address to request QoS from the SDP, the proxy can use that transport address to request QoS from
the access router. the access router.
A.5. Importance of the STUN Username B.4. Importance of the STUN Username
ICE requires the usage of message integrity with STUN using its short ICE requires the usage of message integrity with STUN using its short
term credential functionality. The actual short term credential is term credential functionality. The actual short term credential is
formed by exchanging username fragments in the SDP offer/answer formed by exchanging username fragments in the SDP offer/answer
exchange. The need for this mechanism goes beyond just security; it exchange. The need for this mechanism goes beyond just security; it
is actual required for correct operation of ICE in the first place. is actual required for correct operation of ICE in the first place.
Consider agents A, B, and C. A and B are within private enterprise 1, Consider agents A, B, and C. A and B are within private enterprise 1,
which is using 10.0.0.0/8. C is within private enterprise 2, which which is using 10.0.0.0/8. C is within private enterprise 2, which
is also using 10.0.0.0/8. As it turns out, B and C both have IP is also using 10.0.0.0/8. As it turns out, B and C both have IP
skipping to change at page 64, line 45 skipping to change at page 70, line 45
used to run a server on host B, but rather is the agent side of some used to run a server on host B, but rather is the agent side of some
protocol. This decreases the probability of hitting a port in-use, protocol. This decreases the probability of hitting a port in-use,
due to the transient nature of port usage in this range. However, due to the transient nature of port usage in this range. However,
the possibility of a problem does exist, and network deployers should the possibility of a problem does exist, and network deployers should
be prepared for it. Note that this is not a problem specific to ICE; be prepared for it. Note that this is not a problem specific to ICE;
stray packets can arrive at a port at any time for any type of stray packets can arrive at a port at any time for any type of
protocol, especially ones on the public Internet. As such, this protocol, especially ones on the public Internet. As such, this
requirement is just restating a general design guideline for Internet requirement is just restating a general design guideline for Internet
applications - be prepared for unknown packets on any port. applications - be prepared for unknown packets on any port.
A.6. The Candidate Pair Sequence Number Formula B.5. The Candidate Pair Sequence Number Formula
The sequence number for a candidate pair has an odd form. It is: The sequence number for a candidate pair has an odd form. It is:
PAIR-SN = 10000*MAX(O-SN,A-SN) + MIN(O-SN,A-SN) + O-IP/SZ pair priority = 2^32*MIN(O-P,A-P) + 2*MAX(O-P,A-P) + (O-P>A-P:1?0)
Why is this? When the candidate pairs are sorted based on this Why is this? When the candidate pairs are sorted based on this
value, the resulting sorting has the MAX/MIN property. This means value, the resulting sorting has the MAX/MIN property. This means
that the pairs are first sorted based on increasing value of the that the pairs are first sorted based on decreasing value of the
maximum of the two sequence numbers. For pairs that have the same maximum of the two sequence numbers. For pairs that have the same
value of the maximum sequence number, the minimum sequence number is value of the maximum sequence number, the minimum sequence number is
used to sort amongst them. If the max and the min sequence numbers used to sort amongst them. If the max and the min sequence numbers
are the same, the IP address of the offerers candidate serves as a are the same, the offerers priority is used as the tie breaker in the
tie breaker. The factor of 1000 is used since there will always be last part of the expression. The factor of 2*32 is used since the
fewer than a 1000 candidates, and thus the largest value a sequence priority of a single candidate is always less than 2*32, resulting in
number (and thus the minimum sequence number) can have is always less the pair priority being a "concatenation" of the two component
than 1000. This creates the desired sorting property. priorities. This creates the desired sorting property.
Recall that candidate sequence numbers are assigned such that, for a
particular set of candidates of the same type, the RTP components
have lower sequence numbers than the corresponding RTCP component.
Also recall that, if an agent prefers host candidates to server
reflexive to relayed, sequence numbers for host candidates are always
lower than server reflexive which are always lower than relayed.
Because of this,
A.7. The Frozen State B.6. The Frozen State
The Frozen state is used for two purposes. Firstly, it allows ICE to The Frozen state is used for two purposes. Firstly, it allows ICE to
first perform checks for the first component of a media stream. Once first perform checks for the first component of a media stream. Once
a successful check has completed for the first component, the other a successful check has completed for the first component, the other
components of the same type and local preference will get performed. components of the same type and local preference will get performed.
Secondly, when there are multiple media streams, it allows ICE to Secondly, when there are multiple media streams, it allows ICE to
first check candidates for a single media stream, and once a set of first check candidates for a single media stream, and once a set of
candidates has been found, candidates of that same type for other candidates has been found, candidates of that same type for other
media streams can be checked first. This effectively 'caches' the media streams can be checked first. This effectively 'caches' the
results of a check for one media stream, and applies them to another. results of a check for one media stream, and applies them to another.
For example, if only the relayed candidates for audio (which were the For example, if only the relayed candidates for audio (which were the
last resort candidates) succeed, ICE will check the relayed last resort candidates) succeed, ICE will check the relayed
candidates for video first. candidates for video first.
A.8. The remote-candidates attribute B.7. The remote-candidates attribute
The a=remote-candidates attribute exists to eliminate a race The a=remote-candidates attribute exists to eliminate a race
condition between the updated offer and the response to the STUN condition between the updated offer and the response to the STUN
Binding Request that moved a candidate into the Valid list. This Binding Request that moved a candidate into the Valid list. This
race condition is shown in Figure 17. On receipt of message 4, agent race condition is shown in Figure 17. On receipt of message 4, agent
A adds a candidate pair to the valid list. If there was only a A adds a candidate pair to the valid list. If there was only a
single media stream with a single component, agent A could now send single media stream with a single component, agent A could now send
an updated offer. However, the check from agent B has not yet an updated offer. However, the check from agent B has not yet
generated a response, and agent B receives the updated offer (message generated a response, and agent B receives the updated offer (message
7) before getting the response (message 10). Thus, it does not yet 7) before getting the response (message 10). Thus, it does not yet
skipping to change at page 66, line 33 skipping to change at page 72, line 30
|------------------------------------------>| |------------------------------------------>|
|(8) Answer | | |(8) Answer | |
|<------------------------------------------| |<------------------------------------------|
|(9) STUN Req. | | |(9) STUN Req. | |
|<------------------------------------------| |<------------------------------------------|
|(10) STUN Res. | | |(10) STUN Res. | |
|------------------------------------------>| |------------------------------------------>|
Figure 17 Figure 17
A.9. Why are Keepalives Needed? B.8. Why are Keepalives Needed?
Once media begins flowing on a candidate pair, it is still necessary Once media begins flowing on a candidate pair, it is still necessary
to keep the bindings alive at intermediate NATs for the duration of to keep the bindings alive at intermediate NATs for the duration of
the session. Normally, the media stream packets themselves (e.g., the session. Normally, the media stream packets themselves (e.g.,
RTP) meet this objective. However, several cases merit further RTP) meet this objective. However, several cases merit further
discussion. Firstly, in some RTP usages, such as SIP, the media discussion. Firstly, in some RTP usages, such as SIP, the media
streams can be "put on hold". This is accomplished by using the SDP streams can be "put on hold". This is accomplished by using the SDP
"sendonly" or "inactive" attributes, as defined in RFC 3264 [4]. RFC "sendonly" or "inactive" attributes, as defined in RFC 3264 [4]. RFC
3264 directs implementations to cease transmission of media in these 3264 directs implementations to cease transmission of media in these
cases. However, doing so may cause NAT bindings to timeout, and cases. However, doing so may cause NAT bindings to timeout, and
skipping to change at page 67, line 13 skipping to change at page 73, line 9
Thirdly, if silence suppression is in use, long periods of silence Thirdly, if silence suppression is in use, long periods of silence
may cause media transmission to cease sufficiently long for NAT may cause media transmission to cease sufficiently long for NAT
bindings to time out. bindings to time out.
For these reasons, the media packets themselves cannot be relied For these reasons, the media packets themselves cannot be relied
upon. ICE defines a simple periodic keepalive that operates upon. ICE defines a simple periodic keepalive that operates
indpendently of media transmission. This makes its bandwidth indpendently of media transmission. This makes its bandwidth
requirements highly predictable, and thus amenable to QoS requirements highly predictable, and thus amenable to QoS
reservations. reservations.
A.10. Why Prefer Peer Reflexive Candidates? B.9. Why Prefer Peer Reflexive Candidates?
Section 4.2 describes procedures for computing the priority of Section 5.2 describes procedures for computing the priority of
candidate based on its type and local preferences. That section candidate based on its type and local preferences. That section
requires that the type preference for peer reflexive candidates requires that the type preference for peer reflexive candidates
always be lower than server reflexive. Why is that? The reason has always be lower than server reflexive. Why is that? The reason has
to do with the security considerations in Section 15. It is much to do with the security considerations in Section 16. It is much
easier for an attacker to cause an agent to use a false server easier for an attacker to cause an agent to use a false server
reflexive candidate than it is for an attacker to cause an agent to reflexive candidate than it is for an attacker to cause an agent to
use a false peer reflexive candidate. Consequently, attacks against use a false peer reflexive candidate. Consequently, attacks against
the STUN binding discovery usage are thwarted by ICE by preferring the STUN binding discovery usage are thwarted by ICE by preferring
the peer reflexive candidates. the peer reflexive candidates.
A.11. Why Can't Offerers Send Media When a Pair Validates B.10. Why Send an Updated Offer?
Section 11.1 describes rules for sending media. The rules are
asymmetric, and not the same for offerers and answerers. In
particular, an answerer can send media right away to a candidate pair
once it validates, even if it doesnt match the pairs in the m/c-line.
THe offerer cannot - it must wait for an updated offer/answer
exchange. Why is that?
This, in fact, relates to a bigger question - why is the updated
offer/answer exchange needed at all? Indeed, in a pure offer/answer
environment, it would not be. The offerer and answerer will agree on
the candidates to use through ICE, and then can begin using them. As
far as the agents themselves are concerned, the updated offer/answer
provides no new information. However, in practice, numerous
components along the signaling path look at the SDP information.
These include entities performing off-path QoS reservations, NAT
traversal components such as ALGs and Session Border Controllers
(SBCs) and diagnostic tools that passively monitor the network. For
these tools to continue to function without change, the core property
of SDP - that the m/c-lines represent the addresses used for media -
must be retained. For this reason, an updated offer must be sent.
To ensure that an updated offerer is sent, ICE purposefully prevents Section 12.1 describes rules for sending media. Both agents can send
the offerer from sending media until that offer is sent. It media once ICE checks complete, without waiting for an updated offer.
furthermore restricts the answerer in how long it can send media Indeed, the only purpose of the updated offer is to "correct" the
until an updated offer is received. This provides protocol m/c-line so that it matches where media is being sent, based on ICE
incentives for sending the updated offer. procedures.
The updated offer also helps ensure that ICE did the right thing. In This begs the question - why is the updated offer/answer exchange
very unusual cases, the offerer and answerer might not agree on the needed at all? Indeed, in a pure offer/answer environment, it would
candidates selected by ICE. This would be detected in the updated not be. The offerer and answerer will agree on the candidates to use
offer/answer exchange, allowing them to restart ICE procedures to fix through ICE, and then can begin using them. As far as the agents
the problem. themselves are concerned, the updated offer/answer provides no new
information. However, in practice, numerous components along the
signaling path look at the SDP information. These include entities
performing off-path QoS reservations, NAT traversal components such
as ALGs and Session Border Controllers (SBCs) and diagnostic tools
that passively monitor the network. For these tools to continue to
function without change, the core property of SDP - that the m/c-
lines represent the addresses used for media - must be retained. For
this reason, an updated offer must be sent.
Author's Address Author's Address
Jonathan Rosenberg Jonathan Rosenberg
Cisco Systems Cisco Systems
600 Lanidex Plaza 600 Lanidex Plaza
Parsippany, NJ 07054 Parsippany, NJ 07054
US US
Phone: +1 973 952-5000 Phone: +1 973 952-5000
 End of changes. 199 change blocks. 
810 lines changed or deleted 1053 lines changed or added

This html diff was produced by rfcdiff 1.33. The latest version is available from http://tools.ietf.org/tools/rfcdiff/