Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285224

Support for Do not fragment IP socket options

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • core-libs
    • None
    • source
    • minimal
    • Java API
    • JDK

      Summary

      Add a new IP_DONTFRAGMENT SocketOption to jdk.net.ExtendedSocketOptions.

      Problem

      We need to support the various socket options relating to the IPv4 DF (Do not Fragment) flag. While IPv6 does not allow packet fragmentation, there is an equivalent socket option which disables the end to end fragmentation that IPv6 can use.

      This is required to support the PL PMTU discovery protocol used in QUIC.

      The socket option can be a jdk.net.ExtendedSocketOption

      Solution

      An alternative would be to add it to java.net.StandardSocketOptions, but there is a bit too much variation in platform specific behavior of the option and it is definitely a niche requirement.

      Specification

      Add the following socket option to jdk.net.ExtendedSocketOptions

        /**
         * Disable IP packet fragmentation.
         *
         * <p> The value of this socket option is a {@code Boolean} that represents
         * whether the option is enabled or disabled. When {@code true} fragmentation
         * of outgoing IPv4 and IPv6 packets does not occur. This option can only be used
         * with datagram sockets. When set, care must be taken to limit outgoing packet
         * sizes to the {@link java.net.NetworkInterface#getMTU() local MTU}. Depending
         * on the implementation and the network interface, packets larger than the MTU
         * may be sent or dropped silently or dropped with an exception thrown.
         *
         * @apiNote
         * For IPv4 this option sets the DF (Do not Fragment) flag in the IP packet
         * header. This instructs intermediate routers to not fragment the packet.
         * IPv6 routers never fragment packets. Instead, fragmentation is handled
         * by the sending and receiving nodes exclusively. Setting this option for
         * an IPv6 socket ensures that packets to be sent are never fragmented, in
         * which case, the local network MTU must be observed.
         */
        public static final SocketOption<Boolean> IP_DONTFRAGMENT 

            michaelm Michael McMahon
            michaelm Michael McMahon
            Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: