(no commit message)
authorMatthias Wachs <wachs@net.in.tum.de>
Fri, 16 Jul 2010 15:31:37 +0000 (15:31 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Fri, 16 Jul 2010 15:31:37 +0000 (15:31 +0000)
src/transport/Makefile.am
src/transport/plugin_transport_http.c
src/transport/test_plugin_transport_data_http.conf
src/transport/test_transport_api_http_peer1.conf
src/transport/test_transport_api_http_peer2.conf
src/transport/test_transport_api_rel_http_peer1.conf
src/transport/test_transport_api_rel_http_peer2.conf
src/transport/test_transport_api_reliability.c

index 2fe57c9db2c06175d90c04faa44d568d5fdefec2..4560782d29c2efa64a8eeeca2ab3bec54bb55ca3 100644 (file)
@@ -146,6 +146,7 @@ TESTS = \
  test_transport_api_udp_nat \
  test_plugin_transport_http \
  test_transport_api_http \
+ test_transport_api_reliability_http \
  test_transport_api_reliability_tcp \
  test_transport_api_reliability_tcp_nat 
 
@@ -224,4 +225,8 @@ EXTRA_DIST = \
   test_transport_api_tcp_nat_peer1.conf \
   test_transport_api_tcp_nat_peer2.conf \
   test_plugin_transport_data.conf \
+  test_transport_api_http_peer1.conf \
+  test_transport_api_http_peer2.conf \
+  test_transport_api_rel_http_peer1.conf \
+  test_transport_api_rel_http_peer2.conf \
   test_plugin_transport_data_http.conf
index 55a4e42512b0775a7a8e8870393fce374e59f168..5cd611d1f1b5783c1434a90b94b9c1f7960f4180 100644 (file)
@@ -40,7 +40,7 @@
 #include "microhttpd.h"
 #include <curl/curl.h>
 
-#define DEBUG_HTTP GNUNET_YES
+#define DEBUG_HTTP GNUNET_NO
 #define DEBUG_CURL GNUNET_NO
 #define DEBUG_CONNECTIONS GNUNET_NO
 #define DEBUG_SESSION_SELECTION GNUNET_NO
@@ -360,6 +360,7 @@ struct Plugin
   struct sockaddr_in6 * bind6_address;
   char * bind_hostname;
   int use_ipv6;
+  int use_ipv4;
 };
 
 
@@ -545,10 +546,9 @@ process_interfaces (void *cls,
 
   GNUNET_assert(cls !=NULL);
   af = addr->sa_family;
-  if ((af == AF_INET) && (plugin->bind6_address == NULL))
+  if ((af == AF_INET) && (plugin->use_ipv4 == GNUNET_YES) && (plugin->bind6_address == NULL))
     {
          struct in_addr bnd_cmp = ((struct sockaddr_in *) addr)->sin_addr;
-
       t4 = GNUNET_malloc(sizeof(struct IPv4HttpAddress));
       /* Not skipping loopback addresses
       if (INADDR_LOOPBACK == ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr))
@@ -572,7 +572,7 @@ process_interfaces (void *cls,
       }
       GNUNET_free (t4);
     }
-  else if ((af == AF_INET6) && (plugin->use_ipv6==GNUNET_YES) && (plugin->bind4_address == NULL))
+  else if ((af == AF_INET6) && (plugin->use_ipv6 == GNUNET_YES)  && (plugin->bind4_address == NULL))
     {
          struct in6_addr bnd_cmp6 = ((struct sockaddr_in6 *) addr)->sin6_addr;
       t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress));
@@ -602,7 +602,6 @@ process_interfaces (void *cls,
       }
       GNUNET_free (t6);
     }
-  //return GNUNET_NO;
   return GNUNET_OK;
 }
 
@@ -2258,6 +2257,7 @@ libgnunet_plugin_transport_http_init (void *cls)
   plugin->peers = NULL;
   plugin->bind4_address = NULL;
   plugin->use_ipv6  = GNUNET_YES;
+  plugin->use_ipv4  = GNUNET_YES;
 
   api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
   api->cls = plugin;
@@ -2277,9 +2277,14 @@ libgnunet_plugin_transport_http_init (void *cls)
          plugin->use_ipv6 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
                                                                                                           "transport-http",
                                                                                                           "USE_IPv6");
-
-
-
+    }
+  /* Reading port number from config file */
+  if (GNUNET_CONFIGURATION_have_value (env->cfg,
+                                                                  "transport-http", "USE_IPv4"))
+    {
+         plugin->use_ipv4 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
+                                                                                                          "transport-http",
+                                                                                                          "USE_IPv4");
     }
   /* Reading port number from config file */
   if ((GNUNET_OK !=
@@ -2298,8 +2303,8 @@ libgnunet_plugin_transport_http_init (void *cls)
     }
 
   /* Reading ipv4 addresse to bind to from config file */
-  if (GNUNET_CONFIGURATION_have_value (env->cfg,
-                                                                  "transport-http", "BINDTO4"))
+  if ((plugin->use_ipv4==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
+                                                                  "transport-http", "BINDTO4")))
   {
          GNUNET_break (GNUNET_OK ==
                                        GNUNET_CONFIGURATION_get_value_string (env->cfg,
@@ -2310,8 +2315,6 @@ libgnunet_plugin_transport_http_init (void *cls)
          plugin->bind4_address->sin_family = AF_INET;
          plugin->bind4_address->sin_port = htons (port);
 
-         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v4 Hostname `%s'!\n",plugin->bind_hostname);
-
          if (inet_pton(AF_INET,plugin->bind_hostname, &plugin->bind4_address->sin_addr)<=0)
          {
                  GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
@@ -2326,8 +2329,8 @@ libgnunet_plugin_transport_http_init (void *cls)
   }
 
   /* Reading ipv4 addresse to bind to from config file */
-  if (GNUNET_CONFIGURATION_have_value (env->cfg,
-                                                                  "transport-http", "BINDTO6"))
+  if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
+                                                                  "transport-http", "BINDTO6")))
   {
          GNUNET_break (GNUNET_OK ==
                                        GNUNET_CONFIGURATION_get_value_string (env->cfg,
@@ -2339,8 +2342,6 @@ libgnunet_plugin_transport_http_init (void *cls)
          plugin->bind6_address->sin6_family = AF_INET6;
          plugin->bind6_address->sin6_port = htons (port);
 
-         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v6 Hostname `%s'!\n",plugin->bind_hostname);
-
       if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
          {
                  GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
@@ -2351,13 +2352,7 @@ libgnunet_plugin_transport_http_init (void *cls)
                  GNUNET_free(plugin->bind_hostname);
                  plugin->bind_hostname = NULL;
                  plugin->bind6_address = NULL;
-
          }
-
-      char * tmp = GNUNET_malloc(50);
-      inet_ntop(AF_INET6,&plugin->bind6_address->sin6_addr,tmp,50);
-         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v6 Hostname reverse `%s'!\n",tmp);
-         GNUNET_free(tmp);
   }
 
   GNUNET_assert ((port > 0) && (port <= 65535));
@@ -2383,7 +2378,7 @@ libgnunet_plugin_transport_http_init (void *cls)
                                        MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
                                        MHD_OPTION_END);
   }
-  if ((plugin->http_server_daemon_v4 == NULL) && (port != 0))
+  if ((plugin->http_server_daemon_v4 == NULL) && (plugin->use_ipv4 == GNUNET_YES) && (port != 0))
   {
   plugin->http_server_daemon_v4 = MHD_start_daemon (
 #if DEBUG_CONNECTIONS
index d03f4e840a0d7569871fbd01a3a47ee4323bd298..0c5bbcf26fef52fa5b8c1359bf689df179dd2218 100644 (file)
@@ -8,8 +8,9 @@ WEAKRANDOM = YES
 [transport-http]
 PORT = 12389
 DEBUG = NO
-USE_IPv6 = YES
+#USE_IPv4 = NO
 #USE_IPv6 = NO
+USE_IPv6 = YES
 #BINDTO4 = 127.0.0.1
 #BINDTO6 = ::1
 
index b7e8fb53692efb9207751d0ef80e902dd7b6c3de..18513d8fc5f9ff80ae21423a2ee064fa52a2f098 100644 (file)
@@ -1,8 +1,9 @@
 [transport-http]
 PORT = 12389
 DEBUG = NO
-USE_IPv6 = NO
-BINDTO4 = 127.0.0.1
+USE_IPv6 = YES
+USE_IPv4 = YES
+#BINDTO4 = 127.0.0.1
 #BINDTO6 = ::1
 
 
@@ -37,7 +38,7 @@ MINIMUM-FRIENDS = 0
 [transport]
 PLUGINS = http
 #PLUGINS = tcp http
-DEBUG = NO
+DEBUG = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
 NEIGHBOUR_LIMIT = 50
@@ -106,6 +107,5 @@ WEAKRANDOM = YES
 HOSTKEY = $SERVICEHOME/.hostkey
 
 [PATHS]
-DEFAULTCONFIG = test_transport_api_http_peer1.conf
 SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
 
index 6cdd84fe75b8c6063c08a88b108d38fbc23a2556..940931b4a853d27b2002708da3c0a5e28d42b84e 100644 (file)
@@ -1,8 +1,9 @@
 [transport-http]
 PORT = 22368
 DEBUG = NO
-USE_IPv6 = NO
-BINDTO4 = 127.0.0.1
+USE_IPv6 = YES
+USE_IPv4 = YES
+#BINDTO4 = 127.0.0.1
 #BINDTO6 = ::1
 
 [fs]
@@ -36,7 +37,7 @@ MINIMUM-FRIENDS = 0
 [transport]
 PLUGINS = http
 #PLUGINS = tcp http
-DEBUG = NO
+DEBUG = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
 NEIGHBOUR_LIMIT = 50
@@ -110,6 +111,5 @@ WEAKRANDOM = YES
 HOSTKEY = $SERVICEHOME/.hostkey
 
 [PATHS]
-DEFAULTCONFIG = test_transport_api_http_peer2.conf
 SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
 
index b7e8fb53692efb9207751d0ef80e902dd7b6c3de..807e491491c0adee10371f829f9e164c76f6ab6a 100644 (file)
@@ -1,11 +1,11 @@
 [transport-http]
 PORT = 12389
 DEBUG = NO
+USE_IPv4 = YES
 USE_IPv6 = NO
 BINDTO4 = 127.0.0.1
 #BINDTO6 = ::1
 
-
 [fs]
 AUTOSTART = NO
 
@@ -37,7 +37,7 @@ MINIMUM-FRIENDS = 0
 [transport]
 PLUGINS = http
 #PLUGINS = tcp http
-DEBUG = NO
+DEBUG = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
 NEIGHBOUR_LIMIT = 50
@@ -106,6 +106,5 @@ WEAKRANDOM = YES
 HOSTKEY = $SERVICEHOME/.hostkey
 
 [PATHS]
-DEFAULTCONFIG = test_transport_api_http_peer1.conf
 SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
 
index 6cdd84fe75b8c6063c08a88b108d38fbc23a2556..7d14e39877028916d69b837a9589407b22269759 100644 (file)
@@ -1,6 +1,7 @@
 [transport-http]
-PORT = 22368
+PORT = 22389
 DEBUG = NO
+USE_IPv4 = YES
 USE_IPv6 = NO
 BINDTO4 = 127.0.0.1
 #BINDTO6 = ::1
@@ -36,7 +37,7 @@ MINIMUM-FRIENDS = 0
 [transport]
 PLUGINS = http
 #PLUGINS = tcp http
-DEBUG = NO
+DEBUG = YES
 ACCEPT_FROM6 = ::1;
 ACCEPT_FROM = 127.0.0.1;
 NEIGHBOUR_LIMIT = 50
@@ -110,6 +111,5 @@ WEAKRANDOM = YES
 HOSTKEY = $SERVICEHOME/.hostkey
 
 [PATHS]
-DEFAULTCONFIG = test_transport_api_http_peer2.conf
 SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
 
index a7ab6407d3b88640f3e6ca371f92784f72ca53ed..dc4867f84312b9aba587526bcc33eb3a424597c0 100644 (file)
@@ -446,8 +446,8 @@ run (void *cls,
     }
   else if (is_http)
     {
-      setup_peer (&p1, "test_transport_api_http_peer1.conf");
-      setup_peer (&p2, "test_transport_api_http_peer2.conf");
+      setup_peer (&p1, "test_transport_api_rel_http_peer1.conf");
+      setup_peer (&p2, "test_transport_api_rel_http_peer2.conf");
     }
   else if (is_udp)
     {