<?xml version="1.0" encoding="windows-1252"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC0822 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC0822 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8445 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8445.xml">
]>
<?rfc toc="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="yes" ?>
<?rfc sortrefs="no" ?>
<?rfc strict="yes" ?>
<rfc ipr="trust200902" category="std" docName="draft-holmberg-ice-pac-00" obsoletes="" updates="8445" submissionType="IETF" xml:lang="en">
  <front>
    <title abbrev="ICE Premature">
      Interactive Connectivity Establishment Patiently Awaiting Candidates (ICE PAC)
    </title>
    <author initials="C.H." surname="Holmberg" fullname="Christer Holmberg">
      <organization>Ericsson</organization>
      <address>
        <postal>
          <street>Hirsalantie 11</street>
          <code>02420</code>
          <city>Jorvas</city>
          <country>Finland</country>
        </postal>
        <email>christer.holmberg@ericsson.com</email>
      </address>
    </author>
    <author initials="J." surname="Uberti" fullname="Justin Uberti">
      <organization>Google</organization>
      <address>
        <postal>
          <street>747 6th St W</street>
          <code>98033</code>
          <city>Kirkland</city>
          <country>USA</country>
        </postal>
        <email>justin@uberti.name</email>
      </address>
    </author>

    <date year="2019"/>
    <area>Transport</area>
    <workgroup>ICE Working Group</workgroup>
    <keyword>ICE</keyword>
    <keyword>PAC</keyword>
    <keyword>Candidate</keyword>
    <abstract>
      <t>
        During the process of creating a peer-to-peer connection,
        ICE implementations can encounter situations where they have
        no candidate pairs to check, and, as a result, conclude that
        ICE processing has failed. However, because additional
        candidate pairs can be discovered during ICE processing, 
        declaring failure at this point may be premature. This
        document discusses when these situations can occur and
        proposes a way to avoid premature failure.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction" toc="default">
      <t>
        <xref target="RFC8445"></xref> describes a protocol, Interactive Connectivity Establishment (ICE),
        for Network Address Translator (NAT) traversal for UDP-based communication.
      </t>
      <t>
        Typically, when using ICE, endpoints will exchange candidate addresses,
        form a list of candidate pairs, and then test each candidate pair to see
        if connectivity can be established. If the test for a given pair fails,
        it is marked accordingly, and if all pairs have failed, the overall
        ICE process is considered to have failed.
      </t>
      <t>
        During the process of connectivity checks, additional candidates may
        be created as a result of successful inbound checks from the remote
        peer. Such candidates are referred to as peer-reflexive candidates,
        and once discovered, will be used to form new candidate pairs which will
        be tested like any other. However, there is an inherent race condition
        here; if, before learning about any peer-reflexive candidates, an
        endpoint runs out of candidate pairs to check, either because it has
        none, or it considers them all to have failed, it will prematurely
        declare failure and terminate ICE processing. This race condition can
        occur in many common situations.
      </t>
      <t>
        This specification updates <xref target="RFC8445"></xref>, by simply
        requiring that an endpoint wait a minimum amount of time before
        declaring ICE failure, even if there are no candidate pairs to check,
        or if all candidate pairs have failed. This delay provides enough time
        for the discovery of peer-reflexive candidates, which may eventually
        lead to ICE processing completing successfully.
      </t>
    </section>

    <section title="Conventions">
      <t>
        The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
        NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
        "MAY", and "OPTIONAL" in this document are to be interpreted as
        described in BCP 14 <xref target="RFC2119"></xref> <xref target="RFC8174"></xref>
        when, and only when, they appear in all capitals, as shown here.
      </t>
    </section>

    <section title="Relevant Scenarios">
        <t>
          As noted above, the core problem this specification attempts to
          address is the situation where even after local gathering and remote
          candidate signaling has completed, the ICE agent immediately ends up
          with no valid pairs and no candidate pairs left to check, resulting in
          a premature ICE failure. This failure is premature because not
          enough time has elapsed to allow for discovery of peer-reflexive
          candidates from inbound connectivity checks; if discovered, these
          candidates are very likely to result in a valid pair.
        </t>
        <t>
          In most ICE scenarios, the lengthy timeouts for connectivity checks,
          typically tens of seconds, will prevent this problem for occuring.
          However, there are certain specific cases where this problem will
          frequently occur.
        </t>
        <section title="No Candidates From Peer">
          <t>
            It is entirely legal for an ICE gent to provide zero candidates of
            its own. If the agent somehow knows that the remote endpoint is
            directly reachable, gathering local candidates is unnecessary and
            will only cause delays; the remote endpoint can discover the
            appropriate local candidate via connectivity checks.
          </t>
          <t>
            However, following the procedures from
            <xref target="RFC8445"></xref> strictly will result in immediate
            ICE failure, since the checklist at the remote endpoint will be
            empty.
          </t>
        </section>
        <section title="All Candidates Discarded">
          <t>
            Even if the ICE agent provides candidates, they may be discarded
            by the remote endpoint if it does not know what to do with them.
            For example, candidates may use an address family that the remote
            endpoint does not support, (e.g., a host candidate with an IPv6
            address in a NAT64 scenario), or may not be usable for some other
            reason (e.g., a candidate that contains a FQDN that fails to
            resolve).
          </t>
          <t>
            In these scenarios, when the candidates are discarded, the
            checklist at the remote endpoint will once again be empty, leading
            to immediate ICE failure.
          </t>
        </section>
        <section title="Immediate Candidate Pair Failure">
          <t>
            Section 7.2.5.2 of <xref target="RFC8445"></xref> describes several
            situations in which a candidate pair will be considered to have
            failed, well before the connectivity check timeout.
          </t>
          <t>
            As a result, even if the ICE agent provides usable candidates,
            the pairs created by the remote endpoint may fail immediately when
            checked, e.g., a check to a nonroutable address that receives an
            immediate ICMP error.
          </t>
          <t>
            In this situation, the checklist at the remote endpoint may contain
            only failed pairs, resulting in immediate ICE failure.
          </t>
        </section>
    </section>

    <section title="Update to RFC 8445">
      <t>
        In order to avoid the problem raised by this document, the ICE agent
        needs to wait enough time to allow peer-reflexive candidates to be
        discovered. Accordingly, when full ICE implementations begin their
        ICE processing, as described in <xref target="RFC8445" />, Section
        6.1, the ICE agent MUST set a timer, and its duration SHOULD be
        equal to the ICE agent's connectivity check timeout.
      </t>
      <t>
        This timeout value is chosen to roughly coincide with the maximum
        possible duration of ICE connectivity checks from the remote peer,
        which, if successful, could create peer-reflexive candidates. Because
        the ICE agent doesn't know the exact number of candidate pairs and pacing
        interval in use by the remote side, this timeout value is simply a
        guess, albeit an educated one. Regardless, for this particular problem,
        the desired benefits will be realized as long as the ICE agent waits
        some reasonable amount of time.
      </t>
      <t>
        While the timer is running, if a checklist has no pairs left to check,
        i.e., there are no pairs that are not in the failed state, the ICE
        agent MUST not conclude that ICE processing has failed, and MUST wait
        for the timer to elapse before doing so.
      </t>
      <t>
        One consequence of this behavior is that in cases where ICE should fail,
        e.g., where both sides provide candidates with unresolvable FQDNs
        ICE will no longer fail immediately, and only fail when the
        aforementioned timer expires. However, because most ICE scenarios
        require an extended period of time to determine failure, the
        fact that some specific scenarios no longer fail fast should have
        minimal application impact, if any.
      </t>
    </section>

    <section anchor="section.sec" title="Security Considerations">
      <t>
        The security considerations for ICE are defined in <xref target="RFC8445" pageno="false" format="default"/>.
        This specification only recommends ICE endpoints to wait for a certain time of period before they declare
        ICE failure, and does not introduce new security considerations.
      </t>
    </section>

    <section anchor="section.iana" title="IANA considerations">
      <t>
        This specification makes no requests to IANA.
      </t>
    </section>

    <section anchor="sec-acks" title="Acknowledgements" toc="default">
    </section>
  </middle>
  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>
      <?rfc include="reference.RFC.8174"?>
      <?rfc include="reference.RFC.8445"?>
    </references>
  </back>
</rfc>
