From 2be7b466091f197f80e903656c30f5b8f9c2af0b Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Mon, 20 Jan 2020 15:19:46 +0100
Subject: [PATCH] query loopback in all cases.

---
 new_discovery.c | 24 +-----------------------
 old_discovery.c | 25 ++-----------------------
 2 files changed, 3 insertions(+), 46 deletions(-)

diff --git a/new_discovery.c b/new_discovery.c
index 3fba2ea..45b2a60 100644
--- a/new_discovery.c
+++ b/new_discovery.c
@@ -72,35 +72,13 @@ void new_discovery() {
     getifaddrs(&addrs);
     ifa = addrs;
 
-//
-//  count number of "up and running" interfaces
-//
-    int num_up_and_running = 0;
-    while (ifa) {
-      if (ifa->ifa_addr) {
-        if (ifa->ifa_addr->sa_family == AF_INET
-            && (ifa->ifa_flags & IFF_UP) == IFF_UP
-            && (ifa->ifa_flags & IFF_RUNNING) == IFF_RUNNING) {
-                num_up_and_running++;
-        }
-      }
-      ifa=ifa->ifa_next;
-    }
-
-    ifa=addrs;
     while (ifa) {
         g_main_context_iteration(NULL, 0);
         if (ifa->ifa_addr) {
           if(ifa->ifa_addr->sa_family == AF_INET &&
             (ifa->ifa_flags&IFF_UP)==IFF_UP &&
             (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING) {
-//
-// if this is the loopback interface, do the discover only if
-// there is at most one interface
-//
-                if ((ifa->ifa_flags & IFF_LOOPBACK) != IFF_LOOPBACK
-                    || num_up_and_running <= 1)
-                                new_discover(ifa);
+		new_discover(ifa);
           }
         }
         ifa = ifa->ifa_next;
diff --git a/old_discovery.c b/old_discovery.c
index 82b4230..694053b 100644
--- a/old_discovery.c
+++ b/old_discovery.c
@@ -515,35 +515,14 @@ void old_discovery() {
 fprintf(stderr,"old_discovery\n");
     getifaddrs(&addrs);
     ifa = addrs;
-//
-//  count number of "up and running" interfaces
-//
-    int num_up_and_running = 0;
-    while (ifa) {
-      if (ifa->ifa_addr) {
-	if (ifa->ifa_addr->sa_family == AF_INET
-	    && (ifa->ifa_flags & IFF_UP) == IFF_UP
-            && (ifa->ifa_flags & IFF_RUNNING) == IFF_RUNNING) {
-		num_up_and_running++;
-	}
-      }
-      ifa=ifa->ifa_next;
-    }
-	
-    ifa=addrs;
+
     while (ifa) {
         g_main_context_iteration(NULL, 0);
         if (ifa->ifa_addr) {
  	  if(ifa->ifa_addr->sa_family == AF_INET &&
             (ifa->ifa_flags&IFF_UP)==IFF_UP &&
             (ifa->ifa_flags&IFF_RUNNING)==IFF_RUNNING) {
-//
-// if this is the loopback interface, do the discover only if
-// there is at most one interface
-//
-		if ((ifa->ifa_flags & IFF_LOOPBACK) != IFF_LOOPBACK
-		    || num_up_and_running <= 1)
-				discover(ifa);
+		discover(ifa);
 	  }
         }
         ifa = ifa->ifa_next;
-- 
2.45.2