RFC 6263

Application Mechanism for Keeping Alive the NAT Mappings Associated with RTP / RTP Control Protocol (RTCP) Flows

๐Ÿ“… published June 2011, from ietf

๐Ÿ“– RFC 6263: Application Mechanism for Keeping Alive the NAT Mappings Associated with RTP / RTCP Flows ๐ŸŽ€

Okay bestie, this one is from June 2011 and it's an Internet Standards Track doc ๐Ÿ’… It was written by X. Marjou and A. Sollaud from France Telecom Orange, and it's published under ISSN 2070-1721. The header doesn't list anything it obsoletes or updates, so it stands on its own โœจ

Abstract โœจ

Okay so this doc lists all the different ways apps using RTP and RTCP can keep their RTP NAT mappings alive ๐Ÿ’– It also recommends one preferred option. And it's not for ICE agents, so if you're already doing ICE, you're covered ๐Ÿซถ

Status of This Memo ๐Ÿ“

This is an Internet Standards Track document ๐Ÿ”ฅ

It's a product of the IETF, so it represents the consensus of the IETF community. It went through public review and got approved by the IESG. If you want more info on Internet Standards, check Section 2 of RFC 5741. You can find the current status, any errata, and how to send feedback at http://www.rfc-editor.org/info/rfc6263 ๐ŸŒธ

Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved ๐Ÿ’œ

This doc is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents, which you can read at http://trustee.ietf.org/license-info, as they're in effect on the date of publication. Please actually read them, because they explain your rights and restrictions for this document ๐Ÿ™ˆ Code components pulled out of this document must include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions. They also come with no warranty, as described in the Simplified BSD License โš ๏ธ

Table of Contents ๐Ÿงš

1. Introduction ....................................................2
2. Terminology .....................................................4
3. Requirements ....................................................4
4. List of Alternatives for Performing RTP Keepalive ...............4
   4.1. Empty (0-Byte) Transport Packet ............................4
   4.2. RTP Packet with Comfort Noise Payload ......................5
   4.3. RTCP Packets Multiplexed with RTP Packets ..................5
   4.4. STUN Indication Packet .....................................6
   4.5. RTP Packet with Incorrect Version Number ...................6
   4.6. RTP Packet with Unknown Payload Type .......................6
5. Recommended Solution for Keepalive Mechanism ....................7
6. Media Format Exceptions .........................................7
7. Timing and Transport Considerations .............................7
8. RTCP Flow Keepalive .............................................8
9. Security Considerations .........................................9
10. Acknowledgements ...............................................9
11. References ....................................................10
   11.1. Normative References .....................................10
   11.2. Informative References ...................................10

1. Introduction ๐Ÿ’–

Okay so [RFC4787] and [RFC5382] describe NAT behaviors, and they point out that two big things about NAT are mappings (also called bindings) and keeping them refreshed ๐Ÿฆ‹ That creates a derived requirement for apps in a multimedia session that goes through NAT traversal: they need to generate a minimum amount of flow activity to create NAT mappings and keep them alive โœจ

When it comes to apps using the Real-time Transport Protocol (RTP) [RFC3550], the RTP media stream packets usually meet this requirement all by themselves ๐Ÿ’… But there are some cases where RTP doesn't generate that minimum flow activity, and those are the main character moments we need to fix ๐Ÿ˜ญ

Here are the examples:

  • In some RTP usages, like the Session Initiation Protocol (SIP) [RFC3261], agents can negotiate a unidirectional media stream. They do this by using the Session Description Protocol (SDP) [RFC4566] "recvonly" attribute on one agent and "sendonly" on the peer, as defined in [RFC3264]. [RFC3264] tells implementations not to transmit media on the receiving agent. So if the agent receiving the media is on the private side of a NAT, it will never get RTP packets from the public peer if the NAT mapping was never created ๐Ÿ’€
  • A bidirectional media stream can also be "put on hold" ๐Ÿซ  That happens with the SDP "sendonly" or "inactive" attributes. Again, [RFC3264] tells implementations to stop transmitting media in these cases. But doing that may cause NAT bindings to time out, and then the media won't be able to come off hold ๐Ÿ˜ฉ
  • Some RTP payload formats, like the payload format for text conversation [RFC4103], may send packets so rarely that the interval goes past the NAT binding timeouts ๐Ÿข

So to solve these problems, an agent needs to periodically send keepalive data within the outgoing RTP session of an RTP media stream ๐Ÿซถ It has to do this no matter if the media stream is inactive, sendonly, recvonly, or sendrecv, and no matter whether the bandwidth attribute is present or what its value is.

It's important to note that NAT traversal constraints also usually require agents to use Symmetric RTP / RTP Control Protocol (RTCP) [RFC4961] in addition to RTP keepalive ๐Ÿ”ฅ

This doc first states the requirements that have to be supported to do RTP keepalives (Section 3). In a second step, it covers the different mechanisms for solving this problem (Section 4). Section 5 finally states the recommended solution for RTP keepalive. Section 6 talks about some media format exceptions. Section 7 adds details about timing and transport considerations. And Section 8 explains how to maintain NAT bindings for RTCP ๐Ÿงš

This doc doesn't apply to Interactive Connectivity Establishment (ICE) [RFC5245] agents. The thing is, ICE, along with Session Traversal Utilities for NAT (STUN) [RFC5389] and Traversal Using Relays around NAT (TURN) [RFC5766], already solves the overall NAT traversal mechanism for media streams ๐Ÿ‘‘ In the context of RTP media streams, some agents might not need all the ICE functionality and may only need a keepalive mechanism. This doc applies to those agents, and it does not apply to agents that implement ICE ๐Ÿฆ‹

Also, if a given media uses a codec that already has a keepalive mechanism built in, no extra keepalive mechanism is required at the RTP level ๐ŸŒˆ

As mentioned in Section 3.5 of [RFC5405], "It is important to note that keepalive messages are NOT RECOMMENDED for general use -- they are unnecessary for many applications and can consume significant amounts of system and network resources" ๐Ÿ™ˆ

2. Terminology ๐Ÿ“š

In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in RFC 2119 [RFC2119] ๐Ÿ’œ

3. Requirements ๐Ÿ“‹

This section lays out the key requirements that need to be satisfied to provide RTP media keepalive โœจ

  • REQ-1: Some data is sent periodically within the outgoing RTP session for the whole duration of the RTP media stream.
  • REQ-2: Any type of transport (e.g., UDP, TCP) MUST be supported.
  • REQ-3: Any media type (e.g., audio, video, text) MUST be supported.
  • REQ-4: Any media format (e.g., G.711, H.263) MUST be supported.
  • REQ-5: Session signaling protocols SHOULD NOT be impacted.
  • REQ-6: Impacts on existing software SHOULD be minimized.
  • REQ-7: The remote peer SHOULD NOT be impacted.
  • REQ-8: The support for RTP keepalive SHOULD be described in the SDP.
  • REQ-9: The solution SHOULD cover the integration with RTCP.

4. List of Alternatives for Performing RTP Keepalive ๐Ÿ“

This section lists, in no particular order, some alternatives that can be used to perform a keepalive message within RTP media streams ๐Ÿ’…

4.1. Empty (0-Byte) Transport Packet ๐Ÿซง

The app sends an empty transport packet (e.g., UDP packet, Datagram Congestion Control Protocol (DCCP) packet) ๐ŸŒธ

Con:

  • This alternative is specific to each transport protocol.

4.2. RTP Packet with Comfort Noise Payload ๐ŸŽง

The app sends an RTP packet with a comfort noise payload [RFC3389] ๐ŸŒ™

Cons:

  • This alternative is limited to audio formats only.
  • Comfort noise needs to be supported by the remote peer.
  • Comfort noise needs to be signaled in SDP offer/answer.
  • The peer is likely to render comfort noise at the other side, so the content of the payload (the noise level) needs to be carefully chosen.

4.3. RTCP Packets Multiplexed with RTP Packets ๐Ÿฆ‹

The app sends RTCP packets in the RTP media path itself (i.e., the same tuples for both RTP and RTCP packets) [RFC5761] ๐Ÿซถ So RTCP packets keep the NAT mappings open, as long as the requirements for parameter selection are fulfilled, as discussed in Section 8 โœจ

Note: The "on hold" procedures of [RFC3264] do not impact RTCP transmissions.

Cons:

  • Multiplexing RTP and RTCP must be supported by the remote peer.
  • Some RTCP monitoring tools expect that RTCP packets are not multiplexed.
  • RTCP must be configured so that the Tmin value [RFC3550] is less than or equal to the Tr interval.

4.4. STUN Indication Packet ๐Ÿ”

The app sends a STUN [RFC5389] Binding Indication packet, as specified in ICE [RFC5245] ๐Ÿ’–

Thanks to the RTP validity check, STUN packets will be ignored by the RTP stack ๐Ÿ™Œ

Con:

  • The sending agent needs to support STUN.

4.5. RTP Packet with Incorrect Version Number ๐Ÿ™ƒ

The app sends an RTP packet with a version number set to zero (i.e., an incorrect version number) ๐Ÿซ 

Based on the RTP specification [RFC3550], the peer should perform a header validity check and therefore ignore these types of packets ๐Ÿ›ก๏ธ

Cons:

  • Only four version numbers are possible. Using one of them for RTP keepalive would be wasteful.
  • [RFC4566] and [RFC3264] mandate that media with inactive and recvonly attributes not be sent; however, this is mitigated, as no real media is sent with this mechanism.

4.6. RTP Packet with Unknown Payload Type ๐Ÿงš

okay bestie, this one is sneaky ๐Ÿ‘€ The app sends an RTP packet with a 0 length and a dynamic payload type that the peers never negotiated. So it's not in the SDP offer/answer and isn't mapped to any media format ๐ŸŒธ

The sequence number goes up by one for each packet, since it's sent in the same RTP session as the actual media. The timestamp holds the same value a media packet would have at that moment โฐ The marker bit doesn't matter for keepalives, so it's just set to zero ๐Ÿ™ˆ

The SSRC is the same one as the media it's keeping alive ๐Ÿ’…

Normally the peer just ignores it, because RTP [RFC3550] says "a receiver MUST ignore packets with payload types that it does not understand" ๐Ÿซถ

Cons:

  • [RFC4566] and [RFC3264] say that media with inactive and recvonly attributes must not be sent. This is kinda mitigated though, since no real media goes out with this mechanism ๐Ÿฅบ
  • [RFC3550] doesn't stop the peer from looking at received packets to figure out if it's under attack ๐Ÿ˜ฌ
  • The statement "a receiver MUST ignore packets with payload types that it does not understand" from [RFC3550] isn't always followed in real life ๐Ÿ’€
  • There's no RTCP reporting for the keepalive packets, because [RFC3550] mandates that RTP packets with payload types the receiver doesn't understand be ignored ๐Ÿ“‰
  • Some RTP payload formats don't handle gaps in the RTP sequence number well ๐Ÿ™ƒ

The RECOMMENDED mechanism is the one from "RTCP Packets Multiplexed with RTP Packets" (Section 4.3). It's the main character here ๐Ÿ‘‘ It's desirable because it reduces the number of ports when RTP and RTCP are used. It also takes RTCP aspects into account, which the other mechanisms don't do โœจ

Other mechanisms (Sections 4.1, 4.2, 4.4, 4.5, and 4.6) are NOT RECOMMENDED. Sorry, not sorry ๐Ÿ™…โ€โ™€๏ธ


6. Media Format Exceptions ๐Ÿฆ‹

When a given media format doesn't allow the keepalive solution recommended in Section 5, an alternative mechanism SHOULD be defined in the payload format specification for that media format ๐ŸŽ€


7. Timing and Transport Considerations โฑ๏ธ

An application supporting this specification MUST transmit either keepalive packets or media packets at least once every Tr seconds for the whole duration of the media session ๐Ÿ”ฅ

