aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-17 15:47:54 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-17 15:47:54 +0000
commit31ef7d36f5c003767aeedee385411f87ad1a9791 (patch)
tree81b843bd3e0a9a6a67b7e2d747be1a01f8c96c24
parent3dc2315c9c73418d37c8390ad7c8400c55be146f (diff)
downloadgnunet-31ef7d36f5c003767aeedee385411f87ad1a9791.tar.gz
gnunet-31ef7d36f5c003767aeedee385411f87ad1a9791.zip
-fix
-rw-r--r--src/nat/nat_test.c11
-rw-r--r--src/nat/test_nat.c19
-rw-r--r--src/nat/test_nat_data.conf4
-rw-r--r--src/nat/test_nat_test.c2
-rw-r--r--src/nat/test_nat_test_data.conf11
5 files changed, 22 insertions, 25 deletions
diff --git a/src/nat/nat_test.c b/src/nat/nat_test.c
index 5704d3484..387a68d8f 100644
--- a/src/nat/nat_test.c
+++ b/src/nat/nat_test.c
@@ -318,7 +318,12 @@ addr_cb (void *cls, int add_remove, const struct sockaddr *addr,
318 if (GNUNET_YES != add_remove) 318 if (GNUNET_YES != add_remove)
319 return; 319 return;
320 if (addrlen != sizeof (struct sockaddr_in)) 320 if (addrlen != sizeof (struct sockaddr_in))
321 {
322 LOG (GNUNET_ERROR_TYPE_DEBUG,
323 "NAT test ignores IPv6 address `%s' returned from NAT library\n",
324 GNUNET_a2s (addr, addrlen));
321 return; /* ignore IPv6 here */ 325 return; /* ignore IPv6 here */
326 }
322 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asking gnunet-nat-server to connect to `%s'\n", 327 LOG (GNUNET_ERROR_TYPE_DEBUG, "Asking gnunet-nat-server to connect to `%s'\n",
323 GNUNET_a2s (addr, addrlen)); 328 GNUNET_a2s (addr, addrlen));
324 sa = (const struct sockaddr_in *) addr; 329 sa = (const struct sockaddr_in *) addr;
@@ -424,6 +429,10 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
424 GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, 429 GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
425 ret->lsock, &do_udp_read, ret); 430 ret->lsock, &do_udp_read, ret);
426 } 431 }
432 LOG (GNUNET_ERROR_TYPE_DEBUG,
433 "NAT test listens on port %u (%s)\n",
434 bnd_port,
435 (GNUNET_YES == is_tcp) ? "tcp" : "udp");
427 ret->nat = 436 ret->nat =
428 GNUNET_NAT_register (cfg, is_tcp, adv_port, 1, addrs, addrlens, 437 GNUNET_NAT_register (cfg, is_tcp, adv_port, 1, addrs, addrlens,
429 &addr_cb, NULL, ret); 438 &addr_cb, NULL, ret);
@@ -443,6 +452,8 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst)
443 struct NatActivity *pos; 452 struct NatActivity *pos;
444 struct ClientActivity *cpos; 453 struct ClientActivity *cpos;
445 454
455 LOG (GNUNET_ERROR_TYPE_DEBUG,
456 "Stopping NAT test\n");
446 while (NULL != (cpos = tst->ca_head)) 457 while (NULL != (cpos = tst->ca_head))
447 { 458 {
448 GNUNET_CONTAINER_DLL_remove (tst->ca_head, tst->ca_tail, cpos); 459 GNUNET_CONTAINER_DLL_remove (tst->ca_head, tst->ca_tail, cpos);
diff --git a/src/nat/test_nat.c b/src/nat/test_nat.c
index 98b57b34d..e7325eb0c 100644
--- a/src/nat/test_nat.c
+++ b/src/nat/test_nat.c
@@ -41,9 +41,6 @@
41#include "gnunet_nat_lib.h" 41#include "gnunet_nat_lib.h"
42 42
43 43
44#define VERBOSE GNUNET_NO
45
46
47/** 44/**
48 * Time to wait before stopping NAT, in seconds 45 * Time to wait before stopping NAT, in seconds
49 */ 46 */
@@ -164,28 +161,14 @@ main (int argc, char *const argv[])
164 "test-nat", 161 "test-nat",
165 "-c", 162 "-c",
166 "test_nat_data.conf", 163 "test_nat_data.conf",
167 "-L",
168#if VERBOSE
169 "DEBUG",
170#else
171 "WARNING",
172#endif
173 NULL 164 NULL
174 }; 165 };
175
176 GNUNET_log_setup ("test-nat", 166 GNUNET_log_setup ("test-nat",
177#if VERBOSE
178 "DEBUG",
179#else
180 "WARNING", 167 "WARNING",
181#endif
182 NULL); 168 NULL);
183
184 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 169 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
185 "Testing NAT library, timeout set to %d seconds\n", TIMEOUT); 170 "Testing NAT library, timeout set to %d seconds\n", TIMEOUT);
186 171 GNUNET_PROGRAM_run (3, argv_prog, "test-nat", "nohelp", options, &run, NULL);
187 GNUNET_PROGRAM_run (5, argv_prog, "test-nat", "nohelp", options, &run, NULL);
188
189 return 0; 172 return 0;
190} 173}
191 174
diff --git a/src/nat/test_nat_data.conf b/src/nat/test_nat_data.conf
index 83bcf8345..7ad00a03c 100644
--- a/src/nat/test_nat_data.conf
+++ b/src/nat/test_nat_data.conf
@@ -36,8 +36,8 @@ USE_LOCALADDR = YES
36 36
37# Should we use ICMP-based NAT traversal to try connect to NATed peers 37# Should we use ICMP-based NAT traversal to try connect to NATed peers
38# or, if we are behind NAT, to allow connections to us? 38# or, if we are behind NAT, to allow connections to us?
39ENABLE_ICMP_CLIENT = YES 39ENABLE_ICMP_CLIENT = NO
40ENABLE_ICMP_SERVER = YES 40ENABLE_ICMP_SERVER = NO
41 41
42# IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; 42# IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY;
43# normal interface IP address for non-NATed peers; 43# normal interface IP address for non-NATed peers;
diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c
index 8f1e03444..891a7633a 100644
--- a/src/nat/test_nat_test.c
+++ b/src/nat/test_nat_test.c
@@ -111,6 +111,8 @@ main (int argc, char *const argv[])
111 GNUNET_break (0 == GNUNET_OS_process_kill (gns, SIGTERM)); 111 GNUNET_break (0 == GNUNET_OS_process_kill (gns, SIGTERM));
112 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (gns)); 112 GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (gns));
113 GNUNET_OS_process_destroy (gns); 113 GNUNET_OS_process_destroy (gns);
114 if (0 != ret)
115 fprintf (stderr, "NAT test failed to report success\n");
114 return ret; 116 return ret;
115} 117}
116 118
diff --git a/src/nat/test_nat_test_data.conf b/src/nat/test_nat_test_data.conf
index f153e1779..1128b37ea 100644
--- a/src/nat/test_nat_test_data.conf
+++ b/src/nat/test_nat_test_data.conf
@@ -12,16 +12,17 @@ PORT = 12345
12 12
13[nat] 13[nat]
14# Are we behind NAT? 14# Are we behind NAT?
15BEHIND_NAT = YES 15BEHIND_NAT = NO
16 16
17# Is the NAT hole-punched? 17# Is the NAT hole-punched?
18PUNCHED_NAT = NO 18PUNCHED_NAT = YES
19 19
20# Disable UPNP by default until it gets cleaner! 20# Disable UPNP by default until it gets cleaner!
21ENABLE_UPNP = YES 21ENABLE_UPNP = NO
22 22
23# Use addresses from the local network interfaces (inluding loopback, but also others) 23# Use addresses from the local network interfaces (inluding loopback, but also others)
24USE_LOCALADDR = YES 24USE_LOCALADDR = YES
25RETURN_LOCAL_ADDRESSES = YES
25 26
26# External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!) 27# External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!)
27# normal interface IP address for non-NATed peers; 28# normal interface IP address for non-NATed peers;
@@ -30,8 +31,8 @@ USE_LOCALADDR = YES
30 31
31# Should we use ICMP-based NAT traversal to try connect to NATed peers 32# Should we use ICMP-based NAT traversal to try connect to NATed peers
32# or, if we are behind NAT, to allow connections to us? 33# or, if we are behind NAT, to allow connections to us?
33ENABLE_ICMP_CLIENT = YES 34ENABLE_ICMP_CLIENT = NO
34ENABLE_ICMP_SERVER = YES 35ENABLE_ICMP_SERVER = NO
35 36
36# IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; 37# IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY;
37# normal interface IP address for non-NATed peers; 38# normal interface IP address for non-NATed peers;