<?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.29 (Ruby 3.4.4) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-tsvwg-udp-fragmentation-02" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.29.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-02"/>
    <author fullname="Marten Seemann">
      <organization>Smallstep</organization>
      <address>
        <email>martenseemann@gmail.com</email>
      </address>
    </author>
    <author fullname="Max Inden">
      <organization>Mozilla</organization>
      <address>
        <email>mail@max-inden.de</email>
      </address>
    </author>
    <date year="2025" month="July" day="07"/>
    <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 36?>

<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 44?>

<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 sender'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 makes 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>PMTUD behavior is controlled via the IP_MTU_DISCOVER and IPV6_MTU_DISCOVER
socket options at the IPPROTO_IP and IPPROTO_IPV6 levels. There are two closely
related values: For IPv4, both IP_PMTUDISC_DO and IP_PMTUDISC_PROBE enable
setting the DF bit. For IPv6, both IPV6_PMTUDISC_DO and IPV6_PMTUDISC_PROBE
prevent fragmentation by the sender.</t>
        <t>The difference between the former and the latter is that the former instructs
the kernel to process ICMP "Fragmentation Needed" messages, while the latter
does not.</t>
        <t>When the kernel processes an ICMP "Fragmentation Needed" message, it will
prevent the transmission of larger datagrams. Applications that wish to only
respond to fully encrypted end-to-end signals (for example QUIC
(<xref target="RFC9000"/>)) might therefore wish to use IP_PMTUDISC_PROBE and
IPV6_PMTUDISC_PROBE.</t>
        <t>For dual-stack sockets, both IPv4 and IPv6 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, and prevents fragmentation of IPv6 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, contrary 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 170?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA6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