<?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.23 (Ruby 3.3.6) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-seemann-tsvwg-udp-fragmentation-01" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.27.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-01"/>
    <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="March" day="02"/>
    <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. Consequently, IP_PMTUDISC_DO makes
applications vulnerable to the UDP equivalent of the Blind Performance-Degrading
ICMP attack described in <xref section="7" sectionFormat="of" target="RFC5927"/>. This vulnerability does not
exist when using 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>
      <reference anchor="RFC5927">
        <front>
          <title>ICMP Attacks against TCP</title>
          <author fullname="F. Gont" initials="F." surname="Gont"/>
          <date month="July" year="2010"/>
          <abstract>
            <t>This document discusses the use of the Internet Control Message Protocol (ICMP) to perform a variety of attacks against the Transmission Control Protocol (TCP). Additionally, this document describes a number of widely implemented modifications to TCP's handling of ICMP error messages that help to mitigate these issues. This document is not an Internet Standards Track specification; it is published for informational purposes.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="5927"/>
        <seriesInfo name="DOI" value="10.17487/RFC5927"/>
      </reference>
    </references>
    <?line 170?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA6VYYW/bOBL9zl/Bcz9sc7CNpJtrG2Nvd9M42RpIYl/itigO
h4KWaJuIJPpIyqlb5L/cb7lfdm9ISpZsd6/YXRQbiyKHwzfvzQzV6/UYc8pl
csA7F7pwRmeZKhZ8NOFXRixyWTjhlC44/l3oPMefSSbcXJvcdpiYzYxcYymm
z3envxtO+L1OHqTDzEQ4udBmM+CqmGvGUp0UIseuqRFz17NS5qIoes6uHxe9
Ml31WuZ6xyfMlrNcWYsnt1lh4ehyesX5My4yq+GBKlK5kvhf4Tpd3pGpctoo
kdHD6PwN/miDX3fTqw4rynwmzYClcGrAEl1YWdjSDrgzpWQ4z49MGClg9YOc
cVGkfFQ4aQrp+NSIwq60cR32qM3DwuhyhXn1sJ99L81aJdLyD5hCaP5G0zrs
QW6wKB0w3uO7iNHYUBc/uBp3GpkIt+Q303d8qGyi19Js/LzJ9QSDQ8ZE6Zba
kEHG8d+8zLIA640wThbwxOPqX2qzEIX64ncb8PtcZJl1cuXfYZbKBjz3q2Iw
fl3QYD/R+SHzn4EJwD5g+UZ/UVkm2nZV9msuPvcoSkU/lYwVYBAWrBEARpTY
PrFer8fFzDojEsfYhyXOsZKGphCW+5Dw5x6NI05PRLsuF6tVphLvkOV5aR1f
gagE6g5N556mIIJYGJFbPtOwPttwt5TcEp3MD5Y/UOwzH9q0NOQEqEDhZ47i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