<?xml version="1.0" encoding="US-ASCII"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>

<?rfc toc="yes"?>
<?rfc strict="yes"?>
<!--<?rfc tocompact="yes"?>-->
<!--<?rfc compact="yes"?>
<?rfc subcompact="no"?>-->
<?rfc tocdepth="1"?>
<?rfc symrefs="yes"?>
<?rfc comments="yes" ?>
<?rfc rfcedstyle="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc iprnotified="no" ?>
<rfc category="bcp"
     docName="draft-ietf-behave-dccp-05.txt"
     ipr="full3978">
  <front>
    <title abbrev="NAT DCCP Requirements">
      Network Address Translation (NAT) Behavioral Requirements
      for the Datagram Congestion Control Protocol</title>

    <author fullname="R&eacute;mi Denis-Courmont" initials="R."
            surname="Denis-Courmont">
      <organization>VideoLAN project</organization>
      <address>
        <email>rem@videolan.org</email>
        <uri>http://www.videolan.org/</uri>
      </address>
    </author>

    <date day="27" month="November" year="2008"/>

    <area>Transport Area</area>
    <workgroup>Behavior Engineering for Hindrance Avoidance</workgroup>

    <abstract>
      <t>This document defines a set of requirements for NATs
        handling the Datagram Congestion Control Protocol (DCCP).
        Those allow DCCP applications, such as streaming applications
        to operate consistently.
        These requirements are very similar to the TCP requirements for NATs
        already published by the IETF.
        Ensuring that NATs meet this set of requirements will greatly
        increase the likelihood that applications using DCCP
        will function properly.
      </t>
    </abstract>
  </front>

  <middle>

    <section anchor="intro" title="Introduction">
      <t> For historical reasons, NAT devices are not typically capable of
        handling datagrams and flows for applications using the
        Datagram Congestion Control Protocol (DCCP)<xref target="RFC4340"/>.
      </t>
      <t> This draft discusses the technical issues involved,
        and proposes a set of requirements for NAT devices
        to handle DCCP in a way that enables communications
        when either or both of the DCCP endpoints
        are located behind one or more NAT devices.
        All definitions and requirements in <xref target="RFC4787"/>
        are inherited here.
        The requirements are otherwise designed similarly
        to those in <xref target="RFC5382"/>,
        from which this memo borrows its structure and much of its content.
      </t>
      <t> Note however that, if both endpoints are hindered by NAT devices,
        the normal model of asymmetric connection model of DCCP will not work.
        A simultaneous open must be performed,
        as in <xref target="I-D.ietf-dccp-simul-open"/>.
        Also, a separate unspecified mechanism may be needed,
        such as Unilateral Self Address Fixing (UNSAF)<xref target="RFC3424"/>
        protocols,
        if an endpoint needs to learn its own external NAT mappings.
      </t>
    </section>

    <section anchor="defs" title="Definitions">
      <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"/>.
      </t>
      <t> This documentation uses the term &quot;DCCP connection&quot;
        to refer to individual DCCP flows,
        as uniquely identified by the quadruple (source and destination IP
        addresses and DCCP ports) at a given time.
      </t>
      <t> This document uses the term &quot;NAT mapping&quot;
        to refer to state at the NAT necessary for network address
        and port translation of DCCP connections.
        This document also uses the terms &quot;endpoint-independent
        mapping&quot;, &quot;address-dependent mapping&quot;,
        &quot;address and port-dependent mapping&quot;,
        &quot;filtering behavior&quot;,
        &quot;endpoint-independent filtering&quot;,
        &quot;address-dependent filtering&quot;,
        &quot;address and port-dependent filtering&quot;,
        &quot;port assignment&quot;,
        &quot;port overloading&quot;,
        &quot;hairpinning&quot;,
        and &quot;external source IP address and port&quot;
        as defined in <xref target="RFC4787"/>.
      </t>
    </section>

    <section anchor="appl" title="Applicability statement">
      <t> This document applies to NAT devices
        that want to handle DCCP datagrams.
        It is not the intent of this document
        to deprecate the overwhelming majority of deployed NAT devices.
        These NATs are simply not expected to handle DCCP,
        so this memo is not applicable to them.
      </t>
      <t> Expected NAT behaviors applicable to DCCP connections
        are very similar to those applicable to TCP connections
        (with the exception of REQ-6 below).
        The following requirements are discussed and justified
        extensively in <xref target="RFC5382"/>.
        These justifications are not reproduced here
        for the sake of brevity.
      </t>
      <t> In addition to the usual changes to the IP header
        (in particular the IP addresses),
        NAT devices need to mangle:
        <list style="symbols">
          <t>the DCCP source port, for outgoing packets,
            depending on the NAT mapping</t>
          <t>the DCCP destination port, for incoming packets,
            depending on the NAT mapping</t>
          <t>the DCCP checksum, to compensate for IP address and port number
            modifications.
          </t>
        </list>
      </t>
      <t> Because changing the source or destination IP address
        of a DCCP packet will normally invalidate the DCCP checksum,
        it is not possible to use DCCP through a NAT
        without dedicated support.
        Some NAT devices are known to provide a
        &quot;generic&quot; transport protocol support,
        whereby only the IP header is mangled.
        That scheme is not sufficient to support DCCP.
      </t>
    </section>

    <section title="DCCP Connection Initiation">
      <section title="Address and Port Mapping Behavior">
        <t> A NAT uses a mapping to translate packets
          for each DCCP connection.
          A mapping is dynamically allocated for connections initiated
          from the internal side,
          and potentially reused for certain subsequent connections.
          NAT behavior regarding when a mapping can be reused
          differs for different NATs as described in <xref target="RFC4787"/>.
        </t>
        <t>REQ-1:  A NAT MUST have an "Endpoint-Independent Mapping" behavior
          for DCCP.
        </t>
      </section>
      <section title="Established Connections">
        <t>REQ-2:  A NAT MUST support all valid sequences of DCCP packets
          (defined in <xref target="RFC4340"/> and its updates)
          for connections initiated both internally as well as externally
          when the connection is permitted by the NAT.
          In particular, in addition to handling the DCCP 3-way handshake
          mode of connection initiation, A NAT MUST handle the DCCP
          simultaneous-open mode of connection initiation, defined in
          <xref target="I-D.ietf-dccp-simul-open"/>.
          That mode updates DCCP by adding a new packet type, DCCP-Listen.
          The DCCP-Listen packet communicates the information necessary to
          uniquely identify a DCCP session.
          NATs may utilise the connection information (address, port, Service
          Code) to establish local forwarding state.
        </t>
      </section>
      <section title="Externally Initiated Connections">
        <t>REQ-3:  If application transparency is most important,
          it is RECOMMENDED that a NAT have
          an &quot;Endpoint-independent filtering&quot; behavior for DCCP.
          If a more stringent filtering behavior is most important,
          it is RECOMMENDED that a NAT have
          an &quot;Address-dependent filtering&quot; behavior for DCCP.
          <list style="symbols">
            <t>The filtering behavior MAY be an option configurable
              by the administrator of the NAT.
            </t>
            <t>The filtering behavior for DCCP MAY be independent
              of the filtering behavior for any other transport-layer
              protocol, such as UDP, UDP-Lite, TCP, SCTP.
            </t>
          </list>
        </t>
        <t>REQ-4:  A NAT MUST wait for at least 6 seconds
          from the reception of an unsolicited inbound DCCP-Listen or
          DCCP-Sync packet
          before it may respond with an ICMP Port Unreachable error,
          an ICMP Protocol Unreachable error or a DCCP-Reset.
          If during this interval the NAT receives and translates
          an outbound DCCP-Request packet for the connection
          the NAT MUST silently drop the original unsolicited
          inbound DCCP-Listen packet.
          Otherwise the NAT SHOULD send an ICMP Port Unreachable error
          (Type 3, Code 3) for the original DCCP-Listen,
          unless the security policy forbids it.
        </t>
      </section>
    </section>
    <section title="NAT Session Refresh">
      <t> The &quot;established connection idle-timeout&quot;
        for a NAT is defined as the minimum time a DCCP connection
        in the established phase must remain idle before the NAT considers
        the associated session a candidate for removal.
        The &quot;transitory connection idle-timeout&quot; for a NAT
        is defined as the minimum time a DCCP connection
        in the CLOSEREQ or CLOSING phases must remain idle
        before the NAT considers the associated session a candidate
        for removal.
        DCCP connections in the TIMEWAIT state are not affected by
        the &quot;transitory connection idle-timeout&quot;.
      </t>
      <t>REQ-5: If a NAT cannot determine
        whether the endpoints of a DCCP connection are active,
        it MAY abandon the session if it has been idle for some time.
        Where a NAT implements session timeouts,
        the default value
        of the &quot;established connection idle-timeout&quot;
        MUST be of 124 minutes or longer
        and the default value
        of the &quot;transitory connection idle-timeout&quot;
        MUST be of 4 minutes or longer.
        A NAT that implements session timeouts may be configurable
        to use smaller values for the NAT idle-timeouts.
      </t>
      <t> NAT behavior for handling DCCP-Reset packets,
        or connections in TIMEWAIT state is left unspecified.
      </t>
    </section>
    <section title="Application Level Gateways">
      <t> Contrary to TCP, DCCP is a loss-tolerant protocol.
        Therefore, modifying the payload of DCCP packets may present
        a significant additional challenge in maintaining sane
        any application-layer state needed for an ALG to function.
        Additionally, there are no known DCCP-capable
        Application Level Gateways (ALGs)
        at the time of writing this document.
      </t>
      <t> REQ-6:  If a NAT includes ALGs, these ALGs MUST NOT affect DCCP.
      </t>
      <t> NOTE: This is not consistent with REQ-6 of <xref target="RFC5382"/>.
      </t>
    </section>
    <section title="Other Requirements Applicable to DCCP">
      <t> A list of general and UDP specific NAT behavioral requirements
        are described in <xref target="RFC4787"/>.
        A list of ICMP specific NAT behavioral requirements are described
        in <xref target="I-D.ietf-behave-nat-icmp"/>.
        The requirements listed below reiterate the requirements
        from these two documents that directly affect DCCP.
        The following requirements do not relax any requirements
        in <xref target="RFC4787"/>
        or <xref target="I-D.ietf-behave-nat-icmp"/>.
      </t>
      <section title="Port Assignment">
        <t> REQ-7:  A NAT MUST NOT have a &quot;Port assignment&quot;
          behavior of &quot;Port overloading&quot; for DCCP.
        </t>
      </section>
      <section title="Hairpinning Behavior">
        <t> REQ-8:  A NAT MUST support &quot;Hairpinning&quot; for DCCP.
          Furthermore, A NAT's Hairpinning behavior MUST be of type
          &quot;External source IP address and port&quot;.
        </t>
      </section>
      <section title="ICMP Responses to DCCP Packets">
        <t> REQ-9:  If a NAT translates DCCP,
          it SHOULD translate ICMP Destination Unreachable (Type 3) messages.
        </t>
        <t> REQ-10:  Receipt of any sort of ICMP message MUST NOT terminate
          the NAT mapping or DCCP connection
          for which the ICMP was generated.
        </t>
      </section>
    </section>

    <section title="Requirements specific to DCCP">
      <section title="Partial checksum coverage">
        <t> DCCP supports partial checksum coverage.
          A NAT will usually need to perform incremental changes
          to the packet checksum field, as for other IETF-defined protocols.
          However, if it needs to recalculate a correct checksum value,
          it must take the checksum coverage into account,
          as described in section 9.2 of <xref target="RFC4340"/>.
        </t>
        <t> REQ-11:  If a NAT translates a DCCP packet
          with a valid DCCP checksum,
          it MUST ensure that the DCCP checksum is translated such that it
          is valid after the translation.
        </t>
        <t> REQ-12:  A NAT MUST NOT modify the value of the DCCP Checksum
          Coverage.
        </t>
        <t> The Checksum Coverage field in the DCCP header determines the
          parts of the packet that are covered by the Checksum field.
          This always includes the DCCP header and options,
          but some or all of the application data may be excluded
          as determined on a packet-by-packet basis by the application.
          Changing the Checksum Coverage in the network violates
          the integrity assumptions at the receiver
          and may result in unpredictable or incorrect application behaviour.
        </t>
      </section>
      <section title="Services codes">
        <t> DCCP specifies a Service Code as a 4-byte value (32 bits)
          that describes the application-level service
          to which a client application wishes to connect
          <xref target="RFC4340"/>.
        </t>
        <t> REQ-13:  If a NAT translates a DCCP packet,
          it MUST NOT modify its DCCP service code value.
        </t>
        <t> Further guidance on the use of Service Codes by middleboxes,
          including NATs,
          can be found in <xref target="I-D.ietf-dccp-serv-codes"/>.
        </t>
      </section>
    </section>

    <section title="DCCP without NAT support">
      <t> If the NAT device cannot be updated to support DCCP,
        DCCP datagrams can be encapsulated
        within an UDP transport header.
        Indeed, most NAT devices are already capable of handling UDP.
        This is however beyond the scope of this document.
      </t>
      <!--t> There are significant disadvantages to this approach:
        <list style="symbols">
          <t> Both sides of the DCCP session must be updated
            to use tunnelling,
            even though only one side might be hindered with a NAT.
          </t>
          <t> A method must be defined to negociate when to use tunnelling.
          </t>
          <t> The per-packet overhead is increased.
          </t>
        </list>
      </t>
      <t> A DCCP transport-specific solution is specified
        by <xref target="I-D.phelan-dccp-natencap"/>.
        Alternatively, existing IP tunneling protocols,
        such as ESP-in-UDP<xref target="RFC3948"/>
        (especially with the NULL cipher suite)
        or Teredo<xref target="RFC4380"/>,
        could be used.
      </t-->
    </section>

    <!--section anchor="simopen" title="DCCP simultaneous open">
      <t> When both parties to an intended DCCP session are located behind
        either a NAT device or a stateful firewall, neither can act as the
        passive endpoint in the connection establishment.
      </t>
      <t> Unfortunately, at the time of writing, the DCCP connection state
        machine does not allow both peers to behave as active endpoint,
        as is the case in TCP simultaneous open.
        It is expected that this issue will be tackled in the DCCP working
        group shortly (TODO: reference relevant I-D).
      </t>
    </section-->

    <section anchor="security" title="Security Considerations">
      <t> <xref target="RFC4787"/> discusses security considerations for NATs
        that handle IP and unicast (UDP) traffic,
        all of which apply equally to this document.
        Security concerns specific to handling DCCP packets are discussed
        in this section.
      </t>
      <t> REQ-1, and REQ-6 through REQ-13 do not introduce any new known
        security concerns.
      </t>
      <t> REQ-2 does not introduce any new known security concerns.
        While a NAT may elect to keep track of some DCCP-specific
        per-flow state (compared to UDP),
        it has no obligations to do so.
      </t>
      <t> REQ-3 allows a NAT to adopt either a more secure,
        or a more application-transparent filtering policy.
        This is already addressed in <xref target="RFC4787"/>
        and <xref target="RFC5382"/>.
      </t>
      <t> Similar to <xref target="RFC5382"/>,
        REQ-4 of this document recommends a NAT to respond
        to unsolicited inbound Listen and Sync packets
        with an ICMP error delayed by a few seconds.
        Doing so may reveal the presence of a NAT to an external attacker.
        Silently dropping the Listen makes it harder to diagnose network
        problems and forces applications to wait for the DCCP stack
        to finish several retransmissions before reporting an error.
        An implementer must therefore understand and carefully weigh
        the effects of not sending an ICMP error or rate-limiting
        such ICMP errors to a very small number.
      </t>
      <t> REQ-5 recommends that a NAT that passively monitors DCCP state
        keep idle sessions alive for at least 124 minutes
        or 4 minutes depending on the state of the connection.
        To protect against denial-of-service attack
        filling its state storage capacity,
        a NAT may attempt to actively determine the liveliness
        of a DCCP connection,
        or the NAT administrator could configure more conservative timeouts.
      </t>
    </section>

    <section anchor="iana" title="IANA Considerations">
      <t> This document raises no IANA considerations.
      </t>
    </section>

    <section anchor="ack" title="Acknowledgments">
      <t> The author would like to thank Gorry Fairhurst,
        Eddie Kohler, Dan Wing, Alfred H&ouml;nes, Magnus Westerlund,
        Miguel Garcia, Catherine Meadows, Tim Polk, Lars Eggert
        and Christian Vogt
        for their comments and help on this document.
      </t>
      <t> This memo borrows heavily from draft-ietf-behave-tcp-07, by
        S. Guha (editor), K. Biswas, B. Ford, S. Sivakumar and P. Srisuresh.
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119" ?>
      <?rfc include="reference.RFC.4340" ?>
      <?rfc include="reference.RFC.4787" ?>
      <?rfc include="reference.I-D.draft-ietf-dccp-simul-open-05" ?>
      <?rfc include="reference.I-D.draft-ietf-behave-nat-icmp-11" ?>
    </references>
    <references title="Informative References">
      <?rfc include="reference.RFC.3424" ?>
      <?rfc include="reference.RFC.5382" ?>
      <?rfc include="reference.I-D.draft-ietf-dccp-serv-codes-08" ?>
      <!--rfc include="reference.I-D.draft-phelan-dccp-natencap-00" -->
      <!--rfc include="reference.RFC.3948" -->
      <!--rfc include="reference.RFC.4380" -->
    </references>
  </back>
</rfc>
