Skip to content

Commit

Permalink
Log specific reasons that interfaces may be skipped during UPnP scan
Browse files Browse the repository at this point in the history
  • Loading branch information
kwvanderlinde committed Sep 12, 2024
1 parent c58a065 commit 4a3d5ad
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/main/java/net/rptools/maptool/util/UPnPUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -48,7 +49,23 @@ public static boolean findIGDs() {
while (e.hasMoreElements()) {
NetworkInterface ni = e.nextElement();
try {
if (ni.isUp() && !ni.isLoopback() && !ni.isVirtual()) {
var addresses = Collections.list(ni.getInetAddresses());
if (ni.isLoopback()) {
log.info(
"UPnP: Rejecting interface '{}' [{}] as it is a loopback",
ni.getDisplayName(),
addresses);
} else if (ni.isVirtual()) {
log.info(
"UPnP: Rejecting interface '{}' [{}] as it is virtual",
ni.getDisplayName(),
addresses);
} else if (!ni.isUp()) {
log.info(
"UPnP: Rejecting interface '{}' [{}] as it is not up",
ni.getDisplayName(),
addresses);
} else {
int found = 0;
try {
log.info(
Expand Down

0 comments on commit 4a3d5ad

Please sign in to comment.