You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@omid.apache.org by ja...@apache.org on 2018/09/22 15:56:16 UTC

incubator-omid git commit: [OMID-97] New MacBooks include a TouchBar that has a usb link called iBridge. When choosing a network interface, Omid accidentally chooses this iBridge instead of choosing the right network interface.

Repository: incubator-omid
Updated Branches:
  refs/heads/phoenix-integration 7b018decd -> 240e6ddd2


[OMID-97] New MacBooks include a TouchBar that has a usb link called iBridge. When choosing a network interface, Omid accidentally chooses this iBridge instead of choosing the right network interface.


Project: http://git-wip-us.apache.org/repos/asf/incubator-omid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-omid/commit/240e6ddd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-omid/tree/240e6ddd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-omid/diff/240e6ddd

Branch: refs/heads/phoenix-integration
Commit: 240e6ddd25c49079d97041f08d453616d2f70ea1
Parents: 7b018de
Author: Ohad Shacham <oh...@yahoo-inc.com>
Authored: Sun Apr 29 12:47:25 2018 +0300
Committer: James Taylor <ja...@apache.org>
Committed: Sat Sep 22 08:55:24 2018 -0700

----------------------------------------------------------------------
 common/src/main/java/org/apache/omid/NetworkUtils.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-omid/blob/240e6ddd/common/src/main/java/org/apache/omid/NetworkUtils.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/omid/NetworkUtils.java b/common/src/main/java/org/apache/omid/NetworkUtils.java
index 09bd626..751a733 100644
--- a/common/src/main/java/org/apache/omid/NetworkUtils.java
+++ b/common/src/main/java/org/apache/omid/NetworkUtils.java
@@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory;
 
 import java.net.NetworkInterface;
 import java.net.SocketException;
+import java.util.Collections;
 import java.util.Enumeration;
 
 public class NetworkUtils {
@@ -36,11 +37,14 @@ public class NetworkUtils {
         try {
             Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
             while (networkInterfaces.hasMoreElements()) {
-                String name = networkInterfaces.nextElement().getDisplayName();
+                NetworkInterface nextElement = networkInterfaces.nextElement();
+                String name = nextElement.getDisplayName();
                 LOG.info("Iterating over network interfaces, found '{}'", name);
-                if (name.startsWith(MAC_TSO_NET_IFACE_PREFIX) || name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) {
-                    return name;
-                }
+                boolean hasInet = Collections.list(nextElement.getInetAddresses()).size() > 1; // Checking that inet exists, to avoid taking iBridge
+                if ((name.startsWith(MAC_TSO_NET_IFACE_PREFIX) && hasInet ) ||
+                        name.startsWith(LINUX_TSO_NET_IFACE_PREFIX)) {
+                  return name;
+              }
             }
         } catch (SocketException ignored) {
             throw new RuntimeException("Failed to find any network interfaces", ignored);