<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp "&#160;">
]>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc
  xmlns:xi="http://www.w3.org/2001/XInclude"
  category="std"
  docName="draft-ietf-intarea-multicast-application-port-09"
  ipr="trust200902"
  submissionType="IETF"
  consensus="true">

  <front>
    <title abbrev="Mcast App Port">The Multicast Application Port</title>

    <author fullname="Nate Karstens" initials="N" surname="Karstens">
      <organization abbrev="Garmin">Garmin International, Inc.</organization>

      <address>
        <postal>
          <street>1200 E. 151st St.</street>
          <city>Olathe</city>
          <region>KS</region>
          <code>66062-3426</code>
          <country>United States of America</country>
        </postal>
        <email>nate.karstens@gmail.com</email>
      </address>
    </author>

    <author fullname="Stuart Cheshire" initials="S" surname="Cheshire">
      <organization>Apple Inc.</organization>
      <address>
        <email>cheshire@apple.com</email>
      </address>
    </author>

    <author fullname="Mike McBride" initials="M" surname="McBride">
      <organization>Futurewei</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>michael.mcbride@futurewei.com</email>
      </address>
    </author>

    <date day="2" month="November" year="2026"/>

    <abstract>
      <t>This document discusses the drawbacks of the current practice
      of assigning a UDP port to each multicast application.
      Such assignments are redundant because the multicast group address
      already uniquely identifies the data.
      This document assigns a UDP port specifically for use with
      multicast applications and lists requirements for using this port.
      This approach provides immediate compatibility with
      existing protocol stacks, and this document also defines
      host enhancements that help safeguard the ongoing
      cooperative use of this port by multicast applications.</t>
    </abstract>
  </front>

  <middle>
    <section title="Terminology">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY",
      and "OPTIONAL" in this document are to be interpreted as described
      in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when,
      and only when, they appear in all capitals, as shown here.</t>

    <t>This document uses the term "multicast group address"
    to refer collectively to the IP destination address for
    Any-Source Multicast (ASM) <xref target="RFC1112"/>,
    and the (S,G) pair for
    Source-Specific Multicast (SSM) <xref target="RFC4607"/>,
    since they serve the same functional purpose.
    Both exist to identify a stream of packets related to a particular
    activity. The network's multicast routing infrastructure uses
    the multicast group address to determine where packets should be
    forwarded, so that they reach all group members that need them,
    without being delivered to hosts or networks that do not.</t>

    <t>For the purposes of this document, a "multicast packet"
    is a packet addressed to a valid multicast group address.
    A "non-multicast packet" is a packet with any other destination
    address, including unicast, anycast, and the broadcast address.</t>

    <t>This document describes each separate usage of an
    application as an "instantiation" of that application.
    For example, a multicast videoconferencing application
    may be in use all over the world for a thousand
    different videoconference meetings at the same time.
    It would be terribly inefficient (and would defeat the purpose of
    multicast) if all the meetings were to use the same multicast group,
    and all copies of the application were to receive all the traffic
    for all videoconference meetings taking place at that time.
    Consequently, each instantiation of a multicast application
    requires its own unique multicast group address.
    How a unique multicast group address is assigned for
    each instantiation is addressed by other IETF documents,
    such as the guidelines for IPv4 multicast address assignment
    <xref target="RFC5771"/>
    and for IPv6 multicast address assignment
    <xref target="RFC3307"/> <xref target="RFC10028"/>.</t>
    </section>

    <section title="Introduction">
      <t>The Internet community has recognized the need to be
      judicious when assigning port numbers
      (<xref target="RFC6335"/>;
      <xref target="RFC7605" sectionFormat="comma" section="6"/>).
      With unicast applications, the need for explicit port assignment
      has been reduced by techniques such as locally assigning a dynamic
      port, combined with some mechanism for advertising that port
      (<xref target="RFC6763"/>;
      <xref target="RFC7605" sectionFormat="comma" section="7.1"/>).
      Dynamic assignment does not work with multicast applications
      because it is impossible to guarantee that the port remains unused
      by all hosts that may want to join a given multicast group.
      The result is that traditionally each multicast application-layer
      protocol has requested its own dedicated port assignment.
      It might seem that even this is insufficient, and perhaps
      each instantiation of each multicast application-layer
      protocol should be assigned its own unique port.
      In fact, this is not necessary.</t>

      <t>In the TCP/IP model, the port number in the transport
      layer multiplexes unicast traffic destined for different
      applications within a host
      (<xref target="RFC1122" sectionFormat="comma" section="4.1.1"/>;
      <xref target="RFC7605" sectionFormat="comma" section="5"/>).
      With multicast, the use of a port number to multiplex applications
      is unnecessary because the multicast group address already
      provides a unique identifier for each application instantiation
      within a given multicast scope.
      Techniques like <tt>SO_REUSEPORT</tt> (details vary depending on the
      specific network API) already exist to
      allow multiple copies of the same multicast application to
      run on the same host and share a single UDP port.
      This approach is widely used to run
      multiple independent implementations of Multicast DNS
      <xref target="RFC6762"/> on a single device.
      This observation is the inspiration behind this specification.
      If the destination port number is not needed for multicast traffic,
      and multiple instantiations of the same application can share a
      single port, then, by the same logic, <em>all</em> multicast
      applications can share a single port, as long as they cooperate
      and use the appropriate API mechanisms to share that port.
      This specification codifies this existing practice,
      and assigns a single UDP port that may be used by all
      multicast applications: the Multicast Application Port.</t>

      <t>The Multicast Application Port can be used
      with both IPv6 and IPv4.</t>

      <t>Multicast applications can begin using the Multicast
      Application Port immediately, following the guidance in
      <xref target="application"/>,
      on any platform that supports <tt>SO_REUSEPORT</tt> or an equivalent.
      In addition, network protocol stacks and APIs can assist in the
      future development of such applications by enforcing special
      rules to ensure correct use of the Multicast Application Port.
      This helps detect and prevent inadvertent application bugs that
      would interfere with the correct sharing of this port
      (<xref target="host"/>).
      Deployment of these special protections is expected to
      take place incrementally, but applications are free to
      use the Multicast Application Port without waiting for
      host APIs to begin enforcing the protections.</t>

      <t>In effect, the Multicast Application Port becomes a
      vestigial placeholder value, present only because the UDP
      packet format requires a value in the destination port field.
      At most, it signifies that this traffic is multicast.
      However, even that information is redundant, since the fact
      that the traffic is multicast can be inferred by observing
      that the destination IP address is a multicast address.</t>

      <t>Use of this port is optional. There may be circumstances
      where there are reasons to assign a port via other means,
      such as when participants cannot meet the requirements in
      Sections <xref target="application" format="counter"/>
      and <xref target="host" format="counter"/>,
      or when a firewall blocks a traffic pattern used
      by the application (<xref target="firewall"/>).</t>

      <t>An application sending multicast messages using the
      Multicast Application Port as the destination port may also
      send unicast messages using a different destination port.
      One possible benefit of doing so is to
      mitigate the limitations of multicast delivery,
      particularly on wireless media <xref target="RFC9119"/>.</t>

      <section title="Multicast Address Assignment">
        <t>The ability to identify a multicast application instantiation
        by its multicast group address assumes that a unique multicast
        group address has been assigned to the application instantiation.
        These assignments are outside the scope of this document.
        Additional information can be obtained from
        the overview of the Internet multicast addressing architecture
        <xref target="RFC6308"/>
        and the following IANA registry groups:</t>
        <ul>
          <li>IPv4 Multicast Address Space <xref target="MCast4"/></li>
          <li>IPv6 Multicast Address Space <xref target="MCast6"/></li>
        </ul>
      </section>
    </section>

    <section title="Assignment">
      <t>This document <em>requests</em> assignment of UDP port
      8738 (0x2222) with the service name "multicast-app".</t>

      <t>ASM application instantiations using the Multicast Application
      Port are identified by the destination multicast address.
      SSM application instantiations using the Multicast Application Port
      are identified by their (S,G) channel, a combination of source unicast
      address and destination multicast address <xref target="RFC4607"/>.
      Because unicast traffic carries no such identifier,
      the Multicast Application Port MUST NOT be used as either a
      source port or destination port for any non-multicast packets.</t>

      <t>The Multicast Application Port MAY be used as a source port
      by an application that sends only multicast messages.</t>

      <t>If any application messages are unicast, then it is
      RECOMMENDED that the source port used for multicast messages
      be set to the port to which receivers can send unicast replies.
      Note that such arrangements would likely require each
      participant to use multiple sockets, because it must bind to
      both the Multicast Application Port and its unicast port.</t>
    </section>

    <section title="Application Requirements" anchor="application">
      <t>Applications that use the Multicast Application Port
      MUST meet the requirements in this section.</t>

      <t>Application instantiations SHALL NOT prevent other
      application instantiations from using this port.
      On hosts using POSIX-like socket APIs <xref target="POSIX"/>,
      this is typically accomplished by enabling a socket option
      before binding the socket.
      Common socket options include <tt>SO_REUSEADDR</tt>,
      <tt>SO_REUSEPORT</tt>, and <tt>SO_REUSE_MULTICASTPORT</tt>,
      but the specific mechanism varies by platform.</t>

      <t>For efficiency, applications SHOULD use networking APIs
      in such a way to minimize reception of unwanted traffic
      that the application then immediately has to discard.
      For example, on some platforms it may be prudent
      to bind a socket to the application instantiation's
      multicast group address and the Multicast Application Port,
      so that it only receives the packets it wants.
      (Note that with BSD Sockets and similar APIs, just binding to
      the appropriate multicast group address alone is insufficient.
      After binding, the application then needs to use
      <tt>IP_ADD_MEMBERSHIP</tt>, <tt>IPV6_JOIN_GROUP</tt>,
      <tt>MCAST_JOIN_GROUP</tt>, <tt>MCAST_JOIN_SOURCE_GROUP</tt>, or equivalent
      to tell the networking stack that it actually wants to
      receive traffic sent to that multicast group address.)
      However, this approach limits applications to
      only one multicast group address per socket.
      An alternative approach, on platforms which deliver
      only traffic for groups the socket has joined
      (e.g., Linux with <tt>IP_MULTICAST_ALL=0</tt> or
      <tt>IPV6_MULTICAST_ALL=0</tt>),
      is to bind the socket to the wildcard (zero) address
      (<xref target="RFC3493" sectionFormat="comma" section="3.8"/>)
      and then have that socket join the desired multicast group(s).</t>

      <t>Applications SHALL discard all non-multicast packets
      received that use the Multicast Application Port
      as either a source or destination port.</t>

      <t>Furthermore, to guard against operating systems that do
      not perform the inbound traffic filtering described here,
      application instantiations SHALL discard
      datagrams received on the Multicast Application Port
      unless they are addressed to a multicast group address
      being used by that application instantiation
      (and received on the desired network interface, if specified).
      Relevant socket API mechanisms such as <tt>IP_PKTINFO</tt> and
      <tt>IPV6_PKTINFO</tt> are described in the Advanced Sockets API
      for IPv6 <xref target="RFC3542"/> and
      "Socket Interface Extensions for Multicast Source Filters"
      <xref target="RFC3678"/>.</t>

      <t>Applications SHALL NOT send any non-multicast
      packets using the Multicast Application Port
      as either a source port or destination port.</t>
    </section>

    <section title="Host Requirements" anchor="host">
      <t>Hosts implementing this specification
      SHALL require applications using this port to use
      it non-exclusively. On hosts using POSIX-like socket APIs
      <xref target="POSIX"/>, this is typically accomplished by
      enabling a socket option before binding the socket.
      Common socket options include <tt>SO_REUSEADDR</tt>,
      <tt>SO_REUSEPORT</tt>, and <tt>SO_REUSE_MULTICASTPORT</tt>,
      but each platform provides its own method.
      This requirement ensures that applications developed on a
      conformant host will follow the correct rules, and therefore
      also work correctly on older hosts that do not enforce
      the protections on the Multicast Application Port.</t>

      <t>If the application fails to follow the correct steps to
      share the Multicast Application Port, then the networking
      API SHALL return an error code, throw an exception, or
      otherwise fail the application's attempt to bind to the
      Multicast Application Port. This helps the application
      developer discover their mistake and correct it.
      The networking API MUST NOT try to be "helpful" by silently
      correcting the misbehaving application and automatically
      granting it shared access to the Multicast Application Port.
      Doing so would defeat the goal of ensuring that a properly
      written application will work both on platforms that implement
      these protections and on older platforms that do not.</t>

      <t>For efficiency,
      hosts SHOULD deliver to an application endpoint (e.g., socket)
      only packets addressed to the multicast group address(es) that
      the application endpoint has joined.
      Technically, this is not essential, since applications are
      required to discard datagrams received on the Multicast
      Application Port if they are not addressed to the multicast
      group address the application endpoint has joined
      (and received on the desired network interface, if specified).
      However, it is advisable to perform this filtering for
      efficiency, since it is wasteful to deliver packets to
      an application endpoint only to have that application
      promptly discard them.</t>

      <t>Hosts SHALL discard all incoming non-multicast packets
      that use the Multicast Application Port as either a source
      or destination port.</t>

      <t>Hosts SHALL prevent applications from sending
      non-multicast packets using the Multicast Application Port
      as either a source or destination port by having
      the send operation return an error code.</t>

      <t>Some networking APIs provide a mechanism to allow
      client software to disable generation and checking
      of checksums for UDP packets
      <xref target="RFC6935"/> <xref target="RFC6936"/>
      (e.g., the Linux <tt>SO_NO_CHECK</tt> socket option).
      Where networking APIs support disabling UDP checksums, this
      MUST be implemented per endpoint (socket), as Linux does,
      not as a system-wide default or per-port option.
      With different multicast protocols sharing the Multicast
      Application Port, the UDP port cannot be used to identify a
      traffic flow to determine what UDP checksum policy to apply.</t>
    </section>

    <section title="Firewall Considerations" anchor="firewall">
      <t>Many network firewalls, which operate on network infrastructure, and host firewalls, which operate on individual hosts, are configured to accept incoming messages as long as there was first an outgoing message using the same set of ports <xref target="RFC7288"/>. Consider the following sequence of messages:</t>

      <ol>
        <li>(Multicast) Host A to group containing Host B<br />Source Port: 50000 (Dynamic)<br />Dest Port: 8738 (0x2222)</li>
        <li>(Unicast) Host B to Host A<br />Source Port: 60000 (Dynamic)<br />Dest Port: 50000</li>
        <li>(Unicast) Host A to Host B<br />Source Port: 50000<br />Dest Port: 60000</li>
      </ol>

      <t>A host firewall running on Host A (or a network firewall
      between Host A and Host B) may block Message 2 because Message 1
      has port 8738 as its destination port but Message 2 does not have
      (and is not allowed to have) port 8738 as its source port.</t>

      <t>While a firewall could be configured to accept Message 2, this configuration would have to be automated because the use of dynamic ports makes manual configuration too costly even in small deployments. However, this automation leads to unacceptable security risks. For example, if a firewall were to respond to Message 1 by opening up the source port used in the message, a malicious application running on the host could open large holes in the firewall by repeatedly sending variations of Message 1 using different source ports.</t>

      <t>Host firewalls could be configured to allow messages associated
      with a given application instantiation (instead of specific ports),
      but this approach would not work with a network firewall.</t>

      <t>Ultimately, the current practice of assigning each
      multicast application its own port is more practical for any
      application that uses both multicast and unicast messages
      and could be deployed in an environment using firewalls.
      Firewall configuration with an assigned port is
      straightforward: allow all messages using that port.
      However, port-based rules offer limited assurance,
      because a rogue application can use the same port to
      masquerade as the legitimate trusted application.</t>
    </section>

    <section title="Implementation Status">
      <t>Note to RFC Editor: please remove this entire section
      before publication, as well as the reference to RFC7942.</t>

      <t>This section records the status of known implementations
      of the protocol defined by this specification at the
      time of posting of this Internet-Draft, and is based on
      the IETF's guidance on improving awareness of running code
      <xref target="RFC7942"/>.
      The description of implementations in this section is
      intended to assist the IETF in its decision processes in
      progressing drafts to RFCs.  Please note that the listing
      of any individual implementation here does not imply
      endorsement by the IETF.  Furthermore, no effort has been
      spent to verify the information presented here that was
      supplied by IETF contributors. This is not intended as, and
      must not be construed to be, a catalog of available
      implementations or their features.  Readers are advised
      to note that other implementations may exist.</t>

      <t>According to that guidance, "this will allow reviewers
      and working groups to assign due consideration to documents
      that have the benefit of running code, which may serve
      as evidence of valuable experimentation and feedback
      that have made the implemented protocols more mature.
      It is up to the individual working groups to use this
      information as they see fit".</t>

      <t>Prototypes for Linux, macOS, and Windows are available at
      <eref target="https://github.com/ietf-wg-pim/draft-ietf-intarea-multicast-application-port/" brackets="angle"/>.
      These programs configure a socket to receive messages sent
      to the Multicast Application Port using a specified
      multicast address. Another program, such as <tt>socat</tt>,
      can be used to send messages and demonstrate, with an
      unmodified operating system, that the prototype will
      (1) display messages sent to the Multicast Application
      Port using the specified multicast address, and
      (2) <em>not</em> display messages sent to the Multicast Application
      Port but addressed to a different multicast address.</t>
    </section>

    <section title="Security Considerations">
      <t>Firewall and QoS rules that reference ports are
      typically intended to match specific applications.
      Because application instantiations using the Multicast
      Application Port are identified by their destination
      multicast address (ASM) or (S,G) channel (SSM), rules
      referencing the Multicast Application Port SHOULD also
      consider any applicable network-layer address.
      A firewall rule that only references the Multicast
      Application Port would match all applications using
      that port, which is too broadly scoped.</t>

      <t>Applications running on a host that does not protect the Multicast
      Application Port from misuse are vulnerable to a denial-of-service
      attack if another application claims exclusive access to the port.
      This vulnerability is not unique to the Multicast Application Port.
      Regardless of which port an application uses,
      a malicious application could claim exclusive access
      to that port first, and thereby prevent the legitimate
      application from being able to use its port.</t>

      <t>Systems that use POSIX-like socket APIs typically have
      restrictions on binding multiple sockets to the same port.
      This can serve as a rudimentary security mechanism in that
      other local applications cannot eavesdrop on the multicast stream.
      A necessary side effect of using the Multicast Application Port
      is that applications can no longer rely on this protection.
      These applications should consider incorporating additional
      security measures into their protocol. Note that the
      problem of local eavesdropping is typically no worse than
      on-path eavesdropping, so it is likely that both attack
      vectors can be mitigated by the same measure (e.g., encryption).</t>
    </section>

    <section title="IANA Considerations">
      <t>IANA is <em>requested</em> to assign the following port:</t>

      <artwork><![CDATA[
Service Name        multicast-app
Transport Protocol  UDP
Assignee            IESG <iesg@ietf.org>
Contact             IETF Chair <chair@ietf.org>
Description         Multicast Application Port
Reference           This document
Port Number         8738]]>
      </artwork>

      <t>IANA is requested to update its "Application for Service
      Names and User Port Numbers" <xref target="IANA-APP"/>
      to reference this document and ask applicants whether
      the Multicast Application Port could be used instead.
      These changes will help applicants understand that a dedicated
      port may be unnecessary for their multicast protocol.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3493.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4607.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
    </references>
    <references title="Informative References">
      <reference anchor="IANA-APP" target="https://www.iana.org/form/ports-services">
        <front>
          <title>Application for Service Names and User Port Numbers</title>
          <author>
            <organization>Internet Assigned Numbers Authority</organization>
          </author>
        </front>
      </reference>
      <reference anchor="MCast4" target="https://www.iana.org/assignments/multicast-addresses">
        <front>
          <title>IPv4 Multicast Address Space</title>
          <author>
            <organization>Internet Assigned Numbers Authority</organization>
          </author>
        </front>
      </reference>
      <reference anchor="MCast6" target="https://www.iana.org/assignments/ipv6-multicast-addresses">
        <front>
          <title>IPv6 Multicast Address Space</title>
          <author>
            <organization>Internet Assigned Numbers Authority</organization>
          </author>
        </front>
      </reference>
      <reference anchor="POSIX" target="https://pubs.opengroup.org/onlinepubs/9699919799/">
        <front>
          <title>Portable Operating System Interface Base Specifications, Issue 7</title>
          <author>
            <organization>The Open Group</organization>
          </author>
          <date month="January" year="2018" />
        </front>
      </reference>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1112.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.1122.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3307.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3542.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3678.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5771.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6308.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6335.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6762.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6763.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6935.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6936.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7288.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7605.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7942.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9119.xml"/>
      <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.10028.xml"/>
    </references>

    <section title="Acknowledgements">
      <t>Special thanks to the National Marine Electronics Association for their contributions in developing marine industry standards and their support for this research.</t>

      <t>The authors are grateful to the members of the PIM and
      INTAREA working groups for their review of this document,
      and to the following individuals specifically:</t>

      <ul>
        <li>Joe Touch for consulting on port assignment</li>
        <li>Lorenzo Colitti for his suggestions for host requirements</li>
        <li>David Schinazi for pointing out likely port conflicts
        with several major operating systems</li>
        <li>Juliusz Chroboczek for suggestions on the source port to use
        for multicast messages when unicast replies are expected</li>
        <li>Dave Thaler for insightful discussion on how the Multicast Application Port would operate in the presence of a firewall</li>
      </ul>
    </section>
  </back>
</rfc>
