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

IP_DONTFRAGMENT doesn't set DF bit in IPv4 header

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • None
    • core-libs
    • b10

      Environment: Windows 10, 21H2

      To reproduce, use Wireshark to capture the traffic on loopback interface while running the following code:

              DatagramChannel channel = DatagramChannel.open();
              channel.setOption(ExtendedSocketOptions.IP_DONTFRAGMENT, true);
              channel.send(ByteBuffer.allocate(0),
                      new InetSocketAddress("127.0.0.1", 1234));

      Check the IPv4 header of the captured packet.

      Expected result:

      Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
      ...
          Flags: 0x40, Don't fragment

      Actual result:
      Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
      ...
          Flags: 0x00

      Workaround:
      Open an IPv4 channel:
              DatagramChannel channel = DatagramChannel.open(StandardProtocolFamily.INET);

            djelinski Daniel Jelinski
            djelinski Daniel Jelinski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: