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

NetworkInterface.getNetworkInterfaces() handles multiple loopbacks incorrectly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_11"
      Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
      Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600] (Russian) 32-bit

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      AMD Sempron Processor 2800+
      IP Helper API 5.1.2600.5512 (xpsp.080413-0852)

      One Ethernet card, one PPP connection over GPRS

      A DESCRIPTION OF THE PROBLEM :
      Due to a bug in native code (enumInterfaces_win function in NetworkInterface.c) when multiple loopback interfaces are present in the system, getNetworkInterfaces() method return incomplete list of interfaces.

      The reason is that when loopback interface already found and switch encounters it again, it continues the loop without incrementing ifrowP pointer.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Have machine with one connected ethernet interface and one connected PPP interface. This results in three UP interfaces (lo, eth0 and ppp0).

      Now navigate to Control pannel -> Network Connections and create new incoming connection:

      (New Connection Wizard -> Set up an advanced connection (so that other computers can connect) -> Accept incoming connections -> Select using standard modem -> Allow virtual private connections -> Next -> Next -> Next -> Finish)



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      lo
      eth0
      ppp0

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.net.NetworkInterface;
      import java.net.SocketException;
      import java.util.Collections;
      import java.util.Enumeration;

      public class Main {
          public static void main(String[] args) throws SocketException {
              Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
              for (NetworkInterface ni : Collections.list(nis)) {
                  System.out.println(ni.getName());
              }
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Remove duplicate loopback interface by deleting Incoming connection

      Attachments

        Issue Links

          Activity

            People

              michaelm Michael McMahon
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: