gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7888 - GNUnet/src/util/os


From: gnunet
Subject: [GNUnet-SVN] r7888 - GNUnet/src/util/os
Date: Sat, 15 Nov 2008 04:20:54 -0700 (MST)

Author: holindho
Date: 2008-11-15 04:20:54 -0700 (Sat, 15 Nov 2008)
New Revision: 7888

Modified:
   GNUnet/src/util/os/osconfig.c
Log:
better interface list alternative


Modified: GNUnet/src/util/os/osconfig.c
===================================================================
--- GNUnet/src/util/os/osconfig.c       2008-11-15 11:06:50 UTC (rev 7887)
+++ GNUnet/src/util/os/osconfig.c       2008-11-15 11:20:54 UTC (rev 7888)
@@ -42,6 +42,29 @@
 {
 #ifdef MINGW
   ListNICs (proc, cls);
+#elif HAVE_GETIFADDRS && HAVE_FREEIFADDRS
+  struct ifaddrs *ifa_first;
+
+  if (getifaddrs (&ifa_first) == 0)
+    {
+      struct ifaddrs *ifa_ptr;
+
+      ifa_ptr = ifa_first;
+      for (ifa_ptr = ifa_first; ifa_ptr != NULL; ifa_ptr = ifa_ptr->ifa_next)
+        {
+          if (ifa_ptr->ifa_name != NULL &&
+              ifa_ptr->ifa_addr != NULL && (ifa_ptr->ifa_flags & IFF_UP) != 0)
+            {
+              if (ifa_ptr->ifa_addr->sa_family != AF_INET)
+                continue;
+              if (GNUNET_OK != proc (ifa_ptr->ifa_name, strcmp
+                  (ifa_ptr->ifa_name, GNUNET_DEFAULT_INTERFACE) == 0, cls))
+                break;
+            }
+        }
+      freeifaddrs (ifa_first);
+    }
+
 #else
   char entry[11], *dst;
   FILE *f;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]