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

IP_TOS is set incorrectly on Linux

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • P3
    • Resolution: Unresolved
    • None
    • None
    • core-libs

    Description

      NET_SetSockOpt applies (IPTOS_TOS_MASK | IPTOS_PREC_MASK) mask to TOS value. This behaviour is from RFC 1349 TOS scheme which is no longer used by modern Linux kernel (and other systems like BSD, OS X), which instead uses an incompatible scheme from RFC 3260 (Diffserv/ECN).

      This program prints 122 instead of the correct 123.

      import java.net.*;

      public class IptosBug {
          public static void main(String[] args) throws Throwable {
              DatagramSocket s = new DatagramSocket();
              s.setTrafficClass(123);
              System.out.println(s.getTrafficClass());
          }
      }

      Suggested fix: remove the line

      net_util_md.c:1360: *iptos &= (IPTOS_TOS_MASK | IPTOS_PREC_MASK);

      (filed on behalf of networking engineers at Google)

      Attachments

        Activity

          People

            michaelm Michael McMahon
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: