<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc number="8016" category="std" submissionType="IETF" consensus="yes" ipr="trust200902">
  <front>
    <title abbrev="Mobility with TURN">Mobility with Traversal Using Relays
    around NAT (TURN)</title>

    <author fullname="Tirumaleswar Reddy" initials="T." surname="Reddy">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>Cessna Business Park, Varthur Hobli</street>

          <street>Sarjapur Marathalli Outer Ring Road</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560103</code>

          <country>India</country>
        </postal>

        <email>tireddy@cisco.com</email>
      </address>
    </author>

    <author fullname="Dan Wing" initials="D." surname="Wing">
      <organization/>
      <address>
        <email>dwing-ietf@fuggles.com</email>
      </address>
    </author>

    <author fullname="Prashanth Patil" initials="P." surname="Patil">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street></street>

          <city>Bangalore</city>

          <country>India</country>
        </postal>

        <email>praspati@cisco.com</email>
      </address>
    </author>

    <author fullname="Paal-Erik Martinsen" initials="P.E" surname="Martinsen">
      <organization abbrev="Cisco">Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>Philip Pedersens vei 22</street>

          <city>Lysaker</city>

          <region>Akershus</region>

          <code>1325</code>

          <country>Norway</country>
        </postal>

        <email>palmarti@cisco.com</email>
      </address>
    </author>

    <date month="November" year="2016" />

    <workgroup>TRAM</workgroup>

<keyword>IP Address Mobility</keyword>
<keyword>VoIP</keyword>
<keyword>VoIP</keyword>
<keyword>ICE</keyword>
<keyword>STUN</keyword>
<keyword>RTP</keyword>
<keyword>TUNNEL</keyword>

    <abstract>
      <t>It is desirable to minimize traffic disruption caused by changing IP
      address during a mobility event. One mechanism to minimize disruption is
      to expose a shorter network path to the mobility event so that only the local
      network elements are aware of the changed IP address and the remote peer
      is unaware of the changed IP address.</t>

      <t>This document provides such an IP address mobility solution using
      Traversal Using Relays around NAT (TURN). This is achieved by allowing a
      client to retain an allocation on the TURN server when the IP address of
      the client changes.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">

      <t>When moving between networks, the endpoint's IP address can change or, due to NAT, the endpoint's public IP address can change. Such a change
      of IP address breaks upper-layer protocols such as TCP and RTP. Various
      techniques exist to prevent this breakage, all tied to making the
      endpoint's IP address static (e.g., Mobile IP, Proxy Mobile IP,
      Locator/ID Separation Protocol (LISP)).
      Other techniques exist, which make the change in IP address agnostic to
      the upper-layer protocol (e.g., Stream Control Transmission Protocol (SCTP)). The mechanism described in this
      document is in that last category.</t>

      <t>A server using Traversal Using Relays around NAT (TURN) <xref
      target="RFC5766"></xref> relays media packets and is used for a
      variety of purposes, including overcoming NAT and firewall traversal
      issues. The existing TURN specification does not permit a TURN client to
      reuse an allocation across client IP address changes. Due to this, when
      the IP address of the client changes, the TURN client has to request a
      new allocation, create permissions for the remote peer, create channels,
      etc. In addition, the client has to re-establish communication with its
      signaling server and send an updated offer to the remote peer conveying the

      newly relayed candidate address. Then, the remote side has to re-gather all
      candidates and signal them to the client, and the endpoints have to
      perform Interactive Connectivity Establishment (ICE) <xref
      target="RFC5245"></xref> checks. If the ICE continuous
      nomination procedure <xref target="NOMBIS"></xref> is
      used, then the newly relayed candidate address would have to be
      "trickled" (i.e., incrementally provisioned as described in <xref
      target="TRICKLE-SIP"></xref>), and ICE checks would 
      have to be performed according to <xref target="TRICKLE-ICE"/> by the endpoints to nominate pairs for selection by ICE.</t>

      <t>This specification describes a mechanism to seamlessly reuse
      allocations across client IP address changes without any of the hassles
      described above. A critical benefit of this technique is that the remote
      peer does not have to support mobility or deal with any of the address
      changes. The client, which is subject to IP address changes, does all the
      work. The mobility technique works across and between network types
      (e.g., between 3G and wired Internet access), so long as the client can
      still access the TURN server. The technique should also work seamlessly
      when (D)TLS is used as a transport protocol for Session Traversal
      Utilities for NAT (STUN) <xref target="RFC5389"></xref>. When there is a
      change in IP address, the client uses (D)TLS Session Resumption without
      Server-Side State as described in <xref target="RFC5077"></xref> to
      resume secure communication with the TURN server, using the changed
      client IP address.</t>
    </section>

    <section anchor="notation" title="Notational Conventions">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119"></xref>.</t>

      <t>This document uses terminology defined in <xref target="RFC5245"></xref>
      and the following additional terminology:</t>

      <t>Break Before Make: The old communication path is broken ("break")
      before new communication can be created ("make"). 
   Such changes
   typically occur because a network's physical cable is disconnected,
   radio transmission is turned off, or a client moves out of radio
   range.

</t>

      <t>Make Before Break: A new communication path is created ("make")
      before the old communication path is broken ("break"). 
   Such changes
   typically occur because a network is reconnected with a physical cable,
   radio transmission is turned on, or a client moves into radio range.
      </t>
    </section>

    <section anchor="MTURN" title="Mobility Using TURN">
      <t>To achieve mobility, a TURN client should be able to retain an
      allocation on the TURN server across changes in the client IP address as
      a consequence of movement to other networks.</t>

      <t>When the client sends the initial Allocate request to the TURN
      server, it will include a new STUN attribute MOBILITY-TICKET (with zero
      length value), which indicates that the client is capable of mobility
      and desires a ticket. The TURN server provisions a ticket that is sent
      inside the new STUN attribute MOBILITY-TICKET in the Allocate success
      response to the client. The ticket will be used by the client when it
      wants to refresh the allocation but with a new client IP address and
      port. This ensures that an allocation can only be refreshed by the same
      client that allocated the relayed transport address. When a client's IP
      address changes due to mobility, it presents the previously obtained
      ticket in a Refresh request to the TURN server. If the ticket is found
      to be valid, the TURN server will retain the same relayed address/port
      for the new IP address/port allowing the client to continue using
      previous channel bindings -- thus, the TURN client does not need to
      obtain new channel bindings. Any data from the external peer will be
      delivered by the TURN server to this new IP address/port of the client.
      The TURN client will continue to send application data to its peers
      using the previously allocated channelBind Requests.</t>

      <t><figure anchor="Fig1" title="Mobility Using TURN">
          <artwork align="center"><![CDATA[
  TURN                                 TURN           Peer
  client                               server          A             
    |-- Allocate request --------------->|             | 
    |   + MOBILITY-TICKET (length=0)     |             |            
    |                                    |             |             
    |<--------------- Allocate failure --|             |             
    |                 (401 Unauthorized) |             |             
    |                                    |             |             
    |-- Allocate request --------------->|             |             
    |   + MOBILITY-TICKET (length=0)     |             |             
    |                                    |             |             
    |<---------- Allocate success resp --|             |             
    |            + MOBILITY-TICKET       |             |             
   ...                                  ...           ...
(changes IP address)
    |                                    |             |             
    |-- Refresh request ---------------->|             |
    |   + MOBILITY-TICKET                |             |             
    |                                    |             |             
    |<----------- Refresh success resp --|             |
    |   + MOBILITY-TICKET                |             |             
    |                                    |             | 
]]></artwork>
        </figure></t>

      <t>In <xref target="Fig1"></xref>, the client sends an Allocate request
      with a MOBILITY-TICKET attribute to the server without credentials.
      Since the server requires that all requests be authenticated using
      STUN's long-term credential mechanism, the server rejects the request
      with a 401 (Unauthorized) error code. The client then tries again, this
      time including credentials (not shown). This time, the server accepts
      the Allocate request and returns an Allocate success response and a
      ticket inside the MOBILITY-TICKET attribute. Sometime later, the client
      IP address changes, and the client decides to refresh the allocation, and thus sends
      a Refresh request to the server with a MOBILITY-TICKET attribute
      containing the ticket it received from the server. The refresh is
      accepted, and the server replies with a Refresh success response and a
      new ticket inside the MOBILITY-TICKET attribute.</t>

      <section title="Creating an Allocation">
        <section title="Sending an Allocate Request">
          <t>In addition to the process described in Section 6.1 of <xref
          target="RFC5766"></xref>, the client includes the MOBILITY-TICKET
          attribute with a length of zero. This indicates that the client is a mobile node
          and wants a ticket.</t>
        </section>

        <section title="Receiving an Allocate Request">
          <t>In addition to the process described in Section 6.2 of <xref
          target="RFC5766"></xref>, the server does the following:</t>

          <t>If the MOBILITY-TICKET attribute is included, and has a length
          of zero, but TURN session mobility is forbidden by local policy, the
          server will reject the request with the new error code 405 (Mobility Forbidden). If the MOBILITY-TICKET attribute is included and has a non-zero
          length, then the server will generate an error response with an error
          code of 400 (Bad Request). Following the rules specified in <xref
          target="RFC5389"></xref>, if the server does not understand the
          MOBILITY-TICKET attribute, it ignores the attribute.</t>

          <t>If the server can successfully process the request and create an
          allocation, the server replies with a success response that includes
          a STUN MOBILITY-TICKET attribute. The TURN server can store system-internal data in the ticket that is encrypted by a key known only
          to the TURN server and sends the ticket in the STUN MOBILITY-TICKET
          attribute as part of the Allocate success response. An example of
          ticket construction is discussed in <xref target="example"></xref>. The ticket is opaque to the client, so the structure is not subject
          to interoperability concerns, and implementations may diverge from
          this format. The client could be roaming across networks with a different path MTU and from one address family to another (e.g., IPv6
          to IPv4). The TURN server to support mobility must assume that the
          path MTU is unknown and use a ticket length in accordance with the published guidance on STUN UDP fragmentation (Section 7.1 of <xref
          target="RFC5389"></xref>).</t>

          <t>Note: There is no guarantee that the fields in the ticket are
          going to be decodable to a client, and therefore attempts by a
          client to examine the ticket are unlikely to be useful.</t>
        </section>

        <section title="Receiving an Allocate Success Response">
          <t>In addition to the process described in Section 6.3 of <xref
          target="RFC5766"></xref>, the client will store the MOBILITY-TICKET
          attribute, if present, from the response. This attribute will be
          presented by the client to the server during a subsequent Refresh
          request to aid mobility.</t>
        </section>

        <section title="Receiving an Allocate Error Response">
          <t>If the client receives an Allocate error response with error code
          405 (Mobility Forbidden), the error is processed as follows:

	  <list>
            <t>405 (Mobility Forbidden): The request is valid, but the server
          is refusing to perform it, likely due to administrative
          restrictions. The client considers the current transaction as having
          failed. The client can notify the user or operator. The client
          SHOULD NOT retry sending the Allocate request containing the MOBILITY-TICKET
          with this server until it believes the problem has been fixed.</t>
	  </list></t>

          <t>All other error responses must be handled as described in <xref
          target="RFC5766"></xref>.</t>
        </section>
      </section>

      <section anchor="refresh" title="Refreshing an Allocation">
        <section title="Sending a Refresh Request">
          <t>If a client wants to refresh an existing allocation and update
          its time-to-expiry or delete an existing allocation, it sends a
          Refresh request as described in Section 7.1 of <xref
          target="RFC5766"></xref>. If the client's IP address or source port has changed and the client wants to retain the existing
          allocation, the client includes the MOBILITY-TICKET attribute
          received in the Allocate success response in the Refresh request. If
          there has been no IP address or source port number change, the
          client MUST NOT include a MOBILITY-TICKET attribute, as this would be
          rejected by the server and the client would need to retransmit the
          Refresh request without the MOBILITY-TICKET attribute.</t>
        </section>

        <section title="Receiving a Refresh Request">
          <t>In addition to the process described in Section 7.2 of <xref
          target="RFC5766"></xref>, the server does the following:</t>

          <t>If the STUN MOBILITY-TICKET attribute is included in the Refresh
          request, and the server configuration changed to forbid mobility or
          the server transparently fails over to another server instance that
          forbids mobility, then the server rejects the Refresh request with a
          405 (Mobility Forbidden) error and the client starts afresh with a
          new allocation.</t>

          <t>If the STUN MOBILITY-TICKET attribute is included in the Refresh
          request, then the server will not retrieve the 5-tuple from the
          packet to identify an associated allocation. Instead, the TURN server
          will decrypt the received ticket, verify the ticket's validity, and
          retrieve the 5-tuple allocation using the ticket. If this 5-tuple
          obtained does not identify an existing allocation, then the server
          MUST reject the request with a 437 (Allocation Mismatch) error. If
          the ticket is invalid, then the server MUST reject the request with a
          400 (Bad Request) error.</t>

          <t>If the source IP address and port of the Refresh request with
          the STUN MOBILITY-TICKET attribute is the same as the stored 5-tuple
          allocation, then the TURN server rejects the request with a 400 (Bad
          Request) error. If the source IP address and port of the Refresh
          request is different from the stored 5-tuple allocation, the TURN
          server proceeds with a MESSAGE-INTEGRITY validation to identify that it is the same user that had previously created the TURN
          allocation. If the above check is not successful, then the server MUST
          reject the request with a 441 (Wrong Credentials) error.</t>

          <t>If all of the above checks pass, the TURN server understands that
          the client either has moved to a new network and acquired a new IP
          address (Break Before Make) or is in the process of switching to a
          new interface (Make Before Break). The source IP address of the
          request could be either the host transport address or the server-reflexive transport address. The server then updates its
          state data with the new client IP address and port but does not
          discard the old 5-tuple from its state data. The TURN server calculates
          the ticket with the new 5-tuple and sends the new ticket in the STUN
          MOBILITY-TICKET attribute as part of Refresh success response. The
          new ticket sent in the refresh response MUST be different from the
          old ticket.</t>

          <t>The TURN server MUST continue receiving and processing data on
          the old 5-tuple and MUST continue transmitting data on the old-5
          tuple until it receives a Send Indication or ChannelData message
          from the client on the new 5-tuple or a message from the client to
          close the old connection (e.g., a TLS fatal alert or TCP RST). After
          receiving any of those messages, a TURN server discards the old
          ticket and the old 5-tuple associated with the old ticket from its
          state data. Data sent by the client to the peer is accepted on the
          new 5-tuple and data received from the peer is forwarded to the new
          5-tuple. If the refresh request containing the MOBILITY-TICKET
          attribute does not succeed (e.g., the packet is lost if the request is sent
          over UDP, or the server is unable to fulfill the request), then
          the client can continue to exchange data on the old 5-tuple until it
          receives the Refresh success response.</t>

          <t>The old ticket can only be used for the purposes of
          retransmission. If the client wants to refresh its allocation with a
          new server-reflexive transport address, it MUST use the new ticket.
          If the TURN server has not received a Refresh request with the STUN
          MOBILITY-TICKET attribute but receives Send indications or
          ChannelData messages from a client, the TURN server MAY discard or
          queue those Send indications or ChannelData messages (at its
          discretion). Thus, it is RECOMMENDED that the client avoid
          transmitting a Send indication or ChannelData message until it has
          received an acknowledgement for the Refresh request with the STUN
          MOBILITY-TICKET attribute.</t>

          <t>To accommodate the potential loss of Refresh responses, a server must
          retain the old STUN MOBILITY-TICKET attribute for a period of at
          least 30 seconds to be able to recognize a retransmission of the Refresh
          request with the old STUN MOBILITY-TICKET attribute from the
          client.</t>
        </section>

        <section title="Receiving a Refresh Response">
          <t>In addition to the process described in Section 7.3 of <xref
          target="RFC5766"></xref>, the client will store the MOBILITY-TICKET
          attribute, if present, from the response. This attribute will be
          presented by the client to the server during a subsequent Refresh
          request to aid mobility.</t>
        </section>
      </section>

      <section title="New STUN Attribute MOBILITY-TICKET">
        <t>This attribute is used to retain an allocation on the TURN server.
        It is exchanged between the client and server to aid mobility. The
        value of the MOBILITY-TICKET is encrypted and is of variable length.</t>
      </section>

      <section title="New STUN Error Response Code">
        <t>This document defines the following new error response code: <list
            style="empty">
            <t>405 (Mobility Forbidden): Mobility request was valid but cannot
            be performed due to administrative or similar restrictions.</t>
          </list></t>
      </section>
    </section>

    <section title="IANA Considerations">

      <t>IANA has added the following attribute to the <xref
      target="IANA-STUN">"STUN Attributes" registry</xref>: 
