<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.20 (Ruby 3.3.3) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-tsvwg-udp-fragmentation-00" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.24.0 -->
  <front>
    <title abbrev="IP fragmentation on UDP Sockets">Controlling IP Fragmentation on Common Platforms</title>
    <seriesInfo name="Internet-Draft" value="draft-seemann-tsvwg-udp-fragmentation-00"/>
    <author fullname="Marten Seemann">
      <organization/>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="November" day="15"/>
    <area>Web and Internet Transport</area>
    <workgroup>Transport and Services Working Group</workgroup>
    <keyword>IP fragmentation</keyword>
    <keyword>Don't Fragment</keyword>
    <keyword>Path MTU Discovery</keyword>
    <keyword>DPLPMTUD</keyword>
    <abstract>
      <?line 31?>

<t>When performing Path MTU Discovery (PMTUD) over UDP, applications must prevent
fragmentation of UDP datagrams both by the sender's kernel and during network
transit. This document provides guidance for implementers on configuring socket
options to prevent fragmentation of IPv4 and IPv6 packets across commonly used
platforms.</t>
    </abstract>
    <note removeInRFC="true">
      <name>Discussion Venues</name>
      <t>Discussion of this document takes place on the
    Transport and Services Working Group Working Group mailing list (tsvwg@ietf.org),
    which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/tsvwg/"/>.</t>
      <t>Source for this draft and an issue tracker can be found at
    <eref target="https://github.com/marten-seemann/draft-seemann-tsvwg-udp-fragmentation"/>.</t>
    </note>
  </front>
  <middle>
    <?line 39?>

<section anchor="introduction">
      <name>Introduction</name>
      <t><xref target="RFC0791"/> defines the Don't Fragment (DF) bit in the IPv4 header. When set,
this bit prevents routers from fragmenting IP packets. If a router needs to
fragment a packet with the DF bit set, it will instead drop the packet and send
an ICMP "fragmentation needed" message back to the sender.</t>
      <t>The DF bit has historically been most relevant to TCP (<xref target="RFC9293"/>), where the
kernel handles Path MTU Discovery (PMTUD) internally. Applications using TCP
sockets do not need to interact with the DF bit directly.</t>
      <t>In IPv6 (<xref target="RFC8200"/>), fragmentation by intermediate nodes is not permitted.
All IPv6 packets effectively have the DF bit set, however, the endpoint's kernel
might still break up UDP datagrams that are too large to fit the MTU of the
interface before sending a packet into the network.</t>
      <t><xref target="RFC8899"/> defines Datagram Packetization Layer Path MTU Discovery (DPLPMTUD),
a mechanism that allows protocols running over UDP to determine the maximum
packet size they can send. Setting the DF bit is crucial for DPLPMTUD, as it
ensures that packets larger than the Path MTU are dropped, allowing the endpoint
to detect the MTU limitation.</t>
      <t>QUIC <xref target="RFC9000"/> is one such protocol that runs over UDP and make use of
DPLPMTUD. As QUIC implementations typically run in user space, they need to
configure the DF bit on their UDP sockets to perform DPLPMTUD correctly.</t>
      <t>This document provides guidance for implementers on how to set the DF bit on UDP
sockets across different platforms.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" 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>
      <?line -18?>

</section>
    <section anchor="setting-the-df-bit">
      <name>Setting the DF bit</name>
      <t>While routers don't fragment IPv6 packets in transit, the sender's kernel will
still fragment UDP datagrams that are too large to fit the MTU of the interface
before sending a packet into the network. Therefore, operating systems offer
socket options to control the fragmentation behavior for IPv6 packets.</t>
      <t>For user-space implementations of DPLPMTUD, applications need to set the DF bit on
IPv4 sockets and prevent fragmentation on IPv6 sockets.</t>
      <section anchor="linux">
        <name>Linux</name>
        <t>Linux uses the socket option of level IPPROTO_IP with name IP_MTU_DISCOVER with
value IP_PMTUDISC_DO for IPv4.</t>
        <t>For IPv6, IPV6_MTU_DISCOVER with a value of IPV6_PMTUDISC_DO is used for the
IPPROTO_IPV6 level.</t>
        <t>For dual-stack sockets, both socket options can be set independently.</t>
      </section>
      <section anchor="apple">
        <name>Apple</name>
        <t>For IPv4, Apple platforms use the socket option of level IPPROTO_IP with name
IP_DONTFRAG with value 1. For IPv6, IPV6_DONTFRAG with value 1 is used for the
IPPROTO_IPV6 level.</t>
        <t>However, dual-stack sockets are handled differently: To open a dual-stack socket,
an IPv6 socket needs to be opened and the IPV6_V6ONLY option needs to be set to
0. This enables the socket to send both IPv4 and IPv6 packets. IPv4 packets must
be sent using an IPv4-mapped IPv6 address.</t>
        <t>When using a dual-stack socket, it is only necessary (and possible) to set the
IPV6_DONTFRAG socket option. This results in the DF bit being set when sending
IPv4 packets. It is not possible to control the fragmentation behavior of IPv4
and IPv6 separately.</t>
      </section>
      <section anchor="windows">
        <name>Windows</name>
        <t>For IPv4, Windows uses the socket option of level IPPROTO_IP with name
IP_DONTFRAGMENT with value 1. For IPv6, IPV6_DONTFRAG with value 1 is used for
the IPPROTO_IPV6 level.</t>
        <t>Similar to the Apple platforms, dual-stack sockets are IPv6 sockets with the
IPV6_V6ONLY option set to 0. IPv4 packets must be sent using an IPv4-mapped
IPv6 address. However, contractary to Apple platforms, the DF bit on IPv4
packets is controlled by the IP_DONTFRAGMENT socket option.</t>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TODO Security</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC0791">
        <front>
          <title>Internet Protocol</title>
          <author fullname="J. Postel" initials="J." surname="Postel"/>
          <date month="September" year="1981"/>
        </front>
        <seriesInfo name="STD" value="5"/>
        <seriesInfo name="RFC" value="791"/>
        <seriesInfo name="DOI" value="10.17487/RFC0791"/>
      </reference>
      <reference anchor="RFC9293">
        <front>
          <title>Transmission Control Protocol (TCP)</title>
          <author fullname="W. Eddy" initials="W." role="editor" surname="Eddy"/>
          <date month="August" year="2022"/>
          <abstract>
            <t>This document specifies the Transmission Control Protocol (TCP). TCP is an important transport-layer protocol in the Internet protocol stack, and it has continuously evolved over decades of use and growth of the Internet. Over this time, a number of changes have been made to TCP as it was specified in RFC 793, though these have only been documented in a piecemeal fashion. This document collects and brings those changes together with the protocol specification from RFC 793. This document obsoletes RFC 793, as well as RFCs 879, 2873, 6093, 6429, 6528, and 6691 that updated parts of RFC 793. It updates RFCs 1011 and 1122, and it should be considered as a replacement for the portions of those documents dealing with TCP requirements. It also updates RFC 5961 by adding a small clarification in reset handling while in the SYN-RECEIVED state. The TCP header control bits from RFC 793 have also been updated based on RFC 3168.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="7"/>
        <seriesInfo name="RFC" value="9293"/>
        <seriesInfo name="DOI" value="10.17487/RFC9293"/>
      </reference>
      <reference anchor="RFC8200">
        <front>
          <title>Internet Protocol, Version 6 (IPv6) Specification</title>
          <author fullname="S. Deering" initials="S." surname="Deering"/>
          <author fullname="R. Hinden" initials="R." surname="Hinden"/>
          <date month="July" year="2017"/>
          <abstract>
            <t>This document specifies version 6 of the Internet Protocol (IPv6). It obsoletes RFC 2460.</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="86"/>
        <seriesInfo name="RFC" value="8200"/>
        <seriesInfo name="DOI" value="10.17487/RFC8200"/>
      </reference>
      <reference anchor="RFC8899">
        <front>
          <title>Packetization Layer Path MTU Discovery for Datagram Transports</title>
          <author fullname="G. Fairhurst" initials="G." surname="Fairhurst"/>
          <author fullname="T. Jones" initials="T." surname="Jones"/>
          <author fullname="M. Tüxen" initials="M." surname="Tüxen"/>
          <author fullname="I. Rüngeler" initials="I." surname="Rüngeler"/>
          <author fullname="T. Völker" initials="T." surname="Völker"/>
          <date month="September" year="2020"/>
          <abstract>
            <t>This document specifies Datagram Packetization Layer Path MTU Discovery (DPLPMTUD). This is a robust method for Path MTU Discovery (PMTUD) for datagram Packetization Layers (PLs). It allows a PL, or a datagram application that uses a PL, to discover whether a network path can support the current size of datagram. This can be used to detect and reduce the message size when a sender encounters a packet black hole. It can also probe a network path to discover whether the maximum packet size can be increased. This provides functionality for datagram transports that is equivalent to the PLPMTUD specification for TCP, specified in RFC 4821, which it updates. It also updates the UDP Usage Guidelines to refer to this method for use with UDP datagrams and updates SCTP.</t>
            <t>The document provides implementation notes for incorporating Datagram PMTUD into IETF datagram transports or applications that use datagram transports.</t>
            <t>This specification updates RFC 4960, RFC 4821, RFC 6951, RFC 8085, and RFC 8261.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="8899"/>
        <seriesInfo name="DOI" value="10.17487/RFC8899"/>
      </reference>
      <reference anchor="RFC9000">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author fullname="J. Iyengar" initials="J." role="editor" surname="Iyengar"/>
          <author fullname="M. Thomson" initials="M." role="editor" surname="Thomson"/>
          <date month="May" year="2021"/>
          <abstract>
            <t>This document defines the core of the QUIC transport protocol. QUIC provides applications with flow-controlled streams for structured communication, low-latency connection establishment, and network path migration. QUIC includes security measures that ensure confidentiality, integrity, and availability in a range of deployment circumstances. Accompanying documents describe the integration of TLS for key negotiation, loss detection, and an exemplary congestion control algorithm.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9000"/>
        <seriesInfo name="DOI" value="10.17487/RFC9000"/>
      </reference>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <?line 154?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA6VY/24bNxL+n0/BU/5ofJAEOzXSWOi1p1p2I8C2dLacIDgc
AmqXkgjvLhckV64a+F3uWe7J7huSu9JKapHLBYGl5Q6HM99884Pq9XqMOeUy
OeCdS104o7NMFUs+nvJrI5a5LJxwShcc/y91nuNjmgm30Ca3HSbmcyPX2Arx
xb7442jKH3TyJB0kE+HkUpvNgKtioRlLdVKIHKemRixcz0qZi6LoObt+Xvaq
tOy11PVOT5mt5rmyFk9uU2Lj+Gp2zfkrLjKrYYEqUllK/Clcp8s7MlVOGyUy
ehgPf8GHNvh2P7vusKLK59IMWAqjBizRhZWFreyAO1NJBn++Z8JIAa0f5ZyL
IuXjwklTSMdnRhS21MZ12LM2T0ujqxJ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