aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-07-16 15:31:37 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-07-16 15:31:37 +0000
commit3519fc71001af482dcfeb34209d6c42cd126dbec (patch)
tree4c4d7b257d992f442198f04df4e8883c22d4171e /src/transport
parentf47e58bcd37ebd0c9382e0893d2045abd2c23b7a (diff)
downloadgnunet-3519fc71001af482dcfeb34209d6c42cd126dbec.tar.gz
gnunet-3519fc71001af482dcfeb34209d6c42cd126dbec.zip
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/Makefile.am5
-rw-r--r--src/transport/plugin_transport_http.c41
-rw-r--r--src/transport/test_plugin_transport_data_http.conf3
-rw-r--r--src/transport/test_transport_api_http_peer1.conf8
-rw-r--r--src/transport/test_transport_api_http_peer2.conf8
-rw-r--r--src/transport/test_transport_api_rel_http_peer1.conf5
-rw-r--r--src/transport/test_transport_api_rel_http_peer2.conf6
-rw-r--r--src/transport/test_transport_api_reliability.c4
8 files changed, 40 insertions, 40 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 2fe57c9db..4560782d2 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -146,6 +146,7 @@ TESTS = \
146 test_transport_api_udp_nat \ 146 test_transport_api_udp_nat \
147 test_plugin_transport_http \ 147 test_plugin_transport_http \
148 test_transport_api_http \ 148 test_transport_api_http \
149 test_transport_api_reliability_http \
149 test_transport_api_reliability_tcp \ 150 test_transport_api_reliability_tcp \
150 test_transport_api_reliability_tcp_nat 151 test_transport_api_reliability_tcp_nat
151 152
@@ -224,4 +225,8 @@ EXTRA_DIST = \
224 test_transport_api_tcp_nat_peer1.conf \ 225 test_transport_api_tcp_nat_peer1.conf \
225 test_transport_api_tcp_nat_peer2.conf \ 226 test_transport_api_tcp_nat_peer2.conf \
226 test_plugin_transport_data.conf \ 227 test_plugin_transport_data.conf \
228 test_transport_api_http_peer1.conf \
229 test_transport_api_http_peer2.conf \
230 test_transport_api_rel_http_peer1.conf \
231 test_transport_api_rel_http_peer2.conf \
227 test_plugin_transport_data_http.conf 232 test_plugin_transport_data_http.conf
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index 55a4e4251..5cd611d1f 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -40,7 +40,7 @@
40#include "microhttpd.h" 40#include "microhttpd.h"
41#include <curl/curl.h> 41#include <curl/curl.h>
42 42
43#define DEBUG_HTTP GNUNET_YES 43#define DEBUG_HTTP GNUNET_NO
44#define DEBUG_CURL GNUNET_NO 44#define DEBUG_CURL GNUNET_NO
45#define DEBUG_CONNECTIONS GNUNET_NO 45#define DEBUG_CONNECTIONS GNUNET_NO
46#define DEBUG_SESSION_SELECTION GNUNET_NO 46#define DEBUG_SESSION_SELECTION GNUNET_NO
@@ -360,6 +360,7 @@ struct Plugin
360 struct sockaddr_in6 * bind6_address; 360 struct sockaddr_in6 * bind6_address;
361 char * bind_hostname; 361 char * bind_hostname;
362 int use_ipv6; 362 int use_ipv6;
363 int use_ipv4;
363}; 364};
364 365
365 366
@@ -545,10 +546,9 @@ process_interfaces (void *cls,
545 546
546 GNUNET_assert(cls !=NULL); 547 GNUNET_assert(cls !=NULL);
547 af = addr->sa_family; 548 af = addr->sa_family;
548 if ((af == AF_INET) && (plugin->bind6_address == NULL)) 549 if ((af == AF_INET) && (plugin->use_ipv4 == GNUNET_YES) && (plugin->bind6_address == NULL))
549 { 550 {
550 struct in_addr bnd_cmp = ((struct sockaddr_in *) addr)->sin_addr; 551 struct in_addr bnd_cmp = ((struct sockaddr_in *) addr)->sin_addr;
551
552 t4 = GNUNET_malloc(sizeof(struct IPv4HttpAddress)); 552 t4 = GNUNET_malloc(sizeof(struct IPv4HttpAddress));
553 /* Not skipping loopback addresses 553 /* Not skipping loopback addresses
554 if (INADDR_LOOPBACK == ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr)) 554 if (INADDR_LOOPBACK == ntohl(((struct sockaddr_in *) addr)->sin_addr.s_addr))
@@ -572,7 +572,7 @@ process_interfaces (void *cls,
572 } 572 }
573 GNUNET_free (t4); 573 GNUNET_free (t4);
574 } 574 }
575 else if ((af == AF_INET6) && (plugin->use_ipv6==GNUNET_YES) && (plugin->bind4_address == NULL)) 575 else if ((af == AF_INET6) && (plugin->use_ipv6 == GNUNET_YES) && (plugin->bind4_address == NULL))
576 { 576 {
577 struct in6_addr bnd_cmp6 = ((struct sockaddr_in6 *) addr)->sin6_addr; 577 struct in6_addr bnd_cmp6 = ((struct sockaddr_in6 *) addr)->sin6_addr;
578 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress)); 578 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress));
@@ -602,7 +602,6 @@ process_interfaces (void *cls,
602 } 602 }
603 GNUNET_free (t6); 603 GNUNET_free (t6);
604 } 604 }
605 //return GNUNET_NO;
606 return GNUNET_OK; 605 return GNUNET_OK;
607} 606}
608 607
@@ -2258,6 +2257,7 @@ libgnunet_plugin_transport_http_init (void *cls)
2258 plugin->peers = NULL; 2257 plugin->peers = NULL;
2259 plugin->bind4_address = NULL; 2258 plugin->bind4_address = NULL;
2260 plugin->use_ipv6 = GNUNET_YES; 2259 plugin->use_ipv6 = GNUNET_YES;
2260 plugin->use_ipv4 = GNUNET_YES;
2261 2261
2262 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 2262 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
2263 api->cls = plugin; 2263 api->cls = plugin;
@@ -2277,9 +2277,14 @@ libgnunet_plugin_transport_http_init (void *cls)
2277 plugin->use_ipv6 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, 2277 plugin->use_ipv6 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2278 "transport-http", 2278 "transport-http",
2279 "USE_IPv6"); 2279 "USE_IPv6");
2280 2280 }
2281 2281 /* Reading port number from config file */
2282 2282 if (GNUNET_CONFIGURATION_have_value (env->cfg,
2283 "transport-http", "USE_IPv4"))
2284 {
2285 plugin->use_ipv4 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2286 "transport-http",
2287 "USE_IPv4");
2283 } 2288 }
2284 /* Reading port number from config file */ 2289 /* Reading port number from config file */
2285 if ((GNUNET_OK != 2290 if ((GNUNET_OK !=
@@ -2298,8 +2303,8 @@ libgnunet_plugin_transport_http_init (void *cls)
2298 } 2303 }
2299 2304
2300 /* Reading ipv4 addresse to bind to from config file */ 2305 /* Reading ipv4 addresse to bind to from config file */
2301 if (GNUNET_CONFIGURATION_have_value (env->cfg, 2306 if ((plugin->use_ipv4==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
2302 "transport-http", "BINDTO4")) 2307 "transport-http", "BINDTO4")))
2303 { 2308 {
2304 GNUNET_break (GNUNET_OK == 2309 GNUNET_break (GNUNET_OK ==
2305 GNUNET_CONFIGURATION_get_value_string (env->cfg, 2310 GNUNET_CONFIGURATION_get_value_string (env->cfg,
@@ -2310,8 +2315,6 @@ libgnunet_plugin_transport_http_init (void *cls)
2310 plugin->bind4_address->sin_family = AF_INET; 2315 plugin->bind4_address->sin_family = AF_INET;
2311 plugin->bind4_address->sin_port = htons (port); 2316 plugin->bind4_address->sin_port = htons (port);
2312 2317
2313 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v4 Hostname `%s'!\n",plugin->bind_hostname);
2314
2315 if (inet_pton(AF_INET,plugin->bind_hostname, &plugin->bind4_address->sin_addr)<=0) 2318 if (inet_pton(AF_INET,plugin->bind_hostname, &plugin->bind4_address->sin_addr)<=0)
2316 { 2319 {
2317 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2320 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
@@ -2326,8 +2329,8 @@ libgnunet_plugin_transport_http_init (void *cls)
2326 } 2329 }
2327 2330
2328 /* Reading ipv4 addresse to bind to from config file */ 2331 /* Reading ipv4 addresse to bind to from config file */
2329 if (GNUNET_CONFIGURATION_have_value (env->cfg, 2332 if ((plugin->use_ipv6==GNUNET_YES) && (GNUNET_CONFIGURATION_have_value (env->cfg,
2330 "transport-http", "BINDTO6")) 2333 "transport-http", "BINDTO6")))
2331 { 2334 {
2332 GNUNET_break (GNUNET_OK == 2335 GNUNET_break (GNUNET_OK ==
2333 GNUNET_CONFIGURATION_get_value_string (env->cfg, 2336 GNUNET_CONFIGURATION_get_value_string (env->cfg,
@@ -2339,8 +2342,6 @@ libgnunet_plugin_transport_http_init (void *cls)
2339 plugin->bind6_address->sin6_family = AF_INET6; 2342 plugin->bind6_address->sin6_family = AF_INET6;
2340 plugin->bind6_address->sin6_port = htons (port); 2343 plugin->bind6_address->sin6_port = htons (port);
2341 2344
2342 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v6 Hostname `%s'!\n",plugin->bind_hostname);
2343
2344 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0) 2345 if (inet_pton(AF_INET6,plugin->bind_hostname, &plugin->bind6_address->sin6_addr)<=0)
2345 { 2346 {
2346 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2347 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
@@ -2351,13 +2352,7 @@ libgnunet_plugin_transport_http_init (void *cls)
2351 GNUNET_free(plugin->bind_hostname); 2352 GNUNET_free(plugin->bind_hostname);
2352 plugin->bind_hostname = NULL; 2353 plugin->bind_hostname = NULL;
2353 plugin->bind6_address = NULL; 2354 plugin->bind6_address = NULL;
2354
2355 } 2355 }
2356
2357 char * tmp = GNUNET_malloc(50);
2358 inet_ntop(AF_INET6,&plugin->bind6_address->sin6_addr,tmp,50);
2359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"v6 Hostname reverse `%s'!\n",tmp);
2360 GNUNET_free(tmp);
2361 } 2356 }
2362 2357
2363 GNUNET_assert ((port > 0) && (port <= 65535)); 2358 GNUNET_assert ((port > 0) && (port <= 65535));
@@ -2383,7 +2378,7 @@ libgnunet_plugin_transport_http_init (void *cls)
2383 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, 2378 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
2384 MHD_OPTION_END); 2379 MHD_OPTION_END);
2385 } 2380 }
2386 if ((plugin->http_server_daemon_v4 == NULL) && (port != 0)) 2381 if ((plugin->http_server_daemon_v4 == NULL) && (plugin->use_ipv4 == GNUNET_YES) && (port != 0))
2387 { 2382 {
2388 plugin->http_server_daemon_v4 = MHD_start_daemon ( 2383 plugin->http_server_daemon_v4 = MHD_start_daemon (
2389#if DEBUG_CONNECTIONS 2384#if DEBUG_CONNECTIONS
diff --git a/src/transport/test_plugin_transport_data_http.conf b/src/transport/test_plugin_transport_data_http.conf
index d03f4e840..0c5bbcf26 100644
--- a/src/transport/test_plugin_transport_data_http.conf
+++ b/src/transport/test_plugin_transport_data_http.conf
@@ -8,8 +8,9 @@ WEAKRANDOM = YES
8[transport-http] 8[transport-http]
9PORT = 12389 9PORT = 12389
10DEBUG = NO 10DEBUG = NO
11USE_IPv6 = YES 11#USE_IPv4 = NO
12#USE_IPv6 = NO 12#USE_IPv6 = NO
13USE_IPv6 = YES
13#BINDTO4 = 127.0.0.1 14#BINDTO4 = 127.0.0.1
14#BINDTO6 = ::1 15#BINDTO6 = ::1
15 16
diff --git a/src/transport/test_transport_api_http_peer1.conf b/src/transport/test_transport_api_http_peer1.conf
index b7e8fb536..18513d8fc 100644
--- a/src/transport/test_transport_api_http_peer1.conf
+++ b/src/transport/test_transport_api_http_peer1.conf
@@ -1,8 +1,9 @@
1[transport-http] 1[transport-http]
2PORT = 12389 2PORT = 12389
3DEBUG = NO 3DEBUG = NO
4USE_IPv6 = NO 4USE_IPv6 = YES
5BINDTO4 = 127.0.0.1 5USE_IPv4 = YES
6#BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1 7#BINDTO6 = ::1
7 8
8 9
@@ -37,7 +38,7 @@ MINIMUM-FRIENDS = 0
37[transport] 38[transport]
38PLUGINS = http 39PLUGINS = http
39#PLUGINS = tcp http 40#PLUGINS = tcp http
40DEBUG = NO 41DEBUG = YES
41ACCEPT_FROM6 = ::1; 42ACCEPT_FROM6 = ::1;
42ACCEPT_FROM = 127.0.0.1; 43ACCEPT_FROM = 127.0.0.1;
43NEIGHBOUR_LIMIT = 50 44NEIGHBOUR_LIMIT = 50
@@ -106,6 +107,5 @@ WEAKRANDOM = YES
106HOSTKEY = $SERVICEHOME/.hostkey 107HOSTKEY = $SERVICEHOME/.hostkey
107 108
108[PATHS] 109[PATHS]
109DEFAULTCONFIG = test_transport_api_http_peer1.conf
110SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/ 110SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
111 111
diff --git a/src/transport/test_transport_api_http_peer2.conf b/src/transport/test_transport_api_http_peer2.conf
index 6cdd84fe7..940931b4a 100644
--- a/src/transport/test_transport_api_http_peer2.conf
+++ b/src/transport/test_transport_api_http_peer2.conf
@@ -1,8 +1,9 @@
1[transport-http] 1[transport-http]
2PORT = 22368 2PORT = 22368
3DEBUG = NO 3DEBUG = NO
4USE_IPv6 = NO 4USE_IPv6 = YES
5BINDTO4 = 127.0.0.1 5USE_IPv4 = YES
6#BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1 7#BINDTO6 = ::1
7 8
8[fs] 9[fs]
@@ -36,7 +37,7 @@ MINIMUM-FRIENDS = 0
36[transport] 37[transport]
37PLUGINS = http 38PLUGINS = http
38#PLUGINS = tcp http 39#PLUGINS = tcp http
39DEBUG = NO 40DEBUG = YES
40ACCEPT_FROM6 = ::1; 41ACCEPT_FROM6 = ::1;
41ACCEPT_FROM = 127.0.0.1; 42ACCEPT_FROM = 127.0.0.1;
42NEIGHBOUR_LIMIT = 50 43NEIGHBOUR_LIMIT = 50
@@ -110,6 +111,5 @@ WEAKRANDOM = YES
110HOSTKEY = $SERVICEHOME/.hostkey 111HOSTKEY = $SERVICEHOME/.hostkey
111 112
112[PATHS] 113[PATHS]
113DEFAULTCONFIG = test_transport_api_http_peer2.conf
114SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/ 114SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
115 115
diff --git a/src/transport/test_transport_api_rel_http_peer1.conf b/src/transport/test_transport_api_rel_http_peer1.conf
index b7e8fb536..807e49149 100644
--- a/src/transport/test_transport_api_rel_http_peer1.conf
+++ b/src/transport/test_transport_api_rel_http_peer1.conf
@@ -1,11 +1,11 @@
1[transport-http] 1[transport-http]
2PORT = 12389 2PORT = 12389
3DEBUG = NO 3DEBUG = NO
4USE_IPv4 = YES
4USE_IPv6 = NO 5USE_IPv6 = NO
5BINDTO4 = 127.0.0.1 6BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1 7#BINDTO6 = ::1
7 8
8
9[fs] 9[fs]
10AUTOSTART = NO 10AUTOSTART = NO
11 11
@@ -37,7 +37,7 @@ MINIMUM-FRIENDS = 0
37[transport] 37[transport]
38PLUGINS = http 38PLUGINS = http
39#PLUGINS = tcp http 39#PLUGINS = tcp http
40DEBUG = NO 40DEBUG = YES
41ACCEPT_FROM6 = ::1; 41ACCEPT_FROM6 = ::1;
42ACCEPT_FROM = 127.0.0.1; 42ACCEPT_FROM = 127.0.0.1;
43NEIGHBOUR_LIMIT = 50 43NEIGHBOUR_LIMIT = 50
@@ -106,6 +106,5 @@ WEAKRANDOM = YES
106HOSTKEY = $SERVICEHOME/.hostkey 106HOSTKEY = $SERVICEHOME/.hostkey
107 107
108[PATHS] 108[PATHS]
109DEFAULTCONFIG = test_transport_api_http_peer1.conf
110SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/ 109SERVICEHOME = /tmp/test-gnunetd-transport-peer-1/
111 110
diff --git a/src/transport/test_transport_api_rel_http_peer2.conf b/src/transport/test_transport_api_rel_http_peer2.conf
index 6cdd84fe7..7d14e3987 100644
--- a/src/transport/test_transport_api_rel_http_peer2.conf
+++ b/src/transport/test_transport_api_rel_http_peer2.conf
@@ -1,6 +1,7 @@
1[transport-http] 1[transport-http]
2PORT = 22368 2PORT = 22389
3DEBUG = NO 3DEBUG = NO
4USE_IPv4 = YES
4USE_IPv6 = NO 5USE_IPv6 = NO
5BINDTO4 = 127.0.0.1 6BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1 7#BINDTO6 = ::1
@@ -36,7 +37,7 @@ MINIMUM-FRIENDS = 0
36[transport] 37[transport]
37PLUGINS = http 38PLUGINS = http
38#PLUGINS = tcp http 39#PLUGINS = tcp http
39DEBUG = NO 40DEBUG = YES
40ACCEPT_FROM6 = ::1; 41ACCEPT_FROM6 = ::1;
41ACCEPT_FROM = 127.0.0.1; 42ACCEPT_FROM = 127.0.0.1;
42NEIGHBOUR_LIMIT = 50 43NEIGHBOUR_LIMIT = 50
@@ -110,6 +111,5 @@ WEAKRANDOM = YES
110HOSTKEY = $SERVICEHOME/.hostkey 111HOSTKEY = $SERVICEHOME/.hostkey
111 112
112[PATHS] 113[PATHS]
113DEFAULTCONFIG = test_transport_api_http_peer2.conf
114SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/ 114SERVICEHOME = /tmp/test-gnunetd-transport-peer-2/
115 115
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index a7ab6407d..dc4867f84 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -446,8 +446,8 @@ run (void *cls,
446 } 446 }
447 else if (is_http) 447 else if (is_http)
448 { 448 {
449 setup_peer (&p1, "test_transport_api_http_peer1.conf"); 449 setup_peer (&p1, "test_transport_api_rel_http_peer1.conf");
450 setup_peer (&p2, "test_transport_api_http_peer2.conf"); 450 setup_peer (&p2, "test_transport_api_rel_http_peer2.conf");
451 } 451 }
452 else if (is_udp) 452 else if (is_udp)
453 { 453 {