<list style="symbols">
          <t>MOBILITY-TICKET (0x8030, in the comprehension-optional range)</t>
        </list>Also, IANA has added a new STUN error code "Mobility Forbidden" with the
      value 405 to the <xref target="IANA-STUN">"STUN Error Codes"
      registry</xref>.</t>
    </section>

    <section title="Security Considerations">
      <t>The TURN server MUST always ensure that the ticket is authenticated and
      encrypted using strong cryptographic algorithms to prevent modification
      or eavesdropping by an attacker. The ticket MUST be constructed such
      that it has strong entropy to ensure that nothing can be gleaned by looking
      at the ticket alone.</t>

      <t>An attacker monitoring the traffic between the TURN client and server
      can impersonate the client and refresh the allocation using the ticket
      issued to the client with the attacker's IP address and port. The TURN client
      and server MUST use the STUN long-term credential mechanism <xref
      target="RFC5389"></xref>, the STUN Extension for Third-Party Authorization
      <xref target="RFC7635"></xref>,  or a (D)TLS connection to prevent
      malicious users from impersonating the client. With any of those
      three mechanisms, when the server receives the Refresh request with the STUN
      MOBILITY-TICKET attribute from the client, it identifies that it is
      indeed the same client but with a new IP address and port using the
      ticket it had previously issued to refresh the allocation. If (D)TLS is
      not used or the (D)TLS handshake fails, and authentication also fails,
      then the
      TURN client and server MUST fail and not proceed with TURN
      mobility.</t>

      <t>Security considerations described in <xref target="RFC5766"></xref>
      are also applicable to this mechanism.</t>
    </section>

  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include="reference.RFC.5245"?>

      <?rfc include='reference.RFC.5766'?>

      <?rfc include='reference.RFC.5389'
?>

      <?rfc include='reference.RFC.5077' 
?>
    </references>

    <references title="Informative References">

      <?rfc include='reference.RFC.7635'?>

<!-- draft-ietf-ice-trickle: I-D Exists -->
<reference anchor='TRICKLE-ICE'>
<front>
<title>Trickle ICE: Incremental Provisioning of Candidates for the Interactive Connectivity Establishment (ICE) Protocol</title>

<author initials='E' surname='Ivov' fullname='Emil Ivov'>
    <organization />
</author>

<author initials='E' surname='Rescorla' fullname='Eric Rescorla'>
    <organization />
</author>

<author initials='J' surname='Uberti' fullname='Justin Uberti'>
    <organization />
</author>

<author initials='P' surname='Saint-Andre' fullname='Peter Saint-Andre'>
    <organization />
</author>

<date month='September' day='8' year='2016' />

<abstract><t>This document describes an extension to the Interactive Connectivity Establishment (ICE) protocol that enables ICE agents to send and receive candidates incrementally rather than exchanging complete lists.  With such incremental provisioning, ICE agents can begin connectivity checks while they are still gathering candidates and considerably shorten the time necessary for ICE processing to complete.  This mechanism is called "Trickle ICE".</t></abstract>

</front>
<seriesInfo name='Work in Progress,' value='draft-ietf-ice-trickle-04' />

