File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
core/src/main/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,10 @@ private[spark] object Utils extends Logging {
493493 if (address.isLoopbackAddress) {
494494 // Address resolves to something like 127.0.1.1, which happens on Debian; try to find
495495 // a better address using the local network interfaces
496- for (ni <- NetworkInterface .getNetworkInterfaces) {
496+ // getNetworkInterfaces returns ifs in reverse order compared to ifconfig output order
497+ // on unix-like system. On windows, it returns in index order.
498+ // It's more proper to pick ip address following the ifconfig output order
499+ for (ni <- NetworkInterface .getNetworkInterfaces.toList.reverse) {
497500 for (addr <- ni.getInetAddresses if ! addr.isLinkLocalAddress &&
498501 ! addr.isLoopbackAddress && addr.isInstanceOf [Inet4Address ]) {
499502 // We've found an address that looks reasonable!
You can’t perform that action at this time.
0 commit comments