Tr has different values depending on the transport protocol, so pay attention ๐Ÿ‘€

For UDP, the minimum RECOMMENDED Tr value is 15 seconds, and Tr SHOULD be configurable to larger values ๐Ÿ’…

For TCP, the recommended Tr value is 7200 seconds ๐Ÿงš

When using the "RTCP packets multiplexed with RTP packets" solution (Section 4.3) for keepalive, Tr MUST comply with the RTCP timing rules of [RFC3550] ๐Ÿซถ

Keepalive packets within a particular RTP session MUST use the tuple (source IP address, source TCP/UDP port, target IP address, target TCP/UDP port) of the regular RTP packets ๐ŸŒˆ

The agent SHOULD only send RTP keepalive when it isn't sending regular RTP packets ๐ŸŒธ


8. RTCP Flow Keepalive ๐Ÿ“

RTCP packets get sent periodically, so they can normally keep the NAT mappings open, as long as they're sent frequently enough. There are two conditions for that. First, RTCP needs to be used bidirectionally and in a symmetric fashion, as described in [RFC4961]. Second, RTCP needs to be sent frequently enough. But certain configurations can break that second assumption ๐Ÿ˜ญ

Two factors need to be considered to make sure RTCP is sent frequently enough. First, the RTCP bandwidth needs to be big enough that transmission happens more often than the longest acceptable packet transmission interval (Tr). The worst-case RTCP interval (Twc) can be calculated with this formula, by plugging in the max value of each of these parameters:

  • Maximum RTCP packet size (avg_rtcp_size_max)
  • Maximum number of participants (members_max)
  • RTCP receiver bandwidth (rtcp_bw)
Twc = 1.5 / 1.21828 * members_max * rtcp_bw / avg_rtcp_size_max * 8

The RTCP bandwidth value here is for a worst case, which is the receiver proportion when all members except one are not senders. This can be approximated as all members. So, for sessions where RR and RS values [RFC3556] are used, rtcp_bw shall be set to RR. For sessions where the [RFC3550]-defined proportions of RTCP bandwidth are used (1/4 of the bandwidth for senders and 3/4 for receivers), rtcp_bw will be 5% of 3/4 of the AS value [RFC4566] in bits per second ๐Ÿงฎ

The second factor is the minimum RTCP interval Tmin defined in [RFC3550]. Its base value is 5 seconds, but it might also be scaled to 360 divided by the session bandwidth in kbps. The Extended RTP Profile for Real-time Transport Control Protocol (RTCP)-Based Feedback (RTP/AVPF) [RFC4585] also allows setting a trr-int parameter, which is a minimal RTCP interval for regular RTCP packets. It's also used as the Tmin value in the regular Td calculation. An analysis of the algorithm shows that the longest possible regular RTCP interval is:

RTCP_int_max = trr-int * 1.5 + Td * 1.5 / 1.21828

And as long as there's sufficient bandwidth according to criteria 1 below, the algorithm can be simplified by setting Td = trr-int, giving:

RTCP_int_max = trr-int * (1.5 + 1.5 / 1.21828) = 2.73123 * trr-int

So the requirements for the RTCP parameters for functioning keepalive are as follows ๐ŸŒŸ

  1. Make sure sufficient RTCP bandwidth is provided by calculating Twc, and make sure the resulting value is less than or equal to Tr.
  2. If AVP or SAVP [RFC3711] is used, the Tmin value can't be greater than Tr divided by 1.5 / (e-3/2).
  3. If AVPF or SAVPF [RFC5124] is to be used, trr-min must not be set to a value greater than Tr / 3.

9. Security Considerations ๐Ÿ”

The RTP keepalive packets are sent on the same path as regular RTP media packets, and a peer may perceive them as an attack ๐Ÿ˜ฑ However, [RFC3550] mandates that a peer "ignore packets with payload types that it does not understand". So a peer that doesn't understand the keepalive message will appropriately drop the received packets ๐Ÿ›ก๏ธ


10. Acknowledgements ๐Ÿซถ

