Skip to content
Browse files

Merge pull request #107 from thepadawan42/fixnetwork

Fixnetwork: Incorrect server IP address when starting PMS by launching PMS.exe or PMS.bat
  • Loading branch information...
2 parents df4f6d9 + 16eb7db commit 9dffdac4f402209bc626c1b439f40096bcf4bf7f @chocolateboy chocolateboy committed
View
4 src/main/java/net/pms/configuration/PmsConfiguration.java
@@ -1803,11 +1803,11 @@ public boolean getSkipLoopFilterEnabled() {
* and typically exclude the number at the end of the interface name.
* <p>
* Default is to skip the interfaces created by Virtualbox, OpenVPN and
- * Parallels: "tap,vmnet,vnic".
+ * Parallels: "tap,vmnet,vnic,virtualbox".
* @return The string of network interface names to skip.
*/
public List<String> getSkipNetworkInterfaces() {
- return getStringList(KEY_SKIP_NETWORK_INTERFACES, "tap,vmnet,vnic");
+ return getStringList(KEY_SKIP_NETWORK_INTERFACES, "tap,vmnet,vnic,virtualbox");
}
public void setSkipLoopFilterEnabled(boolean value) {
View
10 src/main/java/net/pms/network/NetworkConfiguration.java
@@ -272,10 +272,12 @@ private void checkNetworkInterface(NetworkInterface networkInterface, String par
LOGGER.trace("sub address for {} is {}", networkInterface.getName(), subAddress);
boolean foundAddress = false;
- for (InterfaceAddress ifaceAddr : networkInterface.getInterfaceAddresses()) {
- if (ifaceAddr != null) {
- InetAddress address = ifaceAddr.getAddress();
- LOGGER.trace("checking {} from {} on {}", new Object[] { address, ifaceAddr, networkInterface.getName() });
+ // networkInterface.getInterfaceAddresses() returns 'null' on some adapters if
+ // the parameter 'java.net.preferIPv4Stack=true' is passed to the JVM
+ // Use networkInterface.getInetAddresses() instead
+ for (InetAddress address : Collections.list(networkInterface.getInetAddresses())) {
+ if (address != null) {
+ LOGGER.trace("checking {} on {}", new Object[] { address, networkInterface.getName() });
if (isRelevantAddress(address)) {
// Avoid adding duplicates

0 comments on commit 9dffdac

Please sign in to comment.
Something went wrong with that request. Please try again.