Skip to content

Commit 84852b5

Browse files
committed
Avoid listing unconnectable NICs from NetworkUtils
1 parent 38a7502 commit 84852b5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

java/client/src/org/openqa/selenium/net/DefaultNetworkInterfaceProvider.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ public DefaultNetworkInterfaceProvider() {
6666
while (interfaces.hasMoreElements()) {
6767
java.net.NetworkInterface jvmNic = interfaces.nextElement();
6868

69+
try {
70+
// If the NIC isn't a loopback device and also lacks a hardware
71+
// address, it's likely to be impossible to connect to. We see
72+
// this with `utun` NICS on macOS. Skip these from the list of
73+
// cached NICs.
74+
if (!jvmNic.isLoopback() && jvmNic.getHardwareAddress() == null) {
75+
continue;
76+
}
77+
} catch (SocketException e) {
78+
continue;
79+
}
80+
6981
NetworkInterface nic = new NetworkInterface(jvmNic);
7082
result.add(nic);
7183

0 commit comments

Comments
 (0)