diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/.gitignore | 76 | ||||
-rw-r--r-- | src/transport/Makefile.am | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 8 | ||||
-rw-r--r-- | src/transport/gnunet-transport.c | 246 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 25 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 138 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 71 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.h | 1 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp_broadcasting.c | 1 | ||||
-rw-r--r-- | src/transport/transport.conf.in | 49 | ||||
-rw-r--r-- | src/transport/transport_api_address_to_string.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_blacklist.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_core.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_hello_get.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_manipulation.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_monitor_peers.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_monitor_plugins.c | 2 | ||||
-rw-r--r-- | src/transport/transport_api_offer_hello.c | 2 |
18 files changed, 290 insertions, 355 deletions
diff --git a/src/transport/.gitignore b/src/transport/.gitignore index eab8d3146..d035b4011 100644 --- a/src/transport/.gitignore +++ b/src/transport/.gitignore | |||
@@ -7,3 +7,79 @@ gnunet-transport | |||
7 | gnunet-transport-certificate-creation | 7 | gnunet-transport-certificate-creation |
8 | gnunet-transport-profiler | 8 | gnunet-transport-profiler |
9 | gnunet-transport-wlan-receiver | 9 | gnunet-transport-wlan-receiver |
10 | https_cert_qutoa_p2.crt | ||
11 | https_key_quota_p2.key | ||
12 | test_http_common | ||
13 | test_plugin_bluetooth | ||
14 | test_plugin_http_client | ||
15 | test_plugin_http_server | ||
16 | test_plugin_https_client | ||
17 | test_plugin_https_server | ||
18 | test_plugin_tcp | ||
19 | test_plugin_udp | ||
20 | test_plugin_unix | ||
21 | test_plugin_wlan | ||
22 | test_quota_compliance_bluetooth | ||
23 | test_quota_compliance_bluetooth_asymmetric | ||
24 | test_quota_compliance_http | ||
25 | test_quota_compliance_http_asymmetric | ||
26 | test_quota_compliance_https | ||
27 | test_quota_compliance_https_asymmetric | ||
28 | test_quota_compliance_tcp | ||
29 | test_quota_compliance_tcp_asymmetric | ||
30 | test_quota_compliance_udp | ||
31 | test_quota_compliance_unix | ||
32 | test_quota_compliance_unix_asymmetric | ||
33 | test_quota_compliance_wlan | ||
34 | test_quota_compliance_wlan_asymmetric | ||
35 | test_transport_address_switch_http | ||
36 | test_transport_address_switch_https | ||
37 | test_transport_address_switch_tcp | ||
38 | test_transport_address_switch_udp | ||
39 | test_transport_api_blacklisting_tcp | ||
40 | test_transport_api_bluetooth | ||
41 | test_transport_api_disconnect_tcp | ||
42 | test_transport_api_http | ||
43 | test_transport_api_http_reverse | ||
44 | test_transport_api_https | ||
45 | test_transport_api_limited_sockets_tcp | ||
46 | test_transport_api_manipulation_cfg | ||
47 | test_transport_api_manipulation_recv_tcp | ||
48 | test_transport_api_manipulation_send_tcp | ||
49 | test_transport_api_monitor_peers | ||
50 | test_transport_api_multi | ||
51 | test_transport_api_reliability_bluetooth | ||
52 | test_transport_api_reliability_http | ||
53 | test_transport_api_reliability_http_xhr | ||
54 | test_transport_api_reliability_https | ||
55 | test_transport_api_reliability_https_xhr | ||
56 | test_transport_api_reliability_tcp | ||
57 | test_transport_api_reliability_tcp_nat | ||
58 | test_transport_api_reliability_udp | ||
59 | test_transport_api_reliability_unix | ||
60 | test_transport_api_reliability_wlan | ||
61 | test_transport_api_restart_1peer | ||
62 | test_transport_api_restart_2peers | ||
63 | test_transport_api_slow_ats | ||
64 | test_transport_api_tcp | ||
65 | test_transport_api_tcp_nat | ||
66 | test_transport_api_timeout_bluetooth | ||
67 | test_transport_api_timeout_http | ||
68 | test_transport_api_timeout_https | ||
69 | test_transport_api_timeout_tcp | ||
70 | test_transport_api_timeout_udp | ||
71 | test_transport_api_timeout_unix | ||
72 | test_transport_api_timeout_wlan | ||
73 | test_transport_api_udp | ||
74 | test_transport_api_udp_nat | ||
75 | test_transport_api_unix | ||
76 | test_transport_api_unix_abstract | ||
77 | test_transport_api_wlan | ||
78 | test_transport_blacklisting_inbound_bl_full | ||
79 | test_transport_blacklisting_inbound_bl_plugin | ||
80 | test_transport_blacklisting_multiple_plugins | ||
81 | test_transport_blacklisting_no_bl | ||
82 | test_transport_blacklisting_outbound_bl_full | ||
83 | test_transport_blacklisting_outbound_bl_plugin | ||
84 | test_transport_testing_restart | ||
85 | test_transport_testing_startstop | ||
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 9fb451383..0b523eecc 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -235,7 +235,6 @@ gnunet_transport_profiler_SOURCES = \ | |||
235 | gnunet-transport-profiler.c | 235 | gnunet-transport-profiler.c |
236 | gnunet_transport_profiler_LDADD = \ | 236 | gnunet_transport_profiler_LDADD = \ |
237 | libgnunettransport.la \ | 237 | libgnunettransport.la \ |
238 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
239 | $(top_builddir)/src/hello/libgnunethello.la \ | 238 | $(top_builddir)/src/hello/libgnunethello.la \ |
240 | $(top_builddir)/src/ats/libgnunetats.la \ | 239 | $(top_builddir)/src/ats/libgnunetats.la \ |
241 | $(top_builddir)/src/util/libgnunetutil.la \ | 240 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -245,7 +244,6 @@ gnunet_transport_SOURCES = \ | |||
245 | gnunet-transport.c | 244 | gnunet-transport.c |
246 | gnunet_transport_LDADD = \ | 245 | gnunet_transport_LDADD = \ |
247 | libgnunettransport.la \ | 246 | libgnunettransport.la \ |
248 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
249 | $(top_builddir)/src/hello/libgnunethello.la \ | 247 | $(top_builddir)/src/hello/libgnunethello.la \ |
250 | $(top_builddir)/src/util/libgnunetutil.la \ | 248 | $(top_builddir)/src/util/libgnunetutil.la \ |
251 | $(GN_LIBINTL) | 249 | $(GN_LIBINTL) |
@@ -268,7 +266,6 @@ gnunet_service_transport_LDADD = \ | |||
268 | $(top_builddir)/src/ats/libgnunetats.la \ | 266 | $(top_builddir)/src/ats/libgnunetats.la \ |
269 | $(top_builddir)/src/hello/libgnunethello.la \ | 267 | $(top_builddir)/src/hello/libgnunethello.la \ |
270 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 268 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
271 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
272 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 269 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
273 | $(top_builddir)/src/util/libgnunetutil.la \ | 270 | $(top_builddir)/src/util/libgnunetutil.la \ |
274 | $(GN_GLPK) \ | 271 | $(GN_GLPK) \ |
@@ -299,7 +296,7 @@ libgnunet_plugin_transport_tcp_la_LIBADD = \ | |||
299 | $(top_builddir)/src/hello/libgnunethello.la \ | 296 | $(top_builddir)/src/hello/libgnunethello.la \ |
300 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 297 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
301 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 298 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
302 | $(top_builddir)/src/nat/libgnunetnat.la \ | 299 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
303 | $(top_builddir)/src/util/libgnunetutil.la \ | 300 | $(top_builddir)/src/util/libgnunetutil.la \ |
304 | $(LTLIBINTL) | 301 | $(LTLIBINTL) |
305 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ | 302 | libgnunet_plugin_transport_tcp_la_LDFLAGS = \ |
@@ -347,7 +344,7 @@ libgnunet_plugin_transport_udp_la_LIBADD = \ | |||
347 | $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ | 344 | $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \ |
348 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 345 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
349 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 346 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
350 | $(top_builddir)/src/nat/libgnunetnat.la \ | 347 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
351 | $(top_builddir)/src/util/libgnunetutil.la \ | 348 | $(top_builddir)/src/util/libgnunetutil.la \ |
352 | $(LTLIBINTL) | 349 | $(LTLIBINTL) |
353 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ | 350 | libgnunet_plugin_transport_udp_la_LDFLAGS = \ |
@@ -372,7 +369,6 @@ libgnunet_plugin_transport_http_client_la_LIBADD = \ | |||
372 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 369 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
373 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 370 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
374 | $(LIB_GNURL) \ | 371 | $(LIB_GNURL) \ |
375 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
376 | $(top_builddir)/src/util/libgnunetutil.la | 372 | $(top_builddir)/src/util/libgnunetutil.la |
377 | libgnunet_plugin_transport_http_client_la_LDFLAGS = \ | 373 | libgnunet_plugin_transport_http_client_la_LDFLAGS = \ |
378 | $(GN_PLUGIN_LDFLAGS) | 374 | $(GN_PLUGIN_LDFLAGS) |
@@ -388,7 +384,7 @@ libgnunet_plugin_transport_http_server_la_LIBADD = \ | |||
388 | $(top_builddir)/src/hello/libgnunethello.la \ | 384 | $(top_builddir)/src/hello/libgnunethello.la \ |
389 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 385 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
390 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 386 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
391 | $(top_builddir)/src/nat/libgnunetnat.la \ | 387 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
392 | $(top_builddir)/src/util/libgnunetutil.la | 388 | $(top_builddir)/src/util/libgnunetutil.la |
393 | libgnunet_plugin_transport_http_server_la_LDFLAGS = \ | 389 | libgnunet_plugin_transport_http_server_la_LDFLAGS = \ |
394 | $(GN_LIBMHD) \ | 390 | $(GN_LIBMHD) \ |
@@ -403,7 +399,6 @@ libgnunet_plugin_transport_https_client_la_LIBADD = \ | |||
403 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 399 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
404 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 400 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
405 | $(LIB_GNURL) \ | 401 | $(LIB_GNURL) \ |
406 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
407 | $(top_builddir)/src/util/libgnunetutil.la | 402 | $(top_builddir)/src/util/libgnunetutil.la |
408 | libgnunet_plugin_transport_https_client_la_LDFLAGS = \ | 403 | libgnunet_plugin_transport_https_client_la_LDFLAGS = \ |
409 | $(GN_PLUGIN_LDFLAGS) | 404 | $(GN_PLUGIN_LDFLAGS) |
@@ -419,7 +414,7 @@ libgnunet_plugin_transport_https_server_la_LIBADD = \ | |||
419 | $(top_builddir)/src/hello/libgnunethello.la \ | 414 | $(top_builddir)/src/hello/libgnunethello.la \ |
420 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 415 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
421 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ | 416 | $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ |
422 | $(top_builddir)/src/nat/libgnunetnat.la \ | 417 | $(top_builddir)/src/nat/libgnunetnatnew.la \ |
423 | $(top_builddir)/src/util/libgnunetutil.la | 418 | $(top_builddir)/src/util/libgnunetutil.la |
424 | libgnunet_plugin_transport_https_server_la_LDFLAGS = \ | 419 | libgnunet_plugin_transport_https_server_la_LDFLAGS = \ |
425 | $(GN_LIBMHD) \ | 420 | $(GN_LIBMHD) \ |
@@ -1176,7 +1171,6 @@ test_quota_compliance_wlan_asymmetric_LDADD = \ | |||
1176 | test_quota_compliance_bluetooth_SOURCES = \ | 1171 | test_quota_compliance_bluetooth_SOURCES = \ |
1177 | test_quota_compliance.c | 1172 | test_quota_compliance.c |
1178 | test_quota_compliance_bluetooth_LDADD = \ | 1173 | test_quota_compliance_bluetooth_LDADD = \ |
1179 | $(top_builddir)/src/nat/libgnunetnat.la \ | ||
1180 | libgnunettransport.la \ | 1174 | libgnunettransport.la \ |
1181 | $(top_builddir)/src/hello/libgnunethello.la \ | 1175 | $(top_builddir)/src/hello/libgnunethello.la \ |
1182 | $(top_builddir)/src/ats/libgnunetats.la \ | 1176 | $(top_builddir)/src/ats/libgnunetats.la \ |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index d82112e03..e1e4f56f8 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -2236,6 +2236,14 @@ GST_neighbours_handle_session_syn (const struct GNUNET_MessageHeader *message, | |||
2236 | scm = (const struct TransportSynMessage *) message; | 2236 | scm = (const struct TransportSynMessage *) message; |
2237 | GNUNET_break_op (0 == ntohl (scm->reserved)); | 2237 | GNUNET_break_op (0 == ntohl (scm->reserved)); |
2238 | ts = GNUNET_TIME_absolute_ntoh (scm->timestamp); | 2238 | ts = GNUNET_TIME_absolute_ntoh (scm->timestamp); |
2239 | if (0 == | ||
2240 | memcmp (&GST_my_identity, | ||
2241 | peer, | ||
2242 | sizeof (struct GNUNET_PeerIdentity))) | ||
2243 | { | ||
2244 | /* loopback connection-to-self, ignore */ | ||
2245 | return GNUNET_SYSERR; | ||
2246 | } | ||
2239 | n = lookup_neighbour (peer); | 2247 | n = lookup_neighbour (peer); |
2240 | if (NULL == n) | 2248 | if (NULL == n) |
2241 | { | 2249 | { |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index e928cf660..fcfc94ac8 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2011-2014, 2016 GNUnet e.V. | 3 | Copyright (C) 2011-2014, 2016, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -23,9 +23,6 @@ | |||
23 | * @brief Tool to help configure, measure and control the transport subsystem. | 23 | * @brief Tool to help configure, measure and control the transport subsystem. |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | * @author Nathan Evans | 25 | * @author Nathan Evans |
26 | * | ||
27 | * This utility can be used to test if a transport mechanism for | ||
28 | * GNUnet is properly configured. | ||
29 | */ | 26 | */ |
30 | #include "platform.h" | 27 | #include "platform.h" |
31 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
@@ -33,13 +30,6 @@ | |||
33 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
34 | #include "gnunet_transport_service.h" | 31 | #include "gnunet_transport_service.h" |
35 | #include "gnunet_transport_core_service.h" | 32 | #include "gnunet_transport_core_service.h" |
36 | #include "gnunet_nat_lib.h" | ||
37 | |||
38 | /** | ||
39 | * How long do we wait for the NAT test to report success? | ||
40 | * Should match NAT_SERVER_TIMEOUT in 'nat_test.c'. | ||
41 | */ | ||
42 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20) | ||
43 | 33 | ||
44 | /** | 34 | /** |
45 | * Timeout for a name resolution | 35 | * Timeout for a name resolution |
@@ -172,49 +162,6 @@ struct PeerResolutionContext | |||
172 | 162 | ||
173 | 163 | ||
174 | /** | 164 | /** |
175 | * Context for a plugin test. | ||
176 | */ | ||
177 | struct TestContext | ||
178 | { | ||
179 | /** | ||
180 | * Previous in DLL | ||
181 | */ | ||
182 | struct TestContext *prev; | ||
183 | |||
184 | /** | ||
185 | * Next in DLL | ||
186 | */ | ||
187 | struct TestContext *next; | ||
188 | |||
189 | /** | ||
190 | * Handle to the active NAT test. | ||
191 | */ | ||
192 | struct GNUNET_NAT_Test *tst; | ||
193 | |||
194 | /** | ||
195 | * Task identifier for the timeout. | ||
196 | */ | ||
197 | struct GNUNET_SCHEDULER_Task * tsk; | ||
198 | |||
199 | /** | ||
200 | * Name of plugin under test. | ||
201 | */ | ||
202 | char *name; | ||
203 | |||
204 | /** | ||
205 | * Bound port | ||
206 | */ | ||
207 | unsigned long long bnd_port; | ||
208 | |||
209 | /** | ||
210 | * Advertised ports | ||
211 | */ | ||
212 | unsigned long long adv_port; | ||
213 | |||
214 | }; | ||
215 | |||
216 | |||
217 | /** | ||
218 | * Benchmarking block size in KB | 165 | * Benchmarking block size in KB |
219 | */ | 166 | */ |
220 | #define BLOCKSIZE 4 | 167 | #define BLOCKSIZE 4 |
@@ -265,11 +212,6 @@ static int iterate_connections; | |||
265 | static int iterate_all; | 212 | static int iterate_all; |
266 | 213 | ||
267 | /** | 214 | /** |
268 | * Option -t. | ||
269 | */ | ||
270 | static int test_configuration; | ||
271 | |||
272 | /** | ||
273 | * Option -c. | 215 | * Option -c. |
274 | */ | 216 | */ |
275 | static int monitor_connects; | 217 | static int monitor_connects; |
@@ -366,16 +308,6 @@ struct GNUNET_OS_Process *resolver; | |||
366 | static unsigned int address_resolutions; | 308 | static unsigned int address_resolutions; |
367 | 309 | ||
368 | /** | 310 | /** |
369 | * DLL for NAT Test Contexts: head | ||
370 | */ | ||
371 | static struct TestContext *head; | ||
372 | |||
373 | /** | ||
374 | * DLL for NAT Test Contexts: tail | ||
375 | */ | ||
376 | static struct TestContext *tail; | ||
377 | |||
378 | /** | ||
379 | * DLL: head of validation resolution entries | 311 | * DLL: head of validation resolution entries |
380 | */ | 312 | */ |
381 | static struct ValidationResolutionContext *vc_head; | 313 | static struct ValidationResolutionContext *vc_head; |
@@ -553,11 +485,13 @@ operation_timeout (void *cls) | |||
553 | _("Failed to resolve address for peer `%s'\n"), | 485 | _("Failed to resolve address for peer `%s'\n"), |
554 | GNUNET_i2s (&cur->addrcp->peer)); | 486 | GNUNET_i2s (&cur->addrcp->peer)); |
555 | 487 | ||
556 | GNUNET_CONTAINER_DLL_remove(rc_head, rc_tail, cur); | 488 | GNUNET_CONTAINER_DLL_remove(rc_head, |
489 | rc_tail, | ||
490 | cur); | ||
557 | GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); | 491 | GNUNET_TRANSPORT_address_to_string_cancel (cur->asc); |
558 | GNUNET_free(cur->transport); | 492 | GNUNET_free (cur->transport); |
559 | GNUNET_free(cur->addrcp); | 493 | GNUNET_free (cur->addrcp); |
560 | GNUNET_free(cur); | 494 | GNUNET_free (cur); |
561 | 495 | ||
562 | } | 496 | } |
563 | FPRINTF (stdout, | 497 | FPRINTF (stdout, |
@@ -570,158 +504,6 @@ operation_timeout (void *cls) | |||
570 | } | 504 | } |
571 | 505 | ||
572 | 506 | ||
573 | static void | ||
574 | run_nat_test (void); | ||
575 | |||
576 | |||
577 | /** | ||
578 | * Display the result of the test. | ||
579 | * | ||
580 | * @param tc test context | ||
581 | * @param result #GNUNET_YES on success | ||
582 | */ | ||
583 | static void | ||
584 | display_test_result (struct TestContext *tc, | ||
585 | enum GNUNET_NAT_StatusCode result) | ||
586 | { | ||
587 | FPRINTF (stderr, | ||
588 | _("NAT plugin `%s' reports: %s\n"), | ||
589 | tc->name, | ||
590 | GNUNET_NAT_status2string (result)); | ||
591 | if (NULL != tc->tsk) | ||
592 | { | ||
593 | GNUNET_SCHEDULER_cancel (tc->tsk); | ||
594 | tc->tsk = NULL; | ||
595 | } | ||
596 | if (NULL != tc->tst) | ||
597 | { | ||
598 | GNUNET_NAT_test_stop (tc->tst); | ||
599 | tc->tst = NULL; | ||
600 | } | ||
601 | |||
602 | GNUNET_CONTAINER_DLL_remove (head, tail, tc); | ||
603 | GNUNET_free (tc->name); | ||
604 | GNUNET_free (tc); | ||
605 | |||
606 | if ((NULL == head) && (NULL != resolver)) | ||
607 | { | ||
608 | GNUNET_break (0 == GNUNET_OS_process_kill (resolver, | ||
609 | GNUNET_TERM_SIG)); | ||
610 | GNUNET_OS_process_destroy (resolver); | ||
611 | resolver = NULL; | ||
612 | } | ||
613 | if (NULL != head) | ||
614 | run_nat_test (); | ||
615 | } | ||
616 | |||
617 | |||
618 | /** | ||
619 | * Function called by NAT to report the outcome of the nat-test. | ||
620 | * Clean up and update GUI. | ||
621 | * | ||
622 | * @param cls test context | ||
623 | * @param result status code | ||
624 | */ | ||
625 | static void | ||
626 | result_callback (void *cls, | ||
627 | enum GNUNET_NAT_StatusCode result) | ||
628 | { | ||
629 | struct TestContext *tc = cls; | ||
630 | |||
631 | display_test_result (tc, | ||
632 | result); | ||
633 | } | ||
634 | |||
635 | |||
636 | static void | ||
637 | run_nat_test () | ||
638 | { | ||
639 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
640 | "Running test for plugin `%s' using bind port %u and advertised port %u \n", | ||
641 | head->name, | ||
642 | (uint16_t) head->bnd_port, | ||
643 | (uint16_t) head->adv_port); | ||
644 | |||
645 | head->tst = GNUNET_NAT_test_start (cfg, | ||
646 | (0 == strcasecmp (head->name, "udp")) | ||
647 | ? GNUNET_NO : GNUNET_YES, | ||
648 | (uint16_t) head->bnd_port, | ||
649 | (uint16_t) head->adv_port, | ||
650 | TIMEOUT, | ||
651 | &result_callback, head); | ||
652 | } | ||
653 | |||
654 | |||
655 | /** | ||
656 | * Test our plugin's configuration (NAT traversal, etc.). | ||
657 | * | ||
658 | * @param cfg configuration to test | ||
659 | */ | ||
660 | static void | ||
661 | do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
662 | { | ||
663 | char *plugins; | ||
664 | char *tok; | ||
665 | unsigned long long bnd_port; | ||
666 | unsigned long long adv_port; | ||
667 | struct TestContext *tc; | ||
668 | char *binary; | ||
669 | |||
670 | if (GNUNET_OK | ||
671 | != GNUNET_CONFIGURATION_get_value_string (cfg, "transport", "plugins", | ||
672 | &plugins)) | ||
673 | { | ||
674 | FPRINTF (stderr, "%s", _ | ||
675 | ("No transport plugins configured, peer will never communicate\n")); | ||
676 | ret = 4; | ||
677 | return; | ||
678 | } | ||
679 | |||
680 | for (tok = strtok (plugins, " "); tok != NULL ; tok = strtok (NULL, " ")) | ||
681 | { | ||
682 | char section[12 + strlen (tok)]; | ||
683 | GNUNET_snprintf (section, sizeof(section), "transport-%s", tok); | ||
684 | if (GNUNET_OK | ||
685 | != GNUNET_CONFIGURATION_get_value_number (cfg, section, "PORT", | ||
686 | &bnd_port)) | ||
687 | { | ||
688 | FPRINTF (stderr, | ||
689 | _("No port configured for plugin `%s', cannot test it\n"), tok); | ||
690 | continue; | ||
691 | } | ||
692 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, section, | ||
693 | "ADVERTISED_PORT", &adv_port)) | ||
694 | adv_port = bnd_port; | ||
695 | |||
696 | tc = GNUNET_new (struct TestContext); | ||
697 | tc->name = GNUNET_strdup (tok); | ||
698 | tc->adv_port = adv_port; | ||
699 | tc->bnd_port = bnd_port; | ||
700 | GNUNET_CONTAINER_DLL_insert_tail (head, tail, tc); | ||
701 | } | ||
702 | GNUNET_free(plugins); | ||
703 | |||
704 | if ((NULL != head) && (NULL == resolver)) | ||
705 | { | ||
706 | binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); | ||
707 | resolver = GNUNET_OS_start_process (GNUNET_YES, | ||
708 | GNUNET_OS_INHERIT_STD_OUT_AND_ERR, | ||
709 | NULL, NULL, NULL, | ||
710 | binary, | ||
711 | "gnunet-service-resolver", NULL); | ||
712 | if (NULL == resolver) | ||
713 | { | ||
714 | FPRINTF (stderr, _("Failed to start resolver!\n")); | ||
715 | return; | ||
716 | } | ||
717 | |||
718 | GNUNET_free(binary); | ||
719 | GNUNET_RESOLVER_connect (cfg); | ||
720 | run_nat_test (); | ||
721 | } | ||
722 | } | ||
723 | |||
724 | |||
725 | /** | 507 | /** |
726 | * Function called to notify a client about the socket | 508 | * Function called to notify a client about the socket |
727 | * begin ready to queue more data. Sends another message. | 509 | * begin ready to queue more data. Sends another message. |
@@ -1041,7 +823,9 @@ process_peer_string (void *cls, | |||
1041 | } | 823 | } |
1042 | GNUNET_free (rc->transport); | 824 | GNUNET_free (rc->transport); |
1043 | GNUNET_free (rc->addrcp); | 825 | GNUNET_free (rc->addrcp); |
1044 | GNUNET_CONTAINER_DLL_remove (rc_head, rc_tail, rc); | 826 | GNUNET_CONTAINER_DLL_remove (rc_head, |
827 | rc_tail, | ||
828 | rc); | ||
1045 | GNUNET_free (rc); | 829 | GNUNET_free (rc); |
1046 | if ((0 == address_resolutions) && (iterate_connections)) | 830 | if ((0 == address_resolutions) && (iterate_connections)) |
1047 | { | 831 | { |
@@ -1461,11 +1245,6 @@ run (void *cls, | |||
1461 | ret = 1; | 1245 | ret = 1; |
1462 | 1246 | ||
1463 | cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg; | 1247 | cfg = (struct GNUNET_CONFIGURATION_Handle *) mycfg; |
1464 | if (test_configuration) | ||
1465 | { | ||
1466 | do_test_configuration (cfg); | ||
1467 | return; | ||
1468 | } | ||
1469 | if ( (NULL != cpid) && | 1248 | if ( (NULL != cpid) && |
1470 | (GNUNET_OK != | 1249 | (GNUNET_OK != |
1471 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, | 1250 | GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, |
@@ -1691,9 +1470,6 @@ main (int argc, | |||
1691 | { 's', "send", NULL, gettext_noop | 1470 | { 's', "send", NULL, gettext_noop |
1692 | ("send data for benchmarking to the other peer (until CTRL-C)"), 0, | 1471 | ("send data for benchmarking to the other peer (until CTRL-C)"), 0, |
1693 | &GNUNET_GETOPT_set_one, &benchmark_send }, | 1472 | &GNUNET_GETOPT_set_one, &benchmark_send }, |
1694 | { 't', "test", NULL, | ||
1695 | gettext_noop ("test transport configuration (involves external server)"), | ||
1696 | 0, &GNUNET_GETOPT_set_one, &test_configuration }, | ||
1697 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 1473 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), |
1698 | GNUNET_GETOPT_OPTION_END | 1474 | GNUNET_GETOPT_OPTION_END |
1699 | }; | 1475 | }; |
@@ -1706,7 +1482,7 @@ main (int argc, | |||
1706 | gettext_noop ("Direct access to transport service."), | 1482 | gettext_noop ("Direct access to transport service."), |
1707 | options, | 1483 | options, |
1708 | &run, NULL); | 1484 | &run, NULL); |
1709 | GNUNET_free((void *) argv); | 1485 | GNUNET_free ((void *) argv); |
1710 | if (GNUNET_OK == res) | 1486 | if (GNUNET_OK == res) |
1711 | return ret; | 1487 | return ret; |
1712 | return 1; | 1488 | return 1; |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 5088f2e77..63c67b81c 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2002-2014 GNUnet e.V. | 3 | Copyright (C) 2002-2014, 2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
31 | #include "gnunet_transport_plugin.h" | 31 | #include "gnunet_transport_plugin.h" |
32 | #include "gnunet_nat_lib.h" | 32 | #include "gnunet_nat_service.h" |
33 | #include "plugin_transport_http_common.h" | 33 | #include "plugin_transport_http_common.h" |
34 | #include <microhttpd.h> | 34 | #include <microhttpd.h> |
35 | #include <regex.h> | 35 | #include <regex.h> |
@@ -2473,12 +2473,14 @@ server_remove_address (void *cls, | |||
2473 | * @param cls closure, the 'struct LocalAddrList' | 2473 | * @param cls closure, the 'struct LocalAddrList' |
2474 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 2474 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
2475 | * the previous (now invalid) one | 2475 | * the previous (now invalid) one |
2476 | * @param ac address class the address belongs to | ||
2476 | * @param addr either the previous or the new public IP address | 2477 | * @param addr either the previous or the new public IP address |
2477 | * @param addrlen actual lenght of the address | 2478 | * @param addrlen actual lenght of the address |
2478 | */ | 2479 | */ |
2479 | static void | 2480 | static void |
2480 | server_nat_port_map_callback (void *cls, | 2481 | server_nat_port_map_callback (void *cls, |
2481 | int add_remove, | 2482 | int add_remove, |
2483 | enum GNUNET_NAT_AddressClass ac, | ||
2482 | const struct sockaddr *addr, | 2484 | const struct sockaddr *addr, |
2483 | socklen_t addrlen) | 2485 | socklen_t addrlen) |
2484 | { | 2486 | { |
@@ -2498,7 +2500,8 @@ server_nat_port_map_callback (void *cls, | |||
2498 | 2500 | ||
2499 | if ((NULL != plugin->server_addr_v4) && | 2501 | if ((NULL != plugin->server_addr_v4) && |
2500 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, | 2502 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, |
2501 | &s4->sin_addr, sizeof (struct in_addr)))) | 2503 | &s4->sin_addr, |
2504 | sizeof (struct in_addr)))) | ||
2502 | { | 2505 | { |
2503 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2506 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2504 | "Skipping address `%s' (not bindto address)\n", | 2507 | "Skipping address `%s' (not bindto address)\n", |
@@ -2754,14 +2757,16 @@ server_start_report_addresses (struct HTTP_Server_Plugin *plugin) | |||
2754 | return; | 2757 | return; |
2755 | } | 2758 | } |
2756 | 2759 | ||
2757 | plugin->nat = | 2760 | plugin->nat |
2758 | GNUNET_NAT_register (plugin->env->cfg, | 2761 | = GNUNET_NAT_register (plugin->env->cfg, |
2759 | GNUNET_YES, | 2762 | "transport-http_server", |
2760 | plugin->port, | 2763 | IPPROTO_TCP, |
2761 | (unsigned int) res, | 2764 | (unsigned int) res, |
2762 | (const struct sockaddr **) addrs, addrlens, | 2765 | (const struct sockaddr **) addrs, |
2763 | &server_nat_port_map_callback, NULL, | 2766 | addrlens, |
2764 | plugin, NULL); | 2767 | &server_nat_port_map_callback, |
2768 | NULL, | ||
2769 | plugin); | ||
2765 | while (res > 0) | 2770 | while (res > 0) |
2766 | { | 2771 | { |
2767 | res--; | 2772 | res--; |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 79c70138f..eca62a8ca 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "gnunet_hello_lib.h" | 26 | #include "gnunet_hello_lib.h" |
27 | #include "gnunet_constants.h" | 27 | #include "gnunet_constants.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_nat_lib.h" | 29 | #include "gnunet_nat_service.h" |
30 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
31 | #include "gnunet_resolver_service.h" | 31 | #include "gnunet_resolver_service.h" |
32 | #include "gnunet_signatures.h" | 32 | #include "gnunet_signatures.h" |
@@ -945,13 +945,15 @@ notify_session_monitor (struct Plugin *plugin, | |||
945 | * @param cls closure, the `struct Plugin` | 945 | * @param cls closure, the `struct Plugin` |
946 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean | 946 | * @param add_remove #GNUNET_YES to mean the new public IP address, #GNUNET_NO to mean |
947 | * the previous (now invalid) one | 947 | * the previous (now invalid) one |
948 | * @param ac address class the address belongs to | ||
948 | * @param addr either the previous or the new public IP address | 949 | * @param addr either the previous or the new public IP address |
949 | * @param addrlen actual length of @a addr | 950 | * @param addrlen actual length of @a addr |
950 | */ | 951 | */ |
951 | static void | 952 | static void |
952 | tcp_nat_port_map_callback (void *cls, | 953 | tcp_nat_port_map_callback (void *cls, |
953 | int add_remove, | 954 | int add_remove, |
954 | const struct sockaddr *addr, | 955 | enum GNUNET_NAT_AddressClass ac, |
956 | const struct sockaddr *addr, | ||
955 | socklen_t addrlen) | 957 | socklen_t addrlen) |
956 | { | 958 | { |
957 | struct Plugin *plugin = cls; | 959 | struct Plugin *plugin = cls; |
@@ -961,10 +963,10 @@ tcp_nat_port_map_callback (void *cls, | |||
961 | void *arg; | 963 | void *arg; |
962 | size_t args; | 964 | size_t args; |
963 | 965 | ||
964 | LOG(GNUNET_ERROR_TYPE_INFO, | 966 | LOG (GNUNET_ERROR_TYPE_INFO, |
965 | "NAT notification to %s address `%s'\n", | 967 | "NAT notification to %s address `%s'\n", |
966 | (GNUNET_YES == add_remove) ? "add" : "remove", | 968 | (GNUNET_YES == add_remove) ? "add" : "remove", |
967 | GNUNET_a2s (addr, addrlen)); | 969 | GNUNET_a2s (addr, addrlen)); |
968 | /* convert 'addr' to our internal format */ | 970 | /* convert 'addr' to our internal format */ |
969 | switch (addr->sa_family) | 971 | switch (addr->sa_family) |
970 | { | 972 | { |
@@ -980,8 +982,9 @@ tcp_nat_port_map_callback (void *cls, | |||
980 | case AF_INET6: | 982 | case AF_INET6: |
981 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); | 983 | GNUNET_assert(addrlen == sizeof(struct sockaddr_in6)); |
982 | memset (&t6, 0, sizeof(t6)); | 984 | memset (&t6, 0, sizeof(t6)); |
983 | GNUNET_memcpy (&t6.ipv6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr, | 985 | GNUNET_memcpy (&t6.ipv6_addr, |
984 | sizeof(struct in6_addr)); | 986 | &((struct sockaddr_in6 *) addr)->sin6_addr, |
987 | sizeof(struct in6_addr)); | ||
985 | t6.options = htonl (plugin->myoptions); | 988 | t6.options = htonl (plugin->myoptions); |
986 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; | 989 | t6.t6_port = ((struct sockaddr_in6 *) addr)->sin6_port; |
987 | arg = &t6; | 990 | arg = &t6; |
@@ -993,11 +996,17 @@ tcp_nat_port_map_callback (void *cls, | |||
993 | } | 996 | } |
994 | /* modify our published address list */ | 997 | /* modify our published address list */ |
995 | GNUNET_assert ((args == sizeof (struct IPv4TcpAddress)) || | 998 | GNUNET_assert ((args == sizeof (struct IPv4TcpAddress)) || |
996 | (args == sizeof (struct IPv6TcpAddress))); | 999 | (args == sizeof (struct IPv6TcpAddress))); |
1000 | /* TODO: use 'ac' here in the future... */ | ||
997 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1001 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
998 | PLUGIN_NAME, arg, args, GNUNET_HELLO_ADDRESS_INFO_NONE); | 1002 | PLUGIN_NAME, |
999 | plugin->env->notify_address (plugin->env->cls, add_remove, address); | 1003 | arg, |
1000 | GNUNET_HELLO_address_free(address); | 1004 | args, |
1005 | GNUNET_HELLO_ADDRESS_INFO_NONE); | ||
1006 | plugin->env->notify_address (plugin->env->cls, | ||
1007 | add_remove, | ||
1008 | address); | ||
1009 | GNUNET_HELLO_address_free (address); | ||
1001 | } | 1010 | } |
1002 | 1011 | ||
1003 | 1012 | ||
@@ -2068,6 +2077,8 @@ tcp_plugin_get_session (void *cls, | |||
2068 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, | 2077 | GNUNET_CONTAINER_multipeermap_contains (plugin->nat_wait_conns, |
2069 | &address->peer))) | 2078 | &address->peer))) |
2070 | { | 2079 | { |
2080 | struct sockaddr_in local_sa; | ||
2081 | |||
2071 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2082 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2072 | "Found valid IPv4 NAT address (creating session)!\n"); | 2083 | "Found valid IPv4 NAT address (creating session)!\n"); |
2073 | session = create_session (plugin, | 2084 | session = create_session (plugin, |
@@ -2085,23 +2096,29 @@ tcp_plugin_get_session (void *cls, | |||
2085 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 2096 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
2086 | 2097 | ||
2087 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2098 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2088 | "Created NAT WAIT connection to `%4s' at `%s'\n", | 2099 | "Created NAT WAIT connection to `%s' at `%s'\n", |
2089 | GNUNET_i2s (&session->target), | 2100 | GNUNET_i2s (&session->target), |
2090 | GNUNET_a2s (sb, sbs)); | 2101 | GNUNET_a2s (sb, sbs)); |
2091 | if (GNUNET_OK == GNUNET_NAT_run_client (plugin->nat, &a4)) | 2102 | memset (&local_sa, |
2092 | { | 2103 | 0, |
2104 | sizeof (local_sa)); | ||
2105 | local_sa.sin_family = AF_INET; | ||
2106 | local_sa.sin_port = htons (plugin->open_port); | ||
2107 | /* We leave sin_address at 0, let the kernel figure it out, | ||
2108 | even if our bind() is more specific. (May want to reconsider | ||
2109 | later.) */ | ||
2110 | if (GNUNET_OK == | ||
2111 | GNUNET_NAT_request_reversal (plugin->nat, | ||
2112 | &local_sa, | ||
2113 | &a4)) | ||
2093 | return session; | 2114 | return session; |
2094 | } | 2115 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2095 | else | 2116 | "Running NAT client for `%s' at `%s' failed\n", |
2096 | { | 2117 | GNUNET_i2s (&session->target), |
2097 | LOG(GNUNET_ERROR_TYPE_DEBUG, | 2118 | GNUNET_a2s (sb, sbs)); |
2098 | "Running NAT client for `%4s' at `%s' failed\n", | 2119 | tcp_plugin_disconnect_session (plugin, |
2099 | GNUNET_i2s (&session->target), | 2120 | session); |
2100 | GNUNET_a2s (sb, sbs)); | 2121 | return NULL; |
2101 | tcp_plugin_disconnect_session (plugin, | ||
2102 | session); | ||
2103 | return NULL; | ||
2104 | } | ||
2105 | } | 2122 | } |
2106 | 2123 | ||
2107 | /* create new outbound session */ | 2124 | /* create new outbound session */ |
@@ -2396,27 +2413,6 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
2396 | 2413 | ||
2397 | 2414 | ||
2398 | /** | 2415 | /** |
2399 | * Check if the given port is plausible (must be either our listen | ||
2400 | * port or our advertised port), or any port if we are behind NAT | ||
2401 | * and do not have a port open. If it is neither, we return | ||
2402 | * #GNUNET_SYSERR. | ||
2403 | * | ||
2404 | * @param plugin global variables | ||
2405 | * @param in_port port number to check | ||
2406 | * @return #GNUNET_OK if port is either open_port or adv_port | ||
2407 | */ | ||
2408 | static int | ||
2409 | check_port (struct Plugin *plugin, | ||
2410 | uint16_t in_port) | ||
2411 | { | ||
2412 | if ( (in_port == plugin->adv_port) || | ||
2413 | (in_port == plugin->open_port) ) | ||
2414 | return GNUNET_OK; | ||
2415 | return GNUNET_SYSERR; | ||
2416 | } | ||
2417 | |||
2418 | |||
2419 | /** | ||
2420 | * Function that will be called to check if a binary address for this | 2416 | * Function that will be called to check if a binary address for this |
2421 | * plugin is well-formed and corresponds to an address for THIS peer | 2417 | * plugin is well-formed and corresponds to an address for THIS peer |
2422 | * (as per our configuration). Naturally, if absolutely necessary, | 2418 | * (as per our configuration). Naturally, if absolutely necessary, |
@@ -2449,6 +2445,8 @@ tcp_plugin_check_address (void *cls, | |||
2449 | 2445 | ||
2450 | if (addrlen == sizeof(struct IPv4TcpAddress)) | 2446 | if (addrlen == sizeof(struct IPv4TcpAddress)) |
2451 | { | 2447 | { |
2448 | struct sockaddr_in s4; | ||
2449 | |||
2452 | v4 = (const struct IPv4TcpAddress *) addr; | 2450 | v4 = (const struct IPv4TcpAddress *) addr; |
2453 | if (0 != memcmp (&v4->options, | 2451 | if (0 != memcmp (&v4->options, |
2454 | &plugin->myoptions, | 2452 | &plugin->myoptions, |
@@ -2457,17 +2455,24 @@ tcp_plugin_check_address (void *cls, | |||
2457 | GNUNET_break (0); | 2455 | GNUNET_break (0); |
2458 | return GNUNET_SYSERR; | 2456 | return GNUNET_SYSERR; |
2459 | } | 2457 | } |
2460 | if (GNUNET_OK != check_port (plugin, | 2458 | memset (&s4, 0, sizeof (s4)); |
2461 | ntohs (v4->t4_port))) | 2459 | s4.sin_family = AF_INET; |
2462 | return GNUNET_SYSERR; | 2460 | #if HAVE_SOCKADDR_IN_SIN_LEN |
2461 | s4.sin_len = sizeof (s4); | ||
2462 | #endif | ||
2463 | s4.sin_port = v4->t4_port; | ||
2464 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
2465 | |||
2463 | if (GNUNET_OK != | 2466 | if (GNUNET_OK != |
2464 | GNUNET_NAT_test_address (plugin->nat, | 2467 | GNUNET_NAT_test_address (plugin->nat, |
2465 | &v4->ipv4_addr, | 2468 | &s4, |
2466 | sizeof (struct in_addr))) | 2469 | sizeof (struct sockaddr_in))) |
2467 | return GNUNET_SYSERR; | 2470 | return GNUNET_SYSERR; |
2468 | } | 2471 | } |
2469 | else | 2472 | else |
2470 | { | 2473 | { |
2474 | struct sockaddr_in6 s6; | ||
2475 | |||
2471 | v6 = (const struct IPv6TcpAddress *) addr; | 2476 | v6 = (const struct IPv6TcpAddress *) addr; |
2472 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 2477 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
2473 | { | 2478 | { |
@@ -2481,13 +2486,18 @@ tcp_plugin_check_address (void *cls, | |||
2481 | GNUNET_break (0); | 2486 | GNUNET_break (0); |
2482 | return GNUNET_SYSERR; | 2487 | return GNUNET_SYSERR; |
2483 | } | 2488 | } |
2484 | if (GNUNET_OK != check_port (plugin, | 2489 | memset (&s6, 0, sizeof (s6)); |
2485 | ntohs (v6->t6_port))) | 2490 | s6.sin6_family = AF_INET6; |
2486 | return GNUNET_SYSERR; | 2491 | #if HAVE_SOCKADDR_IN_SIN_LEN |
2492 | s6.sin6_len = sizeof (s6); | ||
2493 | #endif | ||
2494 | s6.sin6_port = v6->t6_port; | ||
2495 | s6.sin6_addr = v6->ipv6_addr; | ||
2496 | |||
2487 | if (GNUNET_OK != | 2497 | if (GNUNET_OK != |
2488 | GNUNET_NAT_test_address (plugin->nat, | 2498 | GNUNET_NAT_test_address (plugin->nat, |
2489 | &v6->ipv6_addr, | 2499 | &s6, |
2490 | sizeof(struct in6_addr))) | 2500 | sizeof(struct sockaddr_in6))) |
2491 | return GNUNET_SYSERR; | 2501 | return GNUNET_SYSERR; |
2492 | } | 2502 | } |
2493 | return GNUNET_OK; | 2503 | return GNUNET_OK; |
@@ -3388,15 +3398,14 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3388 | GNUNET_a2s (addrs[ret], addrlens[ret])); | 3398 | GNUNET_a2s (addrs[ret], addrlens[ret])); |
3389 | plugin->nat | 3399 | plugin->nat |
3390 | = GNUNET_NAT_register (env->cfg, | 3400 | = GNUNET_NAT_register (env->cfg, |
3391 | GNUNET_YES, | 3401 | "transport-tcp", |
3392 | aport, | 3402 | IPPROTO_TCP, |
3393 | (unsigned int) ret_s, | 3403 | (unsigned int) ret_s, |
3394 | (const struct sockaddr **) addrs, | 3404 | (const struct sockaddr **) addrs, |
3395 | addrlens, | 3405 | addrlens, |
3396 | &tcp_nat_port_map_callback, | 3406 | &tcp_nat_port_map_callback, |
3397 | &try_connection_reversal, | 3407 | &try_connection_reversal, |
3398 | plugin, | 3408 | plugin); |
3399 | NULL); | ||
3400 | for (ret = ret_s -1; ret >= 0; ret--) | 3409 | for (ret = ret_s -1; ret >= 0; ret--) |
3401 | GNUNET_free (addrs[ret]); | 3410 | GNUNET_free (addrs[ret]); |
3402 | GNUNET_free_non_null (addrs); | 3411 | GNUNET_free_non_null (addrs); |
@@ -3405,15 +3414,14 @@ libgnunet_plugin_transport_tcp_init (void *cls) | |||
3405 | else | 3414 | else |
3406 | { | 3415 | { |
3407 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | 3416 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, |
3408 | GNUNET_YES, | 3417 | "transport-tcp", |
3409 | 0, | 3418 | IPPROTO_TCP, |
3410 | 0, | 3419 | 0, |
3411 | NULL, | 3420 | NULL, |
3412 | NULL, | 3421 | NULL, |
3413 | NULL, | 3422 | NULL, |
3414 | &try_connection_reversal, | 3423 | &try_connection_reversal, |
3415 | plugin, | 3424 | plugin); |
3416 | NULL); | ||
3417 | } | 3425 | } |
3418 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); | 3426 | api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions); |
3419 | api->cls = plugin; | 3427 | api->cls = plugin; |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 35ae92460..fd8493e5f 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -30,7 +30,7 @@ | |||
30 | #include "gnunet_hello_lib.h" | 30 | #include "gnunet_hello_lib.h" |
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #include "gnunet_fragmentation_lib.h" | 32 | #include "gnunet_fragmentation_lib.h" |
33 | #include "gnunet_nat_lib.h" | 33 | #include "gnunet_nat_service.h" |
34 | #include "gnunet_protocols.h" | 34 | #include "gnunet_protocols.h" |
35 | #include "gnunet_resolver_service.h" | 35 | #include "gnunet_resolver_service.h" |
36 | #include "gnunet_signatures.h" | 36 | #include "gnunet_signatures.h" |
@@ -1245,31 +1245,48 @@ udp_plugin_check_address (void *cls, | |||
1245 | 1245 | ||
1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) | 1246 | if (sizeof(struct IPv4UdpAddress) == addrlen) |
1247 | { | 1247 | { |
1248 | struct sockaddr_in s4; | ||
1249 | |||
1248 | v4 = (const struct IPv4UdpAddress *) addr; | 1250 | v4 = (const struct IPv4UdpAddress *) addr; |
1249 | if (GNUNET_OK != check_port (plugin, | 1251 | if (GNUNET_OK != check_port (plugin, |
1250 | ntohs (v4->u4_port))) | 1252 | ntohs (v4->u4_port))) |
1251 | return GNUNET_SYSERR; | 1253 | return GNUNET_SYSERR; |
1254 | memset (&s4, 0, sizeof (s4)); | ||
1255 | s4.sin_family = AF_INET; | ||
1256 | #if HAVE_SOCKADDR_IN_SIN_LEN | ||
1257 | s4.sin_len = sizeof (s4); | ||
1258 | #endif | ||
1259 | s4.sin_port = v4->u4_port; | ||
1260 | s4.sin_addr.s_addr = v4->ipv4_addr; | ||
1261 | |||
1252 | if (GNUNET_OK != | 1262 | if (GNUNET_OK != |
1253 | GNUNET_NAT_test_address (plugin->nat, | 1263 | GNUNET_NAT_test_address (plugin->nat, |
1254 | &v4->ipv4_addr, | 1264 | &s4, |
1255 | sizeof (struct in_addr))) | 1265 | sizeof (struct sockaddr_in))) |
1256 | return GNUNET_SYSERR; | 1266 | return GNUNET_SYSERR; |
1257 | } | 1267 | } |
1258 | else if (sizeof(struct IPv6UdpAddress) == addrlen) | 1268 | else if (sizeof(struct IPv6UdpAddress) == addrlen) |
1259 | { | 1269 | { |
1270 | struct sockaddr_in6 s6; | ||
1271 | |||
1260 | v6 = (const struct IPv6UdpAddress *) addr; | 1272 | v6 = (const struct IPv6UdpAddress *) addr; |
1261 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) | 1273 | if (IN6_IS_ADDR_LINKLOCAL (&v6->ipv6_addr)) |
1262 | { | 1274 | { |
1263 | GNUNET_break_op (0); | 1275 | GNUNET_break_op (0); |
1264 | return GNUNET_SYSERR; | 1276 | return GNUNET_SYSERR; |
1265 | } | 1277 | } |
1266 | if (GNUNET_OK != check_port (plugin, | 1278 | memset (&s6, 0, sizeof (s6)); |
1267 | ntohs (v6->u6_port))) | 1279 | s6.sin6_family = AF_INET6; |
1268 | return GNUNET_SYSERR; | 1280 | #if HAVE_SOCKADDR_IN_SIN_LEN |
1281 | s6.sin6_len = sizeof (s6); | ||
1282 | #endif | ||
1283 | s6.sin6_port = v6->u6_port; | ||
1284 | s6.sin6_addr = v6->ipv6_addr; | ||
1285 | |||
1269 | if (GNUNET_OK != | 1286 | if (GNUNET_OK != |
1270 | GNUNET_NAT_test_address (plugin->nat, | 1287 | GNUNET_NAT_test_address (plugin->nat, |
1271 | &v6->ipv6_addr, | 1288 | &s6, |
1272 | sizeof (struct in6_addr))) | 1289 | sizeof(struct sockaddr_in6))) |
1273 | return GNUNET_SYSERR; | 1290 | return GNUNET_SYSERR; |
1274 | } | 1291 | } |
1275 | else | 1292 | else |
@@ -1287,12 +1304,14 @@ udp_plugin_check_address (void *cls, | |||
1287 | * @param cls closure, the `struct Plugin` | 1304 | * @param cls closure, the `struct Plugin` |
1288 | * @param add_remove #GNUNET_YES to mean the new public IP address, | 1305 | * @param add_remove #GNUNET_YES to mean the new public IP address, |
1289 | * #GNUNET_NO to mean the previous (now invalid) one | 1306 | * #GNUNET_NO to mean the previous (now invalid) one |
1307 | * @param ac address class the address belongs to | ||
1290 | * @param addr either the previous or the new public IP address | 1308 | * @param addr either the previous or the new public IP address |
1291 | * @param addrlen actual length of the @a addr | 1309 | * @param addrlen actual length of the @a addr |
1292 | */ | 1310 | */ |
1293 | static void | 1311 | static void |
1294 | udp_nat_port_map_callback (void *cls, | 1312 | udp_nat_port_map_callback (void *cls, |
1295 | int add_remove, | 1313 | int add_remove, |
1314 | enum GNUNET_NAT_AddressClass ac, | ||
1296 | const struct sockaddr *addr, | 1315 | const struct sockaddr *addr, |
1297 | socklen_t addrlen) | 1316 | socklen_t addrlen) |
1298 | { | 1317 | { |
@@ -1359,6 +1378,7 @@ udp_nat_port_map_callback (void *cls, | |||
1359 | return; | 1378 | return; |
1360 | } | 1379 | } |
1361 | /* modify our published address list */ | 1380 | /* modify our published address list */ |
1381 | /* TODO: use 'ac' here in the future... */ | ||
1362 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 1382 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
1363 | PLUGIN_NAME, | 1383 | PLUGIN_NAME, |
1364 | arg, | 1384 | arg, |
@@ -3032,8 +3052,7 @@ read_process_fragment (struct Plugin *plugin, | |||
3032 | msg)) | 3052 | msg)) |
3033 | { | 3053 | { |
3034 | /* keep this 'rc' from expiring */ | 3054 | /* keep this 'rc' from expiring */ |
3035 | GNUNET_CONTAINER_heap_update_cost (plugin->defrag_ctxs, | 3055 | GNUNET_CONTAINER_heap_update_cost (d_ctx->hnode, |
3036 | d_ctx->hnode, | ||
3037 | (GNUNET_CONTAINER_HeapCostType) now.abs_value_us); | 3056 | (GNUNET_CONTAINER_HeapCostType) now.abs_value_us); |
3038 | } | 3057 | } |
3039 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > | 3058 | if (GNUNET_CONTAINER_heap_get_size (plugin->defrag_ctxs) > |
@@ -3082,7 +3101,7 @@ udp_select_read (struct Plugin *plugin, | |||
3082 | sizeof(addr)); | 3101 | sizeof(addr)); |
3083 | size = GNUNET_NETWORK_socket_recvfrom (rsock, | 3102 | size = GNUNET_NETWORK_socket_recvfrom (rsock, |
3084 | buf, | 3103 | buf, |
3085 | sizeof(buf), | 3104 | sizeof (buf), |
3086 | (struct sockaddr *) &addr, | 3105 | (struct sockaddr *) &addr, |
3087 | &fromlen); | 3106 | &fromlen); |
3088 | sa = (const struct sockaddr *) &addr; | 3107 | sa = (const struct sockaddr *) &addr; |
@@ -3111,9 +3130,12 @@ udp_select_read (struct Plugin *plugin, | |||
3111 | } | 3130 | } |
3112 | 3131 | ||
3113 | /* Check if this is a STUN packet */ | 3132 | /* Check if this is a STUN packet */ |
3114 | if (GNUNET_NAT_is_valid_stun_packet (plugin->nat, | 3133 | if (GNUNET_NO != |
3115 | (uint8_t *)buf, | 3134 | GNUNET_NAT_stun_handle_packet (plugin->nat, |
3116 | size)) | 3135 | (const struct sockaddr *) &addr, |
3136 | fromlen, | ||
3137 | buf, | ||
3138 | size)) | ||
3117 | return; /* was STUN, do not process further */ | 3139 | return; /* was STUN, do not process further */ |
3118 | 3140 | ||
3119 | if (size < sizeof(struct GNUNET_MessageHeader)) | 3141 | if (size < sizeof(struct GNUNET_MessageHeader)) |
@@ -3516,7 +3538,7 @@ udp_plugin_select_v4 (void *cls) | |||
3516 | { | 3538 | { |
3517 | struct Plugin *plugin = cls; | 3539 | struct Plugin *plugin = cls; |
3518 | const struct GNUNET_SCHEDULER_TaskContext *tc; | 3540 | const struct GNUNET_SCHEDULER_TaskContext *tc; |
3519 | 3541 | ||
3520 | plugin->select_task_v4 = NULL; | 3542 | plugin->select_task_v4 = NULL; |
3521 | if (NULL == plugin->sockv4) | 3543 | if (NULL == plugin->sockv4) |
3522 | return; | 3544 | return; |
@@ -3572,13 +3594,13 @@ udp_plugin_select_v6 (void *cls) | |||
3572 | * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') | 3594 | * @param bind_v4 IPv4 address to bind to (can be NULL, for 'any') |
3573 | * @return number of sockets that were successfully bound | 3595 | * @return number of sockets that were successfully bound |
3574 | */ | 3596 | */ |
3575 | static int | 3597 | static unsigned int |
3576 | setup_sockets (struct Plugin *plugin, | 3598 | setup_sockets (struct Plugin *plugin, |
3577 | const struct sockaddr_in6 *bind_v6, | 3599 | const struct sockaddr_in6 *bind_v6, |
3578 | const struct sockaddr_in *bind_v4) | 3600 | const struct sockaddr_in *bind_v4) |
3579 | { | 3601 | { |
3580 | int tries; | 3602 | int tries; |
3581 | int sockets_created = 0; | 3603 | unsigned int sockets_created = 0; |
3582 | struct sockaddr_in6 server_addrv6; | 3604 | struct sockaddr_in6 server_addrv6; |
3583 | struct sockaddr_in server_addrv4; | 3605 | struct sockaddr_in server_addrv4; |
3584 | const struct sockaddr *server_addr; | 3606 | const struct sockaddr *server_addr; |
@@ -3788,15 +3810,14 @@ setup_sockets (struct Plugin *plugin, | |||
3788 | schedule_select_v4 (plugin); | 3810 | schedule_select_v4 (plugin); |
3789 | schedule_select_v6 (plugin); | 3811 | schedule_select_v6 (plugin); |
3790 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, | 3812 | plugin->nat = GNUNET_NAT_register (plugin->env->cfg, |
3791 | GNUNET_NO, | 3813 | "transport-udp", |
3792 | plugin->port, | 3814 | IPPROTO_UDP, |
3793 | sockets_created, | 3815 | sockets_created, |
3794 | addrs, | 3816 | addrs, |
3795 | addrlens, | 3817 | addrlens, |
3796 | &udp_nat_port_map_callback, | 3818 | &udp_nat_port_map_callback, |
3797 | NULL, | 3819 | NULL, |
3798 | plugin, | 3820 | plugin); |
3799 | plugin->sockv4); | ||
3800 | return sockets_created; | 3821 | return sockets_created; |
3801 | } | 3822 | } |
3802 | 3823 | ||
@@ -3825,7 +3846,7 @@ libgnunet_plugin_transport_udp_init (void *cls) | |||
3825 | struct GNUNET_TIME_Relative interval; | 3846 | struct GNUNET_TIME_Relative interval; |
3826 | struct sockaddr_in server_addrv4; | 3847 | struct sockaddr_in server_addrv4; |
3827 | struct sockaddr_in6 server_addrv6; | 3848 | struct sockaddr_in6 server_addrv6; |
3828 | int res; | 3849 | unsigned int res; |
3829 | int have_bind4; | 3850 | int have_bind4; |
3830 | int have_bind6; | 3851 | int have_bind6; |
3831 | 3852 | ||
diff --git a/src/transport/plugin_transport_udp.h b/src/transport/plugin_transport_udp.h index c6799ba74..152b16099 100644 --- a/src/transport/plugin_transport_udp.h +++ b/src/transport/plugin_transport_udp.h | |||
@@ -32,7 +32,6 @@ | |||
32 | #include "gnunet_hello_lib.h" | 32 | #include "gnunet_hello_lib.h" |
33 | #include "gnunet_util_lib.h" | 33 | #include "gnunet_util_lib.h" |
34 | #include "gnunet_fragmentation_lib.h" | 34 | #include "gnunet_fragmentation_lib.h" |
35 | #include "gnunet_nat_lib.h" | ||
36 | #include "gnunet_protocols.h" | 35 | #include "gnunet_protocols.h" |
37 | #include "gnunet_resolver_service.h" | 36 | #include "gnunet_resolver_service.h" |
38 | #include "gnunet_signatures.h" | 37 | #include "gnunet_signatures.h" |
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c index 8ef001ddb..a440830fd 100644 --- a/src/transport/plugin_transport_udp_broadcasting.c +++ b/src/transport/plugin_transport_udp_broadcasting.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "gnunet_hello_lib.h" | 29 | #include "gnunet_hello_lib.h" |
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_fragmentation_lib.h" | 31 | #include "gnunet_fragmentation_lib.h" |
32 | #include "gnunet_nat_lib.h" | ||
33 | #include "gnunet_protocols.h" | 32 | #include "gnunet_protocols.h" |
34 | #include "gnunet_resolver_service.h" | 33 | #include "gnunet_resolver_service.h" |
35 | #include "gnunet_signatures.h" | 34 | #include "gnunet_signatures.h" |
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in index 95e3f9944..7b5413bbe 100644 --- a/src/transport/transport.conf.in +++ b/src/transport/transport.conf.in | |||
@@ -38,7 +38,17 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
38 | [transport-tcp] | 38 | [transport-tcp] |
39 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) | 39 | # Use 0 to ONLY advertise as a peer behind NAT (no port binding) |
40 | PORT = 2086 | 40 | PORT = 2086 |
41 | |||
42 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
41 | ADVERTISED_PORT = 2086 | 43 | ADVERTISED_PORT = 2086 |
44 | |||
45 | # If we have a manually punched NAT, what is the external IP and port? | ||
46 | # Can use DNS names for DynDNS-based detection of external IP. | ||
47 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
48 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
49 | # Do not set if NAT is not manually punched. | ||
50 | # HOLE_EXTERNAL = AUTO:2086 | ||
51 | |||
42 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 52 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
43 | 53 | ||
44 | # Maximum number of open TCP connections allowed | 54 | # Maximum number of open TCP connections allowed |
@@ -55,6 +65,9 @@ MAX_CONNECTIONS = 128 | |||
55 | # Enable TCP stealth? | 65 | # Enable TCP stealth? |
56 | TCP_STEALTH = NO | 66 | TCP_STEALTH = NO |
57 | 67 | ||
68 | # Configuration for manually punched holes in NAT. | ||
69 | # HOLE_EXTERNAL = auto:2086 | ||
70 | |||
58 | [transport-udp] | 71 | [transport-udp] |
59 | # Use PORT = 0 to autodetect a port available | 72 | # Use PORT = 0 to autodetect a port available |
60 | PORT = 2086 | 73 | PORT = 2086 |
@@ -69,6 +82,14 @@ BROADCAST_INTERVAL = 30 s | |||
69 | MAX_BPS = 1000000 | 82 | MAX_BPS = 1000000 |
70 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 83 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
71 | 84 | ||
85 | # If we have a manually punched NAT, what is the external IP and port? | ||
86 | # Can use DNS names for DynDNS-based detection of external IP. | ||
87 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
88 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
89 | # Do not set if NAT is not manually punched. | ||
90 | # HOLE_EXTERNAL = AUTO:2086 | ||
91 | |||
92 | |||
72 | [transport-http_client] | 93 | [transport-http_client] |
73 | MAX_CONNECTIONS = 128 | 94 | MAX_CONNECTIONS = 128 |
74 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 95 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
@@ -92,13 +113,27 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
92 | [transport-http_server] | 113 | [transport-http_server] |
93 | #EXTERNAL_HOSTNAME = <your hostname/path> | 114 | #EXTERNAL_HOSTNAME = <your hostname/path> |
94 | PORT = 1080 | 115 | PORT = 1080 |
116 | |||
117 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
95 | ADVERTISED_PORT = 1080 | 118 | ADVERTISED_PORT = 1080 |
119 | |||
120 | # If we have a manually punched NAT, what is the external IP and port? | ||
121 | # Can use DNS names for DynDNS-based detection of external IP. | ||
122 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
123 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
124 | # Do not set if NAT is not manually punched. | ||
125 | # HOLE_EXTERNAL = AUTO:2086 | ||
126 | |||
127 | |||
96 | MAX_CONNECTIONS = 128 | 128 | MAX_CONNECTIONS = 128 |
97 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 129 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
98 | 130 | ||
99 | # Enable TCP stealth? | 131 | # Enable TCP stealth? |
100 | TCP_STEALTH = NO | 132 | TCP_STEALTH = NO |
101 | 133 | ||
134 | # Configuration for manually punched holes in NAT. | ||
135 | # HOLE_EXTERNAL = auto:2086 | ||
136 | |||
102 | [transport-https_client] | 137 | [transport-https_client] |
103 | MAX_CONNECTIONS = 128 | 138 | MAX_CONNECTIONS = 128 |
104 | TESTING_IGNORE_KEYS = ACCEPT_FROM; | 139 | TESTING_IGNORE_KEYS = ACCEPT_FROM; |
@@ -130,7 +165,17 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
130 | # Does the external hostname use the same port? | 165 | # Does the external hostname use the same port? |
131 | # EXTERNAL_HOSTNAME_USE_PORT = YES | 166 | # EXTERNAL_HOSTNAME_USE_PORT = YES |
132 | PORT = 4433 | 167 | PORT = 4433 |
168 | |||
169 | # Obsolete option, to be replaced by HOLE_EXTERNAL (soon) | ||
133 | ADVERTISED_PORT = 4433 | 170 | ADVERTISED_PORT = 4433 |
171 | |||
172 | # If we have a manually punched NAT, what is the external IP and port? | ||
173 | # Can use DNS names for DynDNS-based detection of external IP. | ||
174 | # Can use IPv6 addresses ([fefc::]:PORT). | ||
175 | # Use "AUTO" for the hostname to automatically detect external IP. | ||
176 | # Do not set if NAT is not manually punched. | ||
177 | # HOLE_EXTERNAL = AUTO:2086 | ||
178 | |||
134 | CRYPTO_INIT = NORMAL | 179 | CRYPTO_INIT = NORMAL |
135 | KEY_FILE = $GNUNET_DATA_HOME/transport/https.key | 180 | KEY_FILE = $GNUNET_DATA_HOME/transport/https.key |
136 | CERT_FILE = $GNUNET_DATA_HOME/transport/https.cert | 181 | CERT_FILE = $GNUNET_DATA_HOME/transport/https.cert |
@@ -140,6 +185,10 @@ TESTING_IGNORE_KEYS = ACCEPT_FROM; | |||
140 | # Enable TCP stealth? | 185 | # Enable TCP stealth? |
141 | TCP_STEALTH = NO | 186 | TCP_STEALTH = NO |
142 | 187 | ||
188 | # Configuration for manually punched holes in NAT. | ||
189 | # HOLE_EXTERNAL = auto:2086 | ||
190 | |||
191 | |||
143 | [transport-wlan] | 192 | [transport-wlan] |
144 | # Name of the interface in monitor mode (typically monX) | 193 | # Name of the interface in monitor mode (typically monX) |
145 | INTERFACE = mon0 | 194 | INTERFACE = mon0 |
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index fd30230f7..b9c72dcb3 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -210,7 +210,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
210 | } | 210 | } |
211 | alc->cb = aluc; | 211 | alc->cb = aluc; |
212 | alc->cb_cls = aluc_cls; | 212 | alc->cb_cls = aluc_cls; |
213 | alc->mq = GNUNET_CLIENT_connecT (cfg, | 213 | alc->mq = GNUNET_CLIENT_connect (cfg, |
214 | "transport", | 214 | "transport", |
215 | handlers, | 215 | handlers, |
216 | &mq_error_handler, | 216 | &mq_error_handler, |
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c index 4b758f9dc..7b1bf526e 100644 --- a/src/transport/transport_api_blacklist.c +++ b/src/transport/transport_api_blacklist.c | |||
@@ -132,7 +132,7 @@ reconnect (struct GNUNET_TRANSPORT_Blacklist *br) | |||
132 | 132 | ||
133 | if (NULL != br->mq) | 133 | if (NULL != br->mq) |
134 | GNUNET_MQ_destroy (br->mq); | 134 | GNUNET_MQ_destroy (br->mq); |
135 | br->mq = GNUNET_CLIENT_connecT (br->cfg, | 135 | br->mq = GNUNET_CLIENT_connect (br->cfg, |
136 | "transport", | 136 | "transport", |
137 | handlers, | 137 | handlers, |
138 | &mq_error_handler, | 138 | &mq_error_handler, |
diff --git a/src/transport/transport_api_core.c b/src/transport/transport_api_core.c index de18a140c..a693cb889 100644 --- a/src/transport/transport_api_core.c +++ b/src/transport/transport_api_core.c | |||
@@ -805,7 +805,7 @@ reconnect (void *cls) | |||
805 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 805 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
806 | "Connecting to transport service.\n"); | 806 | "Connecting to transport service.\n"); |
807 | GNUNET_assert (NULL == h->mq); | 807 | GNUNET_assert (NULL == h->mq); |
808 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 808 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
809 | "transport", | 809 | "transport", |
810 | handlers, | 810 | handlers, |
811 | &mq_error_handler, | 811 | &mq_error_handler, |
diff --git a/src/transport/transport_api_hello_get.c b/src/transport/transport_api_hello_get.c index 9c3a3e786..c53dd7a9a 100644 --- a/src/transport/transport_api_hello_get.c +++ b/src/transport/transport_api_hello_get.c | |||
@@ -182,7 +182,7 @@ reconnect (void *cls) | |||
182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 182 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
183 | "Connecting to transport service.\n"); | 183 | "Connecting to transport service.\n"); |
184 | GNUNET_assert (NULL == ghh->mq); | 184 | GNUNET_assert (NULL == ghh->mq); |
185 | ghh->mq = GNUNET_CLIENT_connecT (ghh->cfg, | 185 | ghh->mq = GNUNET_CLIENT_connect (ghh->cfg, |
186 | "transport", | 186 | "transport", |
187 | handlers, | 187 | handlers, |
188 | &mq_error_handler, | 188 | &mq_error_handler, |
diff --git a/src/transport/transport_api_manipulation.c b/src/transport/transport_api_manipulation.c index 6325354cb..fd5849a7e 100644 --- a/src/transport/transport_api_manipulation.c +++ b/src/transport/transport_api_manipulation.c | |||
@@ -121,7 +121,7 @@ reconnect (void *cls) | |||
121 | "Connecting to transport service.\n"); | 121 | "Connecting to transport service.\n"); |
122 | GNUNET_assert (NULL == h->mq); | 122 | GNUNET_assert (NULL == h->mq); |
123 | h->reconnecting = GNUNET_NO; | 123 | h->reconnecting = GNUNET_NO; |
124 | h->mq = GNUNET_CLIENT_connecT (h->cfg, | 124 | h->mq = GNUNET_CLIENT_connect (h->cfg, |
125 | "transport", | 125 | "transport", |
126 | handlers, | 126 | handlers, |
127 | &mq_error_handler, | 127 | &mq_error_handler, |
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index 345f2ad60..38e6e0d7c 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c | |||
@@ -360,7 +360,7 @@ do_peer_connect (void *cls) | |||
360 | struct GNUNET_MQ_Envelope *env; | 360 | struct GNUNET_MQ_Envelope *env; |
361 | 361 | ||
362 | pal_ctx->reconnect_task = NULL; | 362 | pal_ctx->reconnect_task = NULL; |
363 | pal_ctx->mq = GNUNET_CLIENT_connecT (pal_ctx->cfg, | 363 | pal_ctx->mq = GNUNET_CLIENT_connect (pal_ctx->cfg, |
364 | "transport", | 364 | "transport", |
365 | handlers, | 365 | handlers, |
366 | &mq_error_handler, | 366 | &mq_error_handler, |
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index 7547a3402..e81664c41 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c | |||
@@ -388,7 +388,7 @@ do_plugin_connect (void *cls) | |||
388 | struct GNUNET_MQ_Envelope *env; | 388 | struct GNUNET_MQ_Envelope *env; |
389 | 389 | ||
390 | pm->reconnect_task = NULL; | 390 | pm->reconnect_task = NULL; |
391 | pm->mq = GNUNET_CLIENT_connecT (pm->cfg, | 391 | pm->mq = GNUNET_CLIENT_connect (pm->cfg, |
392 | "transport", | 392 | "transport", |
393 | handlers, | 393 | handlers, |
394 | &mq_error_handler, | 394 | &mq_error_handler, |
diff --git a/src/transport/transport_api_offer_hello.c b/src/transport/transport_api_offer_hello.c index 951ab9ba4..e1dca14e3 100644 --- a/src/transport/transport_api_offer_hello.c +++ b/src/transport/transport_api_offer_hello.c | |||
@@ -104,7 +104,7 @@ GNUNET_TRANSPORT_offer_hello (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
104 | GNUNET_free (ohh); | 104 | GNUNET_free (ohh); |
105 | return NULL; | 105 | return NULL; |
106 | } | 106 | } |
107 | ohh->mq = GNUNET_CLIENT_connecT (cfg, | 107 | ohh->mq = GNUNET_CLIENT_connect (cfg, |
108 | "transport", | 108 | "transport", |
109 | NULL, | 109 | NULL, |
110 | NULL, | 110 | NULL, |