From: Christian Grothoff Date: Thu, 17 May 2012 15:47:54 +0000 (+0000) Subject: -fix X-Git-Tag: initial-import-from-subversion-38251~13447 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=31ef7d36f5c003767aeedee385411f87ad1a9791;p=oweals%2Fgnunet.git -fix --- 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, if (GNUNET_YES != add_remove) return; if (addrlen != sizeof (struct sockaddr_in)) + { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "NAT test ignores IPv6 address `%s' returned from NAT library\n", + GNUNET_a2s (addr, addrlen)); return; /* ignore IPv6 here */ + } LOG (GNUNET_ERROR_TYPE_DEBUG, "Asking gnunet-nat-server to connect to `%s'\n", GNUNET_a2s (addr, addrlen)); sa = (const struct sockaddr_in *) addr; @@ -424,6 +429,10 @@ GNUNET_NAT_test_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, ret->lsock, &do_udp_read, ret); } + LOG (GNUNET_ERROR_TYPE_DEBUG, + "NAT test listens on port %u (%s)\n", + bnd_port, + (GNUNET_YES == is_tcp) ? "tcp" : "udp"); ret->nat = GNUNET_NAT_register (cfg, is_tcp, adv_port, 1, addrs, addrlens, &addr_cb, NULL, ret); @@ -443,6 +452,8 @@ GNUNET_NAT_test_stop (struct GNUNET_NAT_Test *tst) struct NatActivity *pos; struct ClientActivity *cpos; + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Stopping NAT test\n"); while (NULL != (cpos = tst->ca_head)) { 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 @@ #include "gnunet_nat_lib.h" -#define VERBOSE GNUNET_NO - - /** * Time to wait before stopping NAT, in seconds */ @@ -164,28 +161,14 @@ main (int argc, char *const argv[]) "test-nat", "-c", "test_nat_data.conf", - "-L", -#if VERBOSE - "DEBUG", -#else - "WARNING", -#endif NULL }; - GNUNET_log_setup ("test-nat", -#if VERBOSE - "DEBUG", -#else "WARNING", -#endif NULL); - GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Testing NAT library, timeout set to %d seconds\n", TIMEOUT); - - GNUNET_PROGRAM_run (5, argv_prog, "test-nat", "nohelp", options, &run, NULL); - + GNUNET_PROGRAM_run (3, argv_prog, "test-nat", "nohelp", options, &run, NULL); return 0; } 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 # Should we use ICMP-based NAT traversal to try connect to NATed peers # or, if we are behind NAT, to allow connections to us? -ENABLE_ICMP_CLIENT = YES -ENABLE_ICMP_SERVER = YES +ENABLE_ICMP_CLIENT = NO +ENABLE_ICMP_SERVER = NO # IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; # 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[]) GNUNET_break (0 == GNUNET_OS_process_kill (gns, SIGTERM)); GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (gns)); GNUNET_OS_process_destroy (gns); + if (0 != ret) + fprintf (stderr, "NAT test failed to report success\n"); return ret; } 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 [nat] # Are we behind NAT? -BEHIND_NAT = YES +BEHIND_NAT = NO # Is the NAT hole-punched? -PUNCHED_NAT = NO +PUNCHED_NAT = YES # Disable UPNP by default until it gets cleaner! -ENABLE_UPNP = YES +ENABLE_UPNP = NO # Use addresses from the local network interfaces (inluding loopback, but also others) USE_LOCALADDR = YES +RETURN_LOCAL_ADDRESSES = YES # External IP address of the NAT box (if known); IPv4 dotted-decimal ONLY at this time (should allow DynDNS!) # normal interface IP address for non-NATed peers; @@ -30,8 +31,8 @@ USE_LOCALADDR = YES # Should we use ICMP-based NAT traversal to try connect to NATed peers # or, if we are behind NAT, to allow connections to us? -ENABLE_ICMP_CLIENT = YES -ENABLE_ICMP_SERVER = YES +ENABLE_ICMP_CLIENT = NO +ENABLE_ICMP_SERVER = NO # IP address of the interface connected to the NAT box; IPv4 dotted-decimal ONLY; # normal interface IP address for non-NATed peers;