adding detection for AF_UNIX
authorMatthias Wachs <wachs@net.in.tum.de>
Wed, 14 Dec 2011 13:31:59 +0000 (13:31 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Wed, 14 Dec 2011 13:31:59 +0000 (13:31 +0000)
src/ats/ats_api_scheduling.c

index 7ac53f12f245d9d783af4bf636f7507612f9da0c..8ee3fcee37bdb49da4621fd4718ef09cea2395ce 100644 (file)
@@ -761,6 +761,11 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru
   struct ATS_Network * cur = sh->net_head;
   int type = GNUNET_ATS_NET_UNSPECIFIED;
 
+  if  (addr->sa_family == AF_UNIX)
+  {
+    type = GNUNET_ATS_NET_LOOPBACK;
+  }
+
   /* IPv4 loopback check */
   if  (addr->sa_family == AF_INET)
   {
@@ -830,10 +835,31 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru
     cur = cur->next;
   }
 
-  /* local network found for this address, default: WAN */
+  /* no local network found for this address, default: WAN */
   if (type == GNUNET_ATS_NET_UNSPECIFIED)
     type = GNUNET_ATS_NET_WAN;
 
+#if VERBOSE
+  char * range;
+  switch (type) {
+    case GNUNET_ATS_NET_WAN:
+        range = "WAN";
+      break;
+    case GNUNET_ATS_NET_LAN:
+        range = "LAN";
+      break;
+    case GNUNET_ATS_NET_LOOPBACK:
+        range = "LOOPBACK";
+      break;
+    default:
+
+      break;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "`%s' is in network `%s'\n",
+        GNUNET_a2s ((const struct sockaddr *) addr, addrlen),
+        range);
+#endif
+
   ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
   ats.value = htonl (type);
   return ats;