</reference>

<!-- draft-ietf-mmusic-trickle-ice-sip: I-D Exists -->
<reference anchor='TRICKLE-SIP'>
<front>
<title>A Session Initiation Protocol (SIP) usage for Trickle ICE</title>

<author initials='E' surname='Ivov' fullname='Emil Ivov'>
    <organization />
</author>

<author initials='T' surname='Stach' fullname='Thomas Stach'>
    <organization />
</author>

<author initials='E' surname='Marocco' fullname='Enrico Marocco'>
    <organization />
</author>

<author initials='C' surname='Holmberg' fullname='Christer Holmberg'>
    <organization />
</author>

<date month='October' year='2016' />

<abstract><t>The Interactive Connectivity Establishment (ICE) protocol describes a Network Address Translator (NAT) traversal mechanism for UDP-based multimedia sessions established with the Offer/Answer model.  The ICE extension for Incremental Provisioning of Candidates (Trickle ICE) defines a mechanism that allows ICE agents to shorten session establishment delays by making the candidate gathering and connectivity checking phases of ICE non-blocking and by executing them in parallel.  This document defines usage semantics for Trickle ICE with the Session Initiation Protocol (SIP).</t></abstract>

</front>

<seriesInfo name='Work in Progress,'
	    value='draft-ietf-mmusic-trickle-ice-sip-06' />