Jonathan Rosenberg provided the major inputs for this document via the ICE specification ๐Ÿ‘‘ Magnus Westerlund wrote the text for the RTCP flow keepalive section ๐Ÿ’œ Big thanks as well to Alfred E. Heggestad, Colin Perkins, Dan Wing, Gunnar Hellstrom, Hadriel Kaplan, Randell Jesup, Remi Denis-Courmont, Robert Sparks, and Steve Casner for their useful inputs and comments ๐ŸŒˆ


11. References ๐Ÿ“š

11.1. Normative References

[RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
           Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC3550]  Schulzrinne, H., Casner, S., Frederick, R., and V.
           Jacobson, "RTP: A Transport Protocol for Real-Time
           Applications", STD 64, RFC 3550, July 2003.

[RFC4961]  Wing, D., "Symmetric RTP / RTP Control Protocol (RTCP)",
           BCP 131, RFC 4961, July 2007.

[RFC5405]  Eggert, L. and G. Fairhurst, "Unicast UDP Usage Guidelines
           for Application Designers", BCP 145, RFC 5405,
           November 2008.

[RFC5761]  Perkins, C. and M. Westerlund, "Multiplexing RTP Data and
           Control Packets on a Single Port", RFC 5761, April 2010.

11.2. Informative References

[RFC3261]  Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston,
           A., Peterson, J., Sparks, R., Handley, M., and E.
           Schooler, "SIP: Session Initiation Protocol", RFC 3261,
           June 2002.

[RFC3264]  Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model
           with Session Description Protocol (SDP)", RFC 3264,
           June 2002.

[RFC3389]  Zopf, R., "Real-time Transport Protocol (RTP) Payload for
           Comfort Noise (CN)", RFC 3389, September 2002.

[RFC3556]  Casner, S., "Session Description Protocol (SDP) Bandwidth
           Modifiers for RTP Control Protocol (RTCP) Bandwidth",
           RFC 3556, July 2003.

[RFC3711]  Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K.
           Norrman, "The Secure Real-time Transport Protocol (SRTP)",
           RFC 3711, March 2004.

[RFC4103]  Hellstrom, G. and P. Jones, "RTP Payload for Text
           Conversation", RFC 4103, June 2005.

[RFC4566]  Handley, M., Jacobson, V., and C. Perkins, "SDP: Session
           Description Protocol", RFC 4566, July 2006.

[RFC4585]  Ott, J., Wenger, S., Sato, N., Burmeister, C., and J. Rey,
           "Extended RTP Profile for Real-time Transport Control
           Protocol (RTCP)-Based Feedback (RTP/AVPF)", RFC 4585,
           July 2006.

[RFC4787]  Audet, F., Ed., and C. Jennings, "Network Address
           Translation (NAT) Behavioral Requirements for Unicast
           UDP", BCP 127, RFC 4787, January 2007.

[RFC5124]  Ott, J. and E. Carrara, "Extended Secure RTP Profile for
           Real-time Transport Control Protocol (RTCP)-Based Feedback
           (RTP/SAVPF)", RFC 5124, February 2008.

[RFC5245]  Rosenberg, J., "Interactive Connectivity Establishment
           (ICE): A Protocol for Network Address Translator (NAT)
           Traversal for Offer/Answer Protocols", RFC 5245,
           April 2010.

[RFC5382]  Guha, S., Ed., Biswas, K., Ford, B., Sivakumar, S., and P.
           Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142,
           RFC 5382, October 2008.

[RFC5389]  Rosenberg, J., Mahy, R., Matthews, P., and D. Wing,
           "Session Traversal Utilities for NAT (STUN)", RFC 5389,
           October 2008.

[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, April 2010.

Authors' Addresses ๐Ÿฆ‹

Xavier Marjou
France Telecom Orange
2, avenue Pierre Marzin
Lannion  22307
France

EMail: xavier.marjou@orange-ftgroup.com


Aurelien Sollaud
France Telecom Orange
2, avenue Pierre Marzin
Lannion  22307
France

EMail: aurelien.sollaud@orange-ftgroup.com
๐Ÿ“ฆ where this page comes from