not skipping loopback devices
authorMatthias Wachs <wachs@net.in.tum.de>
Thu, 15 Jul 2010 09:31:18 +0000 (09:31 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Thu, 15 Jul 2010 09:31:18 +0000 (09:31 +0000)
src/transport/Makefile.am
src/transport/plugin_transport_http.c
src/transport/test_plugin_transport_http.c
src/transport/test_transport_api_reliability.c

index 0eba52a6d8234b240edaced60495d9fa8b90b0d7..c3e7227235756219ec5b49aacba716a6ffb969aa 100644 (file)
@@ -134,6 +134,8 @@ check_PROGRAMS = \
  test_transport_api_udp_nat \
  test_transport_api_reliability_tcp \
  test_transport_api_reliability_tcp_nat \
+ test_transport_api_reliability_http \
+ test_transport_api_reliability_udp \ 
  test_transport_api_http
 # TODO: add tests for nat, etc.
 
@@ -172,6 +174,18 @@ test_transport_api_reliability_tcp_nat_LDADD = \
  $(top_builddir)/src/transport/libgnunettransport.la \
  $(top_builddir)/src/util/libgnunetutil.la 
 
+test_transport_api_reliability_udp_SOURCES = \
+ test_transport_api_reliability.c
+test_transport_api_reliability_udp_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la   
+test_transport_api_reliability_http_SOURCES = \
+ test_transport_api_reliability.c
+test_transport_api_reliability_http_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la   
+
 test_transport_api_udp_SOURCES = \
  test_transport_api.c
 test_transport_api_udp_LDADD = \
index 418402aa1ffb064f911d48db5c9d2112b7b55ac1..d654a0c82837940556620bcd2092e140b1c9d567 100644 (file)
@@ -39,7 +39,6 @@
 #include "microhttpd.h"
 #include <curl/curl.h>
 
-
 #define DEBUG_CURL GNUNET_NO
 #define DEBUG_HTTP GNUNET_NO
 #define DEBUG_CONNECTIONS GNUNET_NO
@@ -1891,10 +1890,11 @@ http_plugin_address_suggested (void *cls,
   if (addrlen == sizeof (struct IPv4HttpAddress))
     {
       v4 = (struct IPv4HttpAddress *) addr;
+      /* Not skipping loopback
       if (INADDR_LOOPBACK == ntohl(v4->ipv4_addr))
       {
         return GNUNET_SYSERR;
-      }
+      } */
       port = ntohs (v4->u_port);
       if (port != plugin->port_inbound)
       {
@@ -1998,11 +1998,13 @@ process_interfaces (void *cls,
   if (af == AF_INET)
     {
       t4 = GNUNET_malloc(sizeof(struct IPv4HttpAddress));
+      /* Not skipping loopback addresses
       if (INADDR_LOOPBACK == ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr))
       {
-        /* skip loopback addresses */
+
         return GNUNET_OK;
       }
+      */
       t4->ipv4_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr;
       t4->u_port = htons (plugin->port_inbound);
       plugin->env->notify_address(plugin->env->cls,"http",t4, sizeof (struct IPv4HttpAddress), GNUNET_TIME_UNIT_FOREVER_REL);
@@ -2016,17 +2018,20 @@ process_interfaces (void *cls,
           /* skip link local addresses */
           return GNUNET_OK;
         }
+      /* Not skipping loopback addresses
       if (IN6_IS_ADDR_LOOPBACK (&((struct sockaddr_in6 *) addr)->sin6_addr))
         {
-          /* skip loopback addresses */
+
           return GNUNET_OK;
         }
+      */
       memcpy (&t6->ipv6_addr,
               &((struct sockaddr_in6 *) addr)->sin6_addr,
               sizeof (struct in6_addr));
       t6->u6_port = htons (plugin->port_inbound);
       plugin->env->notify_address(plugin->env->cls,"http",t6,sizeof (struct IPv6HttpAddress) , GNUNET_TIME_UNIT_FOREVER_REL);
     }
+  return GNUNET_NO;
   return GNUNET_OK;
 }
 
index 97817229a1e3c76f5409c2cdc6e12acbdb56ecc3..db24628f6bf42c53bad8bce5a17d0fc8cf8e3ac6 100644 (file)
@@ -41,6 +41,8 @@
 #include "gnunet_statistics_service.h"
 #include "transport.h"
 #include <curl/curl.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #define VERBOSE GNUNET_YES
 #define DEBUG GNUNET_NO
@@ -1252,9 +1254,9 @@ run (void *cls,
   GNUNET_assert (GNUNET_SYSERR == suggest_res);
 
   /* Suggesting addresses with wrong address*/
-  failing_addr.ipv4_addr = htonl(INADDR_LOOPBACK);
+  failing_addr.ipv4_addr = htonl(0xffc00000);
   failing_addr.u_port = htons(12389);
-  suggest_res = api->check_address (api->cls,&failing_addr,sizeof (struct IPv4HttpAddress));
+  suggest_res = api->check_address (api->cls,&failing_addr,100);
   GNUNET_assert (GNUNET_SYSERR == suggest_res);
 
   /* test sending to client */
index c80a1e3281fbf998c74e638858f2255d22c458ad..a7ab6407d3b88640f3e6ca371f92784f72ca53ed 100644 (file)
@@ -80,6 +80,8 @@ static int is_tcp_nat;
 
 static int is_http;
 
+static int is_udp;
+
 static int connected;
 
 static unsigned long long total_bytes;
@@ -447,6 +449,11 @@ run (void *cls,
       setup_peer (&p1, "test_transport_api_http_peer1.conf");
       setup_peer (&p2, "test_transport_api_http_peer2.conf");
     }
+  else if (is_udp)
+    {
+      setup_peer (&p1, "test_transport_api_udp_peer1.conf");
+      setup_peer (&p2, "test_transport_api_udp_peer2.conf");
+    }
   else if (is_tcp_nat)
     {
       setup_peer (&p1, "test_transport_api_tcp_nat_peer1.conf");
@@ -507,6 +514,10 @@ main (int argc, char *argv[])
     {
       is_http = GNUNET_YES;
     }
+  else if (strstr(argv[0], "udp") != NULL)
+    {
+      is_udp = GNUNET_YES;
+    }
   GNUNET_log_setup ("test-transport-api-reliability",
 #if VERBOSE
                     "DEBUG",