]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add Carl Johnson's suggestion for omitting dummy internet interfaces.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 5 Jan 2026 21:19:11 +0000 (21:19 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 5 Jan 2026 21:19:11 +0000 (21:19 +0000)
common.c

index 84de277a3744a14bc4d5380ade19925dd086eb56..e552af4c557d6307abdc9b84c0425a673c368736 100644 (file)
--- a/common.c
+++ b/common.c
@@ -51,6 +51,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <net/if.h>
 #include <ifaddrs.h>
 
 #ifdef COMPILE_FOR_LINUX
@@ -2329,7 +2330,12 @@ int get_device_id(uint8_t *id, int int_length) {
 #ifdef AF_PACKET
         if ((ifa->ifa_addr) && (ifa->ifa_addr->sa_family == AF_PACKET)) {
           struct sockaddr_ll *s = (struct sockaddr_ll *)ifa->ifa_addr;
-          if ((strcmp(ifa->ifa_name, "lo") != 0)) {
+          if (
+              ((ifa->ifa_flags & IFF_UP) != 0) && 
+              ((ifa->ifa_flags & IFF_RUNNING) != 0) && 
+              ((ifa->ifa_flags & IFF_LOOPBACK) == 0) && 
+              (ifa->ifa_addr != 0)
+            ) {
             found = 1;
             response = 0;
             for (i = 0; ((i < s->sll_halen) && (i < int_length)); i++) {