</reference>

<!-- I-D.uberti-mmusic-nombis-00 IESG state: Expired -->

<reference anchor='NOMBIS'>
<front>
<title>Improvements to ICE Candidate Nomination</title>

<author initials='J' surname='Uberti' fullname='Justin Uberti'>
    <organization />
</author>

<author initials='J' surname='Lennox' fullname='Jonathan Lennox'>
    <organization />
</author>

<date month='March' day='9' year='2015' />

</front>

<seriesInfo name='Work in Progress,' value='draft-uberti-mmusic-nombis-00' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-uberti-mmusic-nombis-00.txt' />
</reference>

      <reference anchor="IANA-STUN"
                 target="http://www.iana.org/assignments/stun-parameters">
        <front>
          <title>Session Traversal Utilities for NAT (STUN) Parameters</title>

          <author>
            <organization>IANA</organization>
          </author>

          <date />
        </front>
      </reference>
    </references>

    <section anchor="example" title="Example of Ticket Construction">
      <t>The TURN server uses two different keys: one 128-bit key for Advance
      Encryption Standard (AES) in Cipher Block Chaining (CBC) mode
      (AES_128_CBC) and a 256-bit key for HMAC-SHA-256-128 for integrity
      protection. The ticket can be structured as follows:</t>

      <t><figure anchor="Ticket" title="Ticket Format">
          <artwork align="left"><![CDATA[      struct {
          opaque key_name[16];
          opaque iv[16];
          opaque encrypted_state<0..2^16-1>;
          opaque mac[16];
      } ticket;
]]></artwork>
        </figure></t>

      <t>Here, key_name serves to identify a particular set of keys used to
      protect the ticket. It enables the TURN server to easily recognize
      tickets it has issued. The key_name should be randomly generated to
      avoid collisions between servers. One possibility is to generate new
      random keys and key_name every time the server is started.</t>


      <t>The TURN state information (which is either self-contained or a handle) in
      encrypted_state is encrypted using 128-bit AES in CBC mode with the
      given Initialization Vector (IV). The Message Authentication Code (MAC) is calculated using HMAC-SHA-256-128 over key_name (16
      octets) and IV (16 octets), followed by the length of the encrypted_state
      field (2 octets) and its contents (variable length).</t>
    </section>

    <section title="Acknowledgements" numbered="no">

      <t>Thanks to Alfred Heggestad, Lishitao, Sujing Zhou, Martin Thomson,
      Emil Ivov, Oleg Moskalenko, Dave Waltermire, Pete Resnick, Antoni
      Przygienda, Alissa Cooper, Ben Campbell, Suresh Krishnan, Mirja
      Kuehlewind, Jonathan Lennox, and Brandon Williams for review and
      comments.</t>
    </section>

  </back>
</rfc>
