RFC 7983 PROPOSED STANDARD MULTIPLEXING · REAL-TIME MEDIA · DTLS-SRTP

SRTP-DTLS Multiplexing: Multiplexing Scheme Updates for Secure Real-time Transport Protocol (SRTP) Extension for Datagram Transport Layer Security (DTLS)

How one UDP port can carry STUN, ZRTP, DTLS, TURN channels and RTP by looking at the first byte.

On rfc-editor.org ↗
PUBLISHED
September 2016
AUTHORS
M. Petit-Huguenin, G. Salgueiro
STREAM
IETF
BUILDS ON
RFC 5764 — DTLS-SRTP
UPDATED BY
RFC 9443 — QUIC multiplexing
STUN FIRST BYTE RANGE
0 to 3
ZRTP FIRST BYTE RANGE
16 to 19
DTLS FIRST BYTE RANGE
20 to 63
TURN CHANNEL FIRST BYTE RANGE
64 to 79
RTP FIRST BYTE RANGE
128 to 191
TURN CHANNEL OVERHEAD
4-byte prefix, against 36 bytes of STUN overhead
DOI
10.17487/RFC7983

RFC text

Contents
Original text · RFC Editor View on rfc-editor.org ↗
Internet Engineering Task Force (IETF)                 M. Petit-Huguenin
Request for Comments: 7983                            Impedance Mismatch
Updates: 5764                                               G. Salgueiro
Category: Standards Track                                  Cisco Systems
ISSN: 2070-1721                                           September 2016


                      Multiplexing Scheme Updates
        for Secure Real-time Transport Protocol (SRTP) Extension
              for Datagram Transport Layer Security (DTLS)

Abstract

   This document defines how Datagram Transport Layer Security (DTLS),
   Real-time Transport Protocol (RTP), RTP Control Protocol (RTCP),
   Session Traversal Utilities for NAT (STUN), Traversal Using Relays
   around NAT (TURN), and ZRTP packets are multiplexed on a single
   receiving socket.  It overrides the guidance from RFC 5764 ("SRTP
   Extension for DTLS"), which suffered from four issues described and
   fixed in this document.

   This document updates RFC 5764.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in Section 2 of RFC 7841.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   http://www.rfc-editor.org/info/rfc7983.

Copyright Notice

   Copyright (c) 2016 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

   This document may contain material from IETF Documents or IETF
   Contributions published or made publicly available before November
   10, 2008.  The person(s) controlling the copyright in some of this
   material may not have granted the IETF Trust the right to allow
   modifications of such material outside the IETF Standards Process.
   Without obtaining an adequate license from the person(s) controlling
   the copyright in such materials, this document may not be modified
   outside the IETF Standards Process, and derivative works of it may
   not be created outside the IETF Standards Process, except to format
   it for publication as an RFC or to translate it into languages other
   than English.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   3
   2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   4
   3.  Implicit Allocation of Codepoints for New STUN Methods  . . .   4
   4.  Multiplexing of ZRTP  . . . . . . . . . . . . . . . . . . . .   5
   5.  Implicit Allocation of New Codepoints for TLS ContentTypes  .   5
   6.  Multiplexing of TURN Channels . . . . . . . . . . . . . . . .   7
   7.  Updates to RFC 5764 . . . . . . . . . . . . . . . . . . . . .   8
   8.  Security Considerations . . . . . . . . . . . . . . . . . . .   9
   9.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  10
     9.1.  STUN Methods  . . . . . . . . . . . . . . . . . . . . . .  10
     9.2.  TLS ContentType . . . . . . . . . . . . . . . . . . . . .  10
     9.3.  Traversal Using Relays around NAT (TURN) Channel Numbers   11
   10. References  . . . . . . . . . . . . . . . . . . . . . . . . .  11
     10.1.  Normative References . . . . . . . . . . . . . . . . . .  11
     10.2.  Informative References . . . . . . . . . . . . . . . . .  12
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  13
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  13

1.  Introduction

   Section 5.1.2 of "Datagram Transport Layer Security (DTLS) Extension
   to Establish Keys for the Secure Real-time Transport Protocol (SRTP)"
   [RFC5764] defines a scheme for a Real-time Transport Protocol (RTP)
   [RFC3550] receiver to demultiplex DTLS [RFC6347], Session Traversal
   Utilities for NAT (STUN) [RFC5389], and Secure Real-time Transport
   Protocol (SRTP) / Secure Real-time Transport Control Protocol (SRTCP)
   [RFC3711] packets that are arriving on the RTP port.  Unfortunately,
   this demultiplexing scheme has created problematic issues:

   1.  It implicitly allocated codepoints for new STUN methods without
       an IANA registry reflecting these new allocations.

   2.  It did not take into account the fact that ZRTP [RFC6189] also
       needs to be demultiplexed with the other packet types explicitly
       mentioned in Section 5.1.2 of RFC 5764.

   3.  It implicitly allocated codepoints for new Transport Layer
       Security (TLS) ContentTypes without an IANA registry reflecting
       these new allocations.

   4.  It did not take into account the fact that the Traversal Using
       Relays around NAT (TURN) usage of STUN can create TURN channels
       that also need to be demultiplexed with the other packet types
       explicitly mentioned in Section 5.1.2 of RFC 5764.

   Having overlapping ranges between different IANA registries becomes
   an issue when a new codepoint is allocated in one of these registries
   without carefully analyzing the impact it could have on the other
   registries when that codepoint is demultiplexed.  Among other
   downsides of the bad design of the demultiplexing algorithm detailed
   in [RFC5764], it creates a requirement for coordination between
   codepoint assignments where none should exist, and that is
   organizationally and socially undesirable.  However, RFC 5764 has
   been widely deployed, so there must be an awareness of this issue and
   how it must be dealt with.  Thus, even if the feature related to a
   codepoint is not initially thought to be useful in the context of
   demultiplexing, the respective IANA registry expert should at least
   raise a flag when the allocated codepoint irrevocably prevents
   multiplexing.

   The first goal of this document is to make sure that future
   allocations in any of the affected protocols are done with the full
   knowledge of their impact on multiplexing.  This is achieved by
   updating [RFC5764], which includes modifying the IANA registries with
   instructions for coordination between the protocols at risk.

   A second goal is to permit the addition of new protocols to the list
   of existing multiplexed protocols in a manner that does not break
   existing implementations.

   At the time of this writing, the flaws in the demultiplexing scheme
   were unavoidably inherited by other documents, such as [RFC7345] and
   [SDP-BUNDLE].  So in addition, these and any other affected documents
   will need to be corrected with the updates this document provides.

2.  Terminology

   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 [RFC2119].

3.  Implicit Allocation of Codepoints for New STUN Methods

   The demultiplexing scheme in [RFC5764] states that the receiver can
   identify the packet type by looking at the first byte.  If the value
   of this first byte is 0 or 1, the packet is identified to be STUN.
   The problem with this implicit allocation is that it restricts the
   codepoints for STUN methods (as described in Section 18.1 of
   [RFC5389]) to values between 0x000 and 0x07F, which in turn reduces
   the number of possible STUN method codepoints assigned by IETF Review
   (i.e., the range 0x000 - 0x7FF) from 2048 to only 128 and eliminates
   the possibility of having STUN method codepoints assigned by
   Designated Expert (i.e., the range 0x800 - 0xFFF).

   To preserve the Designated Expert range, this document allocates the
   values 2 and 3 to also identify STUN methods.

   The IANA Registry for STUN methods has been modified to mark the
   codepoints from 0x100 to 0xFFF as Reserved.  These codepoints can
   still be allocated, but require IETF Review with a document that will
   properly evaluate the risk of an assignment overlapping with other
   registries.

   In addition, this document also updates the IANA registry such that
   the STUN method codepoints assigned in the 0x080-0x0FF range are also
   assigned via Designated Expert.  The "STUN Methods" registry has been
   changed as follows:

   OLD:

   0x000-0x7FF     IETF Review
   0x800-0xFFF     Designated Expert

   NEW:

   0x000-0x07F     IETF Review
   0x080-0x0FF     Designated Expert
   0x100-0xFFF     Reserved

4.  Multiplexing of ZRTP

   ZRTP [RFC6189] is a protocol for media path Diffie-Hellman exchange
   to agree on a session key and parameters for establishing unicast
   SRTP sessions for Voice over IP (VoIP) applications.  The ZRTP
   protocol is media path keying because it is multiplexed on the same
   port as RTP and does not require support in the signaling protocol.

   In order to prevent future documents from assigning values from the
   unused range to a new protocol, this document modifies the [RFC5764]
   demultiplexing algorithm to properly account for ZRTP [RFC6189] by
   allocating the values from 16 to 19 for this purpose.

5.  Implicit Allocation of New Codepoints for TLS ContentTypes

   The demultiplexing scheme in [RFC5764] dictates that if the value of
   the first byte is between 20 and 63 (inclusive), then the packet is
   identified to be DTLS.  For DTLS 1.0 [RFC4347] and DTLS 1.2
   [RFC6347], that first byte corresponds to the TLS ContentType field.
   Considerations must be taken into account when assigning additional
   ContentTypes in the codepoint ranges 0 to 19 and 64 to 255, so this
   does not prevent demultiplexing when this functionality is desirable.
   Note that [RFC5764] describes a narrow use of DTLS that works as long
   as the specific DTLS version used abides by the restrictions on the
   demultiplexing byte (the ones that this document imposes on the "TLS
   ContentType Registry").  Any extension or revision to DTLS that
   causes it to no longer meet these constraints should consider what
   values may occur in the first byte of the DTLS message and what
   impact it would have on the multiplexing that [RFC5764] describes.

   With respect to TLS packet identification, this document explicitly
   adds a warning to the codepoints from 0 to 19 and from 64 to 255
   indicating that allocations in these ranges require coordination, as
   described in this document.  The "TLS ContentType Registry" has been
   changed as follows:

   OLD:

   0-19    Unassigned
   20      change_cipher_spec
   21      alert
   22      handshake
   23      application_data
   24      heartbeat
   25-255  Unassigned

   NEW:

   0-19    Unassigned (Requires coordination; see RFC 7983)
   20      change_cipher_spec
   21      alert
   22      handshake
   23      application_data
   24      heartbeat
   25-63   Unassigned
   64-255  Unassigned (Requires coordination; see RFC 7983)

6.  Multiplexing of TURN Channels

   When used with Interactive Connectivity Establishment (ICE)
   [RFC5245], an implementation of RFC 5764 can receive packets on the
   same socket from three different paths, as shown in Figure 1:

   1.  Directly from the source

   2.  Through a NAT

   3.  Relayed by a TURN server

       +------+
       | TURN |<------------------------+
       +------+                         |
          |                             |
          | +-------------------------+ |
          | |                         | |
          v v                         | |
   NAT -----------                    | |
          | | +---------------------+ | |
          | | |                     | | |
          v v v                     | | |
      +----------+              +----------+
      | RFC 5764 |              | RFC 5764 |
      +----------+              +----------+

        Figure 1: Packet Reception by an Implementation of RFC 5764

   Even if the ICE algorithm succeeded in selecting a non-relayed path,
   it is still possible to receive data from the TURN server.  For
   instance, when ICE is used with aggressive nomination, the media path
   can quickly change until it stabilizes.  Also, freeing ICE candidates
   is optional, so the TURN server can restart forwarding STUN
   connectivity checks during an ICE restart.

   TURN channels are an optimization where data packets are exchanged
   with a 4-byte prefix instead of the standard 36-byte STUN overhead
   (see Section 2.5 of [RFC5766]).  The problem is that the RFC 5764
   demultiplexing scheme does not define what to do with packets
   received over a TURN channel since these packets will start with a
   first byte whose value will be between 64 and 127 (inclusive).  If
   the TURN server was instructed to send data over a TURN channel, then
   the demultiplexing scheme specified in RFC 5764 will reject these
   packets.  Current implementations violate RFC 5764 for values 64 to
   127 (inclusive) and they instead parse packets with such values as
   TURN.

   In order to prevent future documents from assigning values from the
   unused range to a new protocol, this document modifies the
   demultiplexing algorithm in RFC 5764 to properly account for TURN
   channels by allocating the values from 64 to 79 for this purpose.
   This modification restricts the TURN channel space to a more limited
   set of possible channels when the TURN client does the channel
   binding request in combination with the demultiplexing scheme
   described in [RFC5764].

7.  Updates to RFC 5764

   This document updates the text in Section 5.1.2 of [RFC5764] as
   follows:

   OLD TEXT

   The process for demultiplexing a packet is as follows.  The receiver
   looks at the first byte of the packet.  If the value of this byte is
   0 or 1, then the packet is STUN.  If the value is in between 128 and
   191 (inclusive), then the packet is RTP (or RTCP, if both RTCP and
   RTP are being multiplexed over the same destination port).  If the
   value is between 20 and 63 (inclusive), the packet is DTLS.  This
   process is summarized in Figure 3.

                    +----------------+
                    | 127 < B < 192 -+--> forward to RTP
                    |                |
        packet -->  |  19 < B < 64  -+--> forward to DTLS
                    |                |
                    |       B < 2   -+--> forward to STUN
                    +----------------+

     Figure 3: The DTLS-SRTP receiver's packet demultiplexing algorithm.
          Here the field B denotes the leading byte of the packet.

   END OLD TEXT
   NEW TEXT

   The process for demultiplexing a packet is as follows.  The receiver
   looks at the first byte of the packet.  If the value of this byte is
   in between 0 and 3 (inclusive), then the packet is STUN.  If the
   value is between 16 and 19 (inclusive), then the packet is ZRTP.  If
   the value is between 20 and 63 (inclusive), then the packet is DTLS.
   If the value is between 64 and 79 (inclusive), then the packet is
   TURN Channel.  If the value is in between 128 and 191 (inclusive),
   then the packet is RTP (or RTCP, if both RTCP and RTP are being
   multiplexed over the same destination port).  If the value does not
   match any known range, then the packet MUST be dropped and an alert
   MAY be logged.  This process is summarized in Figure 3.

                    +----------------+
                    |        [0..3] -+--> forward to STUN
                    |                |
                    |      [16..19] -+--> forward to ZRTP
                    |                |
        packet -->  |      [20..63] -+--> forward to DTLS
                    |                |
                    |      [64..79] -+--> forward to TURN Channel
                    |                |
                    |    [128..191] -+--> forward to RTP/RTCP
                    +----------------+

     Figure 3: The DTLS-SRTP receiver's packet demultiplexing algorithm.

   END NEW TEXT

8.  Security Considerations

   This document updates existing IANA registries and adds a new range
   for TURN channels in the demultiplexing algorithm.

   These modifications do not introduce any specific security
   considerations beyond those detailed in [RFC5764].

9.  IANA Considerations

9.1.  STUN Methods

   This specification contains the registration information for reserved
   STUN Methods codepoints, as explained in Section 3 and in accordance
   with the procedures defined in Section 18.1 of [RFC5389].

   Value:   0x100-0xFFF

   Name:   Reserved (For DTLS-SRTP multiplexing collision avoidance, see
      RFC 7983.  Cannot be made available for assignment without IETF
      Review.)

   Reference:   RFC 5764, RFC 7983

   This specification also reassigns the ranges in the STUN Methods
   Registry as follows:

   Range:   0x000-0x07F

   Registration Procedures:   IETF Review

   Range:   0x080-0x0FF

   Registration Procedures:   Designated Expert

9.2.  TLS ContentType

   This specification contains the registration information for reserved
   TLS ContentType codepoints, as explained in Section 5 and in
   accordance with the procedures defined in Section 12 of [RFC5246].

   Value:   0-19

   Description:   Unassigned (Requires coordination; see RFC 7983)

   DTLS-OK:   N/A

   Reference:   RFC 5764, RFC 7983

   Value:   64-255

   Description:   Unassigned (Requires coordination; see RFC 7983)

   DTLS-OK:   N/A

   Reference:   RFC 5764, RFC 7983

9.3.  Traversal Using Relays around NAT (TURN) Channel Numbers

   This specification contains the registration information for reserved
   codepoints in the "Traversal Using Relays around NAT (TURN) Channel
   Numbers" registry, as explained in Section 6 and in accordance with
   the procedures defined in Section 18 of [RFC5766].

   Value:   0x5000-0xFFFF

   Name:   Reserved (For DTLS-SRTP multiplexing collision avoidance, see
      RFC 7983.)

   Reference:   RFC 7983

10.  References

10.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

   [RFC3550]  Schulzrinne, H., Casner, S., Frederick, R., and V.
              Jacobson, "RTP: A Transport Protocol for Real-Time
              Applications", STD 64, RFC 3550, DOI 10.17487/RFC3550,
              July 2003, <http://www.rfc-editor.org/info/rfc3550>.

   [RFC3711]  Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K.
              Norrman, "The Secure Real-time Transport Protocol (SRTP)",
              RFC 3711, DOI 10.17487/RFC3711, March 2004,
              <http://www.rfc-editor.org/info/rfc3711>.

   [RFC5245]  Rosenberg, J., "Interactive Connectivity Establishment
              (ICE): A Protocol for Network Address Translator (NAT)
              Traversal for Offer/Answer Protocols", RFC 5245,
              DOI 10.17487/RFC5245, April 2010,
              <http://www.rfc-editor.org/info/rfc5245>.

   [RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
              (TLS) Protocol Version 1.2", RFC 5246,
              DOI 10.17487/RFC5246, August 2008,
              <http://www.rfc-editor.org/info/rfc5246>.

   [RFC5389]  Rosenberg, J., Mahy, R., Matthews, P., and D. Wing,
              "Session Traversal Utilities for NAT (STUN)", RFC 5389,
              DOI 10.17487/RFC5389, October 2008,
              <http://www.rfc-editor.org/info/rfc5389>.

   [RFC5764]  McGrew, D. and E. Rescorla, "Datagram Transport Layer
              Security (DTLS) Extension to Establish Keys for the Secure
              Real-time Transport Protocol (SRTP)", RFC 5764,
              DOI 10.17487/RFC5764, May 2010,
              <http://www.rfc-editor.org/info/rfc5764>.

   [RFC5766]  Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using
              Relays around NAT (TURN): Relay Extensions to Session
              Traversal Utilities for NAT (STUN)", RFC 5766,
              DOI 10.17487/RFC5766, April 2010,
              <http://www.rfc-editor.org/info/rfc5766>.

   [RFC6347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
              Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347,
              January 2012, <http://www.rfc-editor.org/info/rfc6347>.

10.2.  Informative References

   [RFC4347]  Rescorla, E. and N. Modadugu, "Datagram Transport Layer
              Security", RFC 4347, DOI 10.17487/RFC4347, April 2006,
              <http://www.rfc-editor.org/info/rfc4347>.

   [RFC6189]  Zimmermann, P., Johnston, A., Ed., and J. Callas, "ZRTP:
              Media Path Key Agreement for Unicast Secure RTP",
              RFC 6189, DOI 10.17487/RFC6189, April 2011,
              <http://www.rfc-editor.org/info/rfc6189>.

   [RFC7345]  Holmberg, C., Sedlacek, I., and G. Salgueiro, "UDP
              Transport Layer (UDPTL) over Datagram Transport Layer
              Security (DTLS)", RFC 7345, DOI 10.17487/RFC7345, August
              2014, <http://www.rfc-editor.org/info/rfc7345>.

   [SDP-BUNDLE]
              Holmberg, C., Alvestrand, H., and C. Jennings,
              "Negotiating Media Multiplexing Using the Session
              Description Protocol (SDP)", Work in Progress,
              draft-ietf-mmusic-sdp-bundle-negotiation-32, August 2016.

Acknowledgements

   The implicit STUN Method codepoint allocations problem was first
   reported by Martin Thomson in the RTCWEB mailing list and discussed
   further with Magnus Westerlund.

   Thanks to Simon Perreault, Colton Shields, Cullen Jennings, Colin
   Perkins, Magnus Westerlund, Paul Jones, Jonathan Lennox, Varun Singh,
   Justin Uberti, Joseph Salowey, Martin Thomson, Ben Campbell, Stephen
   Farrell, Alan Johnston, Mehmet Ersue, Matt Miller, Spencer Dawkins,
   Joel Halpern, and Paul Kyzivat for the comments, suggestions, and
   questions that helped improve this document.

Authors' Addresses

   Marc Petit-Huguenin
   Impedance Mismatch

   Email: marc@petit-huguenin.org


   Gonzalo Salgueiro
   Cisco Systems
   7200-12 Kit Creek Road
   Research Triangle Park, NC  27709
   United States of America

   Email: gsalguei@cisco.com

ISO Plain Language

On this page
PROBLEMRFC 5764 lets a media receiver work out what an arriving packet is by looking at its first byte, so that DTLS, STUN and SRTP can share one port. The ranges it set aside collided with ranges other registries were already using, and it left no room for ZRTP or for TURN channels.
MECHANISMThis RFC reworks the demultiplexing algorithm: STUN takes the first-byte values 0 to 3, ZRTP takes 16 to 19, DTLS keeps 20 to 63, TURN channels take 64 to 79 and RTP keeps 128 to 191, with anything else dropped. It also rearranges the STUN method and TLS ContentType registries so that a future allocation cannot silently break multiplexing.
WHY IT MATTERSOne port can now carry all six kinds of packet under a scheme that still has room for more, and the IANA registries carry an explicit coordination warning. RFC 7983 is a Proposed Standard that updates RFC 5764 and was later updated by RFC 9443.

§1Why the Original Scheme Had to Be Fixed

Section 5.1.2 of RFC 5764 defines a scheme for a Real-time Transport Protocol (RTP) receiver to demultiplex DTLS, STUN and SRTP/SRTCP packets that arrive on the RTP port, so that one port can carry the encrypted media and the key exchange that sets it up. The scheme works by looking at the first byte of each packet. Unfortunately, it created four problems.

First, it implicitly allocated codepoints for new STUN methods without an IANA registry reflecting those allocations. Second, it did not take into account the fact that ZRTP also needs to be demultiplexed with the other packet types explicitly mentioned in Section 5.1.2 of RFC 5764. Third, it implicitly allocated codepoints for new TLS ContentTypes without an IANA registry reflecting these allocations. Fourth, it did not take into account the fact that TURN's use of STUN can create TURN channels that also need to be demultiplexed.

Overlapping ranges between different IANA registries become an issue when a new codepoint is allocated in one of these registries without carefully analysing the impact it could have on the other registries when that codepoint is demultiplexed. Among other downsides of the bad design of the demultiplexing algorithm, it creates a requirement for coordination between codepoint assignments where none should exist, and the RFC calls that organizationally and socially undesirable. Because RFC 5764 has been widely deployed, there has to be awareness of this issue and of how it must be dealt with. So even if the feature related to a codepoint is not initially thought to be useful in the context of demultiplexing, the relevant IANA registry expert should at least raise a flag when the allocated codepoint irrevocably prevents multiplexing.

The RFC states two goals. The first is to make sure that future allocations in any of the affected protocols are done with the full knowledge of their impact on multiplexing, achieved by updating RFC 5764 and modifying the IANA registries with instructions for coordination between the protocols at risk. The second is to permit the addition of new protocols to the list of multiplexed protocols in a manner that does not break existing implementations. At the time of writing, the flaws in the demultiplexing scheme had been unavoidably inherited by other documents, such as RFC 7345 and SDP-BUNDLE, so those and any other affected documents need to be corrected with the updates this document provides.

The original rules took values out of the numbering systems of other protocols without saying so, so two unrelated protocols could end up with the same number and be confused on the wire. This RFC sorts out the ranges and tells the registries to watch out for each other from now on.

§3STUN Method Codepoints

The demultiplexing scheme in RFC 5764 says the receiver can identify a STUN packet by looking at the first byte: if the value of this byte is 0 or 1, the packet is STUN. The problem with this implicit allocation is that it restricts the codepoints for STUN methods to values between 0x000 and 0x07F. That in turn reduces the number of possible STUN method codepoints assigned by IETF Review, the range 0x000 to 0x7FF, from 2048 to only 128, and eliminates the possibility of having STUN method codepoints assigned by Designated Expert, the range 0x800 to 0xFFF.

To preserve the Designated Expert range, the RFC allocates the values 2 and 3 to also identify STUN methods. The IANA registry for STUN methods is modified to mark the codepoints from 0x100 to 0xFFF as Reserved. Those codepoints can still be allocated, but they require IETF Review with a document that will properly evaluate the risk of an assignment overlapping with other registries.

The registry itself is rearranged from two ranges into three. It used to be 0x000-0x7FF by IETF Review and 0x800-0xFFF by Designated Expert. It becomes 0x000-0x07F by IETF Review, 0x080-0x0FF by Designated Expert, and 0x100-0xFFF Reserved.

STUN messages were quietly borrowing the first two numbers of the method numbering space, which left only a fraction of it for real methods. The RFC gives STUN four numbers of its own and reserves the rest for the multiplexing scheme.

THE STUN METHODS REGISTRY, BEFORE AND AFTER RFC 7983
RangeOld policyNew policy
0x000-0x07FIETF ReviewIETF Review
0x080-0x0FFIETF ReviewDesignated Expert
0x100-0x7FFIETF ReviewReserved
0x800-0xFFFDesignated ExpertReserved

§4Adding ZRTP

ZRTP is a protocol for a media path Diffie-Hellman exchange to agree on a session key and parameters for establishing unicast SRTP sessions for Voice over IP applications. ZRTP is media path keying, because it is multiplexed on the same port as RTP and does not require support in the signalling protocol.

In order to prevent future documents from assigning values from the unused range to a new protocol, the RFC modifies the RFC 5764 demultiplexing algorithm to properly account for ZRTP by allocating the values from 16 to 19 for this purpose.

ZRTP is a second way to agree on the keys for encrypted media, done on the media path itself rather than in the signalling. It needed a range of its own, and this RFC gives it four numbers.

§5TLS ContentTypes

The RFC 5764 scheme dictates that if the value of the first byte is between 20 and 63 inclusive, the packet is DTLS. For DTLS 1.0 and DTLS 1.2, that first byte corresponds to the TLS ContentType field. Considerations must be taken into account when assigning additional ContentTypes in the codepoint ranges 0 to 19 and 64 to 255, so this does not prevent demultiplexing when that functionality is desirable.

The RFC notes that RFC 5764 describes a narrow use of DTLS that works as long as the specific DTLS version used abides by the restrictions on the demultiplexing byte, the ones that this document imposes on the TLS ContentType Registry. Any extension or revision to DTLS that causes it to no longer meet these constraints should consider what values may occur in the first byte of the DTLS message and what impact it would have on the multiplexing that RFC 5764 describes.

The registry gains an explicit warning. The codepoints 0 to 19 and 64 to 255 are marked as unassigned and requiring coordination, and the middle of the old range is split out: 25 to 63 becomes plain unassigned, while what used to be 25 to 255 becomes 64 to 255 requiring coordination.

For encrypted media, the first byte of a packet is the type of the TLS record, and the values from 20 to 63 already belong to that meaning. The RFC marks the values on either side of that range as needing a conversation with the multiplexing rules before anyone uses them.

§6TURN Channels

When used with Interactive Connectivity Establishment (ICE), an implementation of RFC 5764 can receive packets on the same socket from three different paths: directly from the source, through a NAT, and relayed by a TURN server. Even if the ICE algorithm succeeded in selecting a non-relayed path, it is still possible to receive data from the TURN server. When ICE is used with aggressive nomination, the media path can quickly change until it stabilizes, and freeing ICE candidates is optional, so the TURN server can restart forwarding STUN connectivity checks during an ICE restart.

TURN channels are an optimization where data packets are exchanged with a 4-byte prefix instead of the standard 36-byte STUN overhead. The problem is that the RFC 5764 demultiplexing scheme does not define what to do with packets received over a TURN channel, because these packets start with a first byte whose value is between 64 and 127 inclusive. If the TURN server was instructed to send data over a TURN channel, the demultiplexing scheme specified in RFC 5764 will reject these packets. Current implementations violate RFC 5764 for values 64 to 127 and instead parse packets with such values as TURN.

To prevent future documents from assigning values from the unused range to a new protocol, the RFC modifies the demultiplexing algorithm to properly account for TURN channels by allocating the values from 64 to 79 for this purpose. This modification restricts the TURN channel space to a more limited set of possible channels when the TURN client does the channel binding request in combination with the demultiplexing scheme described in RFC 5764.

When traffic is relayed, the relay can wrap each packet in a short label instead of the usual heavy STUN header. Those labelled packets had no home in the old rules, so the RFC gives them a range of sixteen numbers.

§7The New Demultiplexing Algorithm

Section 7 replaces the text in Section 5.1.2 of RFC 5764. The receiver looks at the first byte of the packet. If the value of this byte is between 0 and 3 inclusive, the packet is STUN. If the value is between 16 and 19 inclusive, the packet is ZRTP. If the value is between 20 and 63 inclusive, the packet is DTLS. If the value is between 64 and 79 inclusive, the packet is a TURN Channel. If the value is between 128 and 191 inclusive, the packet is RTP, or RTCP if both RTCP and RTP are being multiplexed over the same destination port. If the value does not match any known range, the packet MUST be dropped and an alert MAY be logged.

The old text had only three ranges: 0 or 1 for STUN, 20 to 63 for DTLS, and 128 to 191 for RTP. Everything else was undefined, and the new text also says what to do with a packet that matches nothing.

The rule is now a single lookup table on the first byte of the packet, with a clear answer for every value, including an instruction to throw away anything unrecognised.

THE DEMULTIPLEXING RANGES AFTER RFC 7983
First byteProtocolNote
0 to 3STUNValues 2 and 3 added by this RFC
16 to 19ZRTPAllocated by this RFC
20 to 63DTLSUnchanged from RFC 5764
64 to 79TURN ChannelAllocated by this RFC
128 to 191 THIS RFCRTP or RTCPUnchanged from RFC 5764
Anything elseDroppedAn alert may be logged
THE NEW DEMULTIPLEXING ALGORITHM, VERBATIM FROM RFC 7983
The DTLS-SRTP receiver's packet demultiplexing algorithm
+----------------+
|        [0..3] -+--> forward to STUN
|                |
|      [16..19] -+--> forward to ZRTP
|                |
packet -->  |      [20..63] -+--> forward to DTLS
|                |
|      [64..79] -+--> forward to TURN Channel
|                |
|    [128..191] -+--> forward to RTP/RTCP
+----------------+

§8Security Considerations

The RFC is short here. The document updates existing IANA registries and adds a new range for TURN channels in the demultiplexing algorithm, and these modifications do not introduce any specific security considerations beyond those detailed in RFC 5764.

Changing which numbers mean what does not add any new risk here. The security rules of the document it updates still apply.

§9IANA Considerations

Three registries are touched. The STUN Methods registry gains a registration for the reserved codepoints 0x100 to 0xFFF, named as reserved for DTLS-SRTP multiplexing collision avoidance, which cannot be made available for assignment without IETF Review, and its ranges are reassigned as described earlier: 0x000-0x07F by IETF Review and 0x080-0x0FF by Designated Expert.

The TLS ContentType registry gains two reserved entries: the values 0 to 19 and the values 64 to 255, each described as unassigned and requiring coordination, with the DTLS-OK field recorded as N/A for both.

The TURN Channel Numbers registry gains a reservation of 0x5000 to 0xFFFF, named as reserved for DTLS-SRTP multiplexing collision avoidance.

IANA keeps three lists of numbers that this scheme depends on, and each one now carries a note saying which parts are off limits and why.

§9References

[RFC2119]RFC 2119Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.March 1997[RFC3550]RFC 3550Schulzrinne, H., Casner, S., Frederick, R., and V. Jacobson, "RTP: A Transport Protocol for Real-Time Applications", STD 64, RFC 3550, July 2003.July 2003[RFC3711]RFC 3711Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. Norrman, "The Secure Real-time Transport Protocol (SRTP)", RFC 3711, March 2004.March 2004[RFC5245]RFC 5245Rosenberg, J., "Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols", RFC 5245, April 2010.April 2010[RFC5246]RFC 5246Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, August 2008.August 2008[RFC5389]RFC 5389Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, "Session Traversal Utilities for NAT (STUN)", RFC 5389, October 2008.October 2008[RFC5764]RFC 5764McGrew, D. and E. Rescorla, "Datagram Transport Layer Security (DTLS) Extension to Establish Keys for the Secure Real-time Transport Protocol (SRTP)", RFC 5764, May 2010.May 2010[RFC5766]RFC 5766Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)", RFC 5766, April 2010.April 2010[RFC6189]RFC 6189Zimmermann, P., Johnston, A., Ed., and J. Callas, "ZRTP: Media Path Key Agreement for Unicast Secure RTP", RFC 6189, April 2011.April 2011[RFC6347]RFC 6347Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, January 2012.January 2012[RFC7345]RFC 7345Holmberg, C., Sedlacek, I., and G. Salgueiro, "UDP Transport Layer (UDPTL) over Datagram Transport Layer Security (DTLS)", RFC 7345, August 2014.August 2014