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

NetworkInterface.getHardwareAddress can return zero length byte array when run with preferIPv4Stack

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b32
    • OS:
      windows_2012, windows_8
    • Verification:
      Verified

      Backports

        Description

        $ cat ListHardwareAddresses.java
        import java.net.*;
        import java.util.*;

        public class ListHardwareAddresses {
            public static void main(String[] args) throws Exception {
                Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
                while (netInterfaces.hasMoreElements()) {
                    NetworkInterface netInterface = netInterfaces.nextElement();
                    byte[] addr = netInterface.getHardwareAddress();
                    System.out.format("%n%s : length %s", netInterface.getDisplayName(),
                                                          addr == null ? "null" : addr.length);
                }
            }

        }

        $ java ListHardwareAddresses

        Software Loopback Interface 1 : length null
        WAN Miniport (L2TP) : length null
        WAN Miniport (SSTP) : length null
        WAN Miniport (IKEv2) : length null
        WAN Miniport (PPTP) : length null
        WAN Miniport (PPPOE) : length null
        WAN Miniport (IP) : length null
        WAN Miniport (IPv6) : length null
        WAN Miniport (Network Monitor) : length null
        Microsoft Kernel Debug Network Adapter : length null
        RAS Async Adapter : length null
        Oracle VM Virtual Ethernet Adapter : length 6
        Oracle VM Virtual Ethernet Adapter #2 : length null
        Microsoft ISATAP Adapter #3 : length 8
        WAN Miniport (IP)-WFP Native MAC Layer LightWeight Filter-0000 : length null
        WAN Miniport (IP)-QoS Packet Scheduler-0000 : length null
        WAN Miniport (IPv6)-WFP Native MAC Layer LightWeight Filter-0000 : length null
        WAN Miniport (IPv6)-QoS Packet Scheduler-0000 : length null
        WAN Miniport (Network Monitor)-WFP Native MAC Layer LightWeight Filter-0000 : length null
        WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000 : length null
        Oracle VM Virtual Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 : length null
        Oracle VM Virtual Ethernet Adapter-QoS Packet Scheduler-0000 : length null
        Oracle VM Virtual Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 : length null

        $ java -Djava.net.preferIPv4Stack=true ListHardwareAddresses

        Software Loopback Interface 1 : length null
        WAN Miniport (L2TP) : length null
        WAN Miniport (SSTP) : length null
        WAN Miniport (IKEv2) : length null
        WAN Miniport (PPTP) : length null
        WAN Miniport (PPPOE) : length null
        WAN Miniport (IP) : length 0
        WAN Miniport (IPv6) : length 0
        WAN Miniport (Network Monitor) : length 0
        Microsoft Kernel Debug Network Adapter : length 0
        RAS Async Adapter : length null
        Oracle VM Virtual Ethernet Adapter : length 6
        Oracle VM Virtual Ethernet Adapter #2 : length 6
        Microsoft ISATAP Adapter #3 : length null
        WAN Miniport (IP)-WFP Native MAC Layer LightWeight Filter-0000 : length 0
        WAN Miniport (IP)-QoS Packet Scheduler-0000 : length 0
        WAN Miniport (IPv6)-WFP Native MAC Layer LightWeight Filter-0000 : length 0
        WAN Miniport (IPv6)-QoS Packet Scheduler-0000 : length 0
        WAN Miniport (Network Monitor)-WFP Native MAC Layer LightWeight Filter-0000 : length 0
        WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000 : length 0
        Oracle VM Virtual Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 : length 6
        Oracle VM Virtual Ethernet Adapter-QoS Packet Scheduler-0000 : length 6
        Oracle VM Virtual Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 : length 6

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                chegar Chris Hegarty
                Reporter:
                chegar Chris Hegarty
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: