FULL PRODUCT VERSION :
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
But happens also on:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b97)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b39, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
EXTRA RELEVANT SYSTEM CONFIGURATION :
This network adapters are installed (ipconfig /all):
# Intel(R) 82579LM Gigabit Network Connection
# VirtualBox Host-Only Ethernet Adapter
# Check Point Virtual Network Adapter For Endpoint VPN Client
# PdaNet Broadband Adapter
A DESCRIPTION OF THE PROBLEM :
All NetworktInterfaces retrieved by NetworkInterfaces.getNetworkInterfaces() return the same hardware address (getHardwareAddress()), which is always one of the "real" Mac addresses of the existing network interfaces.
Which one depends on the VM.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
# Get all NetworkInterfaces using NetworkInterface.getNetworkInterfaces()
# Iterate over them
# Print out the MAC address calling NetworkInterface#getHardwareAddress() if it is not null
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should output the (different) Mac addresses of all available network interfaces/cards. (see ipconfig /all)
ACTUAL -
The program prints the same address for all network interfaces found.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
public class ListMACs {
public static void main(String[] args) throws SocketException {
for (NetworkInterface ni : Collections.list(NetworkInterface
.getNetworkInterfaces())) {
if (ni.getHardwareAddress() != null) {
System.out.println(ni.getDisplayName() + ": " + ni.getHardwareAddress());
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Call the windows-specific command "ipconfig /all", parse the output and extract the Mac-addresses from there. Not very convenient...
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
But happens also on:
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b97)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b39, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
EXTRA RELEVANT SYSTEM CONFIGURATION :
This network adapters are installed (ipconfig /all):
# Intel(R) 82579LM Gigabit Network Connection
# VirtualBox Host-Only Ethernet Adapter
# Check Point Virtual Network Adapter For Endpoint VPN Client
# PdaNet Broadband Adapter
A DESCRIPTION OF THE PROBLEM :
All NetworktInterfaces retrieved by NetworkInterfaces.getNetworkInterfaces() return the same hardware address (getHardwareAddress()), which is always one of the "real" Mac addresses of the existing network interfaces.
Which one depends on the VM.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
# Get all NetworkInterfaces using NetworkInterface.getNetworkInterfaces()
# Iterate over them
# Print out the MAC address calling NetworkInterface#getHardwareAddress() if it is not null
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should output the (different) Mac addresses of all available network interfaces/cards. (see ipconfig /all)
ACTUAL -
The program prints the same address for all network interfaces found.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
public class ListMACs {
public static void main(String[] args) throws SocketException {
for (NetworkInterface ni : Collections.list(NetworkInterface
.getNetworkInterfaces())) {
if (ni.getHardwareAddress() != null) {
System.out.println(ni.getDisplayName() + ": " + ni.getHardwareAddress());
}
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Call the windows-specific command "ipconfig /all", parse the output and extract the Mac-addresses from there. Not very convenient...
- duplicates
-
JDK-8021372 NetworkInterface.getNetworkInterfaces() returns duplicate hardware address
- Closed