aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http.c52
-rw-r--r--src/transport/test_plugin_transport_data_http.conf5
-rw-r--r--src/transport/test_plugin_transport_http.c1
-rw-r--r--src/transport/test_transport_api_http_peer1.conf12
-rw-r--r--src/transport/test_transport_api_http_peer2.conf8
5 files changed, 57 insertions, 21 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c
index d754c7e67..3faa55627 100644
--- a/src/transport/plugin_transport_http.c
+++ b/src/transport/plugin_transport_http.c
@@ -357,6 +357,7 @@ struct Plugin
357 struct GNUNET_CRYPTO_HashAsciiEncoded my_ascii_hash_ident; 357 struct GNUNET_CRYPTO_HashAsciiEncoded my_ascii_hash_ident;
358 358
359 struct in_addr * bind_address; 359 struct in_addr * bind_address;
360 int use_ipv6;
360}; 361};
361 362
362 363
@@ -557,15 +558,17 @@ process_interfaces (void *cls,
557 if (plugin->bind_address != NULL) 558 if (plugin->bind_address != NULL)
558 { 559 {
559 if (0 == memcmp(plugin->bind_address, &bnd_cmp, sizeof (struct in_addr))) 560 if (0 == memcmp(plugin->bind_address, &bnd_cmp, sizeof (struct in_addr)))
561 {
560 plugin->env->notify_address(plugin->env->cls,"http",t4, sizeof (struct IPv4HttpAddress), GNUNET_TIME_UNIT_FOREVER_REL); 562 plugin->env->notify_address(plugin->env->cls,"http",t4, sizeof (struct IPv4HttpAddress), GNUNET_TIME_UNIT_FOREVER_REL);
563 }
561 } 564 }
562 else 565 else
563 { 566 {
564 plugin->env->notify_address(plugin->env->cls,"http",t4, sizeof (struct IPv4HttpAddress), GNUNET_TIME_UNIT_FOREVER_REL); 567 plugin->env->notify_address(plugin->env->cls,"http",t4, sizeof (struct IPv4HttpAddress), GNUNET_TIME_UNIT_FOREVER_REL);
565 } 568 }
566 569 GNUNET_free (t4);
567 } 570 }
568 else if ((af == AF_INET6) && (plugin->bind_address == NULL)) 571 else if ((af == AF_INET6) && (plugin->use_ipv6==GNUNET_YES) && (plugin->bind_address == NULL))
569 { 572 {
570 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress)); 573 t6 = GNUNET_malloc(sizeof(struct IPv6HttpAddress));
571 if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr)) 574 if (IN6_IS_ADDR_LINKLOCAL (&((struct sockaddr_in6 *) addr)->sin6_addr))
@@ -585,6 +588,7 @@ process_interfaces (void *cls,
585 sizeof (struct in6_addr)); 588 sizeof (struct in6_addr));
586 t6->u6_port = htons (plugin->port_inbound); 589 t6->u6_port = htons (plugin->port_inbound);
587 plugin->env->notify_address(plugin->env->cls,"http",t6,sizeof (struct IPv6HttpAddress) , GNUNET_TIME_UNIT_FOREVER_REL); 590 plugin->env->notify_address(plugin->env->cls,"http",t6,sizeof (struct IPv6HttpAddress) , GNUNET_TIME_UNIT_FOREVER_REL);
591 GNUNET_free (t6);
588 } 592 }
589 //return GNUNET_NO; 593 //return GNUNET_NO;
590 return GNUNET_OK; 594 return GNUNET_OK;
@@ -1795,10 +1799,8 @@ http_plugin_send (void *cls,
1795{ 1799{
1796 struct Plugin *plugin = cls; 1800 struct Plugin *plugin = cls;
1797 struct HTTP_Message *msg; 1801 struct HTTP_Message *msg;
1798
1799 struct HTTP_PeerContext * pc; 1802 struct HTTP_PeerContext * pc;
1800 struct Session * ps = NULL; 1803 struct Session * ps = NULL;
1801 //struct Session * ps_tmp = NULL;
1802 1804
1803 GNUNET_assert(cls !=NULL); 1805 GNUNET_assert(cls !=NULL);
1804 1806
@@ -2031,8 +2033,8 @@ http_plugin_address_pretty_printer (void *cls,
2031 res = GNUNET_asprintf(&ret,"http://%s:%u/",address,port); 2033 res = GNUNET_asprintf(&ret,"http://%s:%u/",address,port);
2032 GNUNET_free (address); 2034 GNUNET_free (address);
2033 GNUNET_assert(res != 0); 2035 GNUNET_assert(res != 0);
2034
2035 asc (asc_cls, ret); 2036 asc (asc_cls, ret);
2037 GNUNET_free_non_null (ret);
2036} 2038}
2037 2039
2038 2040
@@ -2230,7 +2232,11 @@ libgnunet_plugin_transport_http_init (void *cls)
2230 struct GNUNET_TRANSPORT_PluginFunctions *api; 2232 struct GNUNET_TRANSPORT_PluginFunctions *api;
2231 struct GNUNET_TIME_Relative gn_timeout; 2233 struct GNUNET_TIME_Relative gn_timeout;
2232 long long unsigned int port; 2234 long long unsigned int port;
2233 char * hostname; 2235
2236 char * hostname = NULL;
2237 //struct sockaddr_in b4_addr;
2238 //struct sockaddr_in6 b6_addr;
2239
2234 2240
2235 GNUNET_assert(cls !=NULL); 2241 GNUNET_assert(cls !=NULL);
2236#if DEBUG_HTTP 2242#if DEBUG_HTTP
@@ -2241,7 +2247,8 @@ libgnunet_plugin_transport_http_init (void *cls)
2241 plugin->stats = env->stats; 2247 plugin->stats = env->stats;
2242 plugin->env = env; 2248 plugin->env = env;
2243 plugin->peers = NULL; 2249 plugin->peers = NULL;
2244 plugin->bind_address = GNUNET_malloc(sizeof(struct in_addr*)); 2250 plugin->bind_address = NULL;
2251 plugin->use_ipv6 = GNUNET_YES;
2245 2252
2246 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions)); 2253 api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
2247 api->cls = plugin; 2254 api->cls = plugin;
@@ -2255,6 +2262,19 @@ libgnunet_plugin_transport_http_init (void *cls)
2255 GNUNET_CRYPTO_hash_to_enc ( &(plugin->env->my_identity->hashPubKey), &plugin->my_ascii_hash_ident); 2262 GNUNET_CRYPTO_hash_to_enc ( &(plugin->env->my_identity->hashPubKey), &plugin->my_ascii_hash_ident);
2256 2263
2257 /* Reading port number from config file */ 2264 /* Reading port number from config file */
2265 if (GNUNET_CONFIGURATION_have_value (env->cfg,
2266 "transport-http", "USE_IPv6"))
2267 {
2268 plugin->use_ipv6 = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2269 "transport-http",
2270 "USE_IPv6");
2271
2272
2273
2274 }
2275 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2276 "IPV6 is %u\n",plugin->use_ipv6 );
2277 /* Reading port number from config file */
2258 if ((GNUNET_OK != 2278 if ((GNUNET_OK !=
2259 GNUNET_CONFIGURATION_get_value_number (env->cfg, 2279 GNUNET_CONFIGURATION_get_value_number (env->cfg,
2260 "transport-http", 2280 "transport-http",
@@ -2279,6 +2299,7 @@ libgnunet_plugin_transport_http_init (void *cls)
2279 "transport-http", 2299 "transport-http",
2280 "BINDTO", 2300 "BINDTO",
2281 &hostname)); 2301 &hostname));
2302 plugin->bind_address = GNUNET_malloc(sizeof(struct in_addr*));
2282 if (inet_aton(hostname, plugin->bind_address)==0) 2303 if (inet_aton(hostname, plugin->bind_address)==0)
2283 { 2304 {
2284 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, 2305 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
@@ -2288,13 +2309,15 @@ libgnunet_plugin_transport_http_init (void *cls)
2288 GNUNET_free(plugin->bind_address); 2309 GNUNET_free(plugin->bind_address);
2289 plugin->bind_address = NULL; 2310 plugin->bind_address = NULL;
2290 } 2311 }
2312 GNUNET_free_non_null (hostname);
2291 } 2313 }
2292 GNUNET_assert ((port > 0) && (port <= 65535)); 2314 GNUNET_assert ((port > 0) && (port <= 65535));
2293 plugin->port_inbound = port; 2315 plugin->port_inbound = port;
2294 gn_timeout = GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT; 2316 gn_timeout = GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT;
2295 unsigned int timeout = (gn_timeout.value) / 1000; 2317 unsigned int timeout = (gn_timeout.value) / 1000;
2296 if ((plugin->http_server_daemon_v4 == NULL) && (plugin->http_server_daemon_v6 == NULL) && (port != 0)) 2318 if ((plugin->http_server_daemon_v6 == NULL) && (plugin->use_ipv6 == GNUNET_YES) && (port != 0))
2297 { 2319 {
2320
2298 plugin->http_server_daemon_v6 = MHD_start_daemon ( 2321 plugin->http_server_daemon_v6 = MHD_start_daemon (
2299#if DEBUG_CONNECTIONS 2322#if DEBUG_CONNECTIONS
2300 MHD_USE_DEBUG | 2323 MHD_USE_DEBUG |
@@ -2303,14 +2326,17 @@ libgnunet_plugin_transport_http_init (void *cls)
2303 port, 2326 port,
2304 &mhd_accept_cb, 2327 &mhd_accept_cb,
2305 plugin , &mdh_access_cb, plugin, 2328 plugin , &mdh_access_cb, plugin,
2329 //MHD_OPTION_SOCK_ADDR, (struct sockaddr *) &b6_addr,
2306 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, 2330 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
2307 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, 2331 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
2308 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, 2332 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
2309 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), 2333 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
2310 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, 2334 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
2311 MHD_OPTION_END); 2335 MHD_OPTION_END);
2312 2336 }
2313 plugin->http_server_daemon_v4 = MHD_start_daemon ( 2337 if ((plugin->http_server_daemon_v4 == NULL) && (plugin->http_server_daemon_v6 == NULL) && (port != 0))
2338 {
2339 plugin->http_server_daemon_v4 = MHD_start_daemon (
2314#if DEBUG_CONNECTIONS 2340#if DEBUG_CONNECTIONS
2315 MHD_USE_DEBUG | 2341 MHD_USE_DEBUG |
2316#endif 2342#endif
@@ -2318,14 +2344,14 @@ libgnunet_plugin_transport_http_init (void *cls)
2318 port, 2344 port,
2319 &mhd_accept_cb, 2345 &mhd_accept_cb,
2320 plugin , &mdh_access_cb, plugin, 2346 plugin , &mdh_access_cb, plugin,
2321 //MHD_OPTION_SOCK_ADDR, (struct sockaddr *) &in4, 2347 //MHD_OPTION_SOCK_ADDR, (struct sockaddr *) &b4_addr,
2322 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32, 2348 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 32,
2323 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6, 2349 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 6,
2324 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout, 2350 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) timeout,
2325 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024), 2351 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (16 * 1024),
2326 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL, 2352 MHD_OPTION_NOTIFY_COMPLETED, &mhd_termination_cb, NULL,
2327 MHD_OPTION_END); 2353 MHD_OPTION_END);
2328 } 2354 }
2329 if (plugin->http_server_daemon_v4 != NULL) 2355 if (plugin->http_server_daemon_v4 != NULL)
2330 plugin->http_server_task_v4 = http_server_daemon_prepare (plugin, plugin->http_server_daemon_v4); 2356 plugin->http_server_task_v4 = http_server_daemon_prepare (plugin, plugin->http_server_daemon_v4);
2331 if (plugin->http_server_daemon_v6 != NULL) 2357 if (plugin->http_server_daemon_v6 != NULL)
diff --git a/src/transport/test_plugin_transport_data_http.conf b/src/transport/test_plugin_transport_data_http.conf
index 7a14f793a..f17627776 100644
--- a/src/transport/test_plugin_transport_data_http.conf
+++ b/src/transport/test_plugin_transport_data_http.conf
@@ -8,7 +8,10 @@ WEAKRANDOM = YES
8[transport-http] 8[transport-http]
9PORT = 12389 9PORT = 12389
10DEBUG = NO 10DEBUG = NO
11BINDTO = 127.0.0.1 11USE_IPv6 = YES
12#BINDTO4 = 127.0.0.1
13#BINDTO6 = ::1
14
12 15
13[transport] 16[transport]
14PREFIX = valgrind --leak-check=full 17PREFIX = valgrind --leak-check=full
diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c
index 24689f81a..fbb758f7e 100644
--- a/src/transport/test_plugin_transport_http.c
+++ b/src/transport/test_plugin_transport_http.c
@@ -1043,6 +1043,7 @@ static void run_connection_tests( int phase , void * cls)
1043 count ++; 1043 count ++;
1044 type ++; 1044 type ++;
1045 } 1045 }
1046 GNUNET_free(tmp);
1046 return; 1047 return;
1047 } 1048 }
1048 1049
diff --git a/src/transport/test_transport_api_http_peer1.conf b/src/transport/test_transport_api_http_peer1.conf
index 2cbf82e5e..9521999ee 100644
--- a/src/transport/test_transport_api_http_peer1.conf
+++ b/src/transport/test_transport_api_http_peer1.conf
@@ -1,7 +1,10 @@
1[transport-http] 1[transport-http]
2PORT = 12389 2PORT = 12389
3DEBUG = YES 3DEBUG = NO
4BINDTO = 127.0.0.1 4USE_IPv6 = YES
5#BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1
7
5 8
6[fs] 9[fs]
7AUTOSTART = NO 10AUTOSTART = NO
@@ -35,8 +38,6 @@ MINIMUM-FRIENDS = 0
35PLUGINS = http 38PLUGINS = http
36#PLUGINS = tcp http 39#PLUGINS = tcp http
37DEBUG = NO 40DEBUG = NO
38#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
39#PREFIX = valgrind --leak-check=full
40ACCEPT_FROM6 = ::1; 41ACCEPT_FROM6 = ::1;
41ACCEPT_FROM = 127.0.0.1; 42ACCEPT_FROM = 127.0.0.1;
42NEIGHBOUR_LIMIT = 50 43NEIGHBOUR_LIMIT = 50
@@ -46,6 +47,9 @@ HOME = $SERVICEHOME
46HOSTNAME = localhost 47HOSTNAME = localhost
47PORT = 12365 48PORT = 12365
48UNIXPATH = /tmp/gnunet-p1-service-transport.sock 49UNIXPATH = /tmp/gnunet-p1-service-transport.sock
50#PREFIX = xterm -T transport2 -e gdb --command=cmd --args
51#PREFIX = valgrind --leak-check=full
52#PREFIX = valgrind --tool=massif
49 53
50[peerinfo] 54[peerinfo]
51TRUST = $SERVICEHOME/data/credit/ 55TRUST = $SERVICEHOME/data/credit/
diff --git a/src/transport/test_transport_api_http_peer2.conf b/src/transport/test_transport_api_http_peer2.conf
index 15a562b6e..ad8e2fb90 100644
--- a/src/transport/test_transport_api_http_peer2.conf
+++ b/src/transport/test_transport_api_http_peer2.conf
@@ -1,7 +1,9 @@
1[transport-http] 1[transport-http]
2PORT = 22368 2PORT = 22368
3DEBUG = YES 3DEBUG = NO
4BINDTO = 127.0.0.1 4USE_IPv6 = YES
5#BINDTO4 = 127.0.0.1
6#BINDTO6 = ::1
5 7
6[fs] 8[fs]
7AUTOSTART = NO 9AUTOSTART = NO
@@ -35,7 +37,6 @@ MINIMUM-FRIENDS = 0
35PLUGINS = http 37PLUGINS = http
36#PLUGINS = tcp http 38#PLUGINS = tcp http
37DEBUG = NO 39DEBUG = NO
38# PREFIX =
39ACCEPT_FROM6 = ::1; 40ACCEPT_FROM6 = ::1;
40ACCEPT_FROM = 127.0.0.1; 41ACCEPT_FROM = 127.0.0.1;
41NEIGHBOUR_LIMIT = 50 42NEIGHBOUR_LIMIT = 50
@@ -47,6 +48,7 @@ PORT = 22365
47UNIXPATH = /tmp/gnunet-p2-service-transport.sock 48UNIXPATH = /tmp/gnunet-p2-service-transport.sock
48#PREFIX = xterm -T transport1 -e gdb --command=cmd --args 49#PREFIX = xterm -T transport1 -e gdb --command=cmd --args
49#PREFIX = valgrind --leak-check=full 50#PREFIX = valgrind --leak-check=full
51#PREFIX = valgrind --tool=massif
50 52
51[peerinfo] 53[peerinfo]
52TRUST = $SERVICEHOME/data/credit/ 54TRUST = $SERVICEHOME/data/credit/