-fix
authorChristian Grothoff <christian@grothoff.org>
Thu, 17 May 2012 15:47:54 +0000 (15:47 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 17 May 2012 15:47:54 +0000 (15:47 +0000)
src/nat/nat_test.c
src/nat/test_nat.c
src/nat/test_nat_data.conf
src/nat/test_nat_test.c
src/nat/test_nat_test_data.conf

index 5704d34846b5111758982a40130af67d8179dc4d..387a68d8f77318316944e256c8b9a9f3940a5e5c 100644 (file)
@@ -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);
index 98b57b34de54da9e2a278b8a35ac124ca98f1db9..e7325eb0c6f3415350b68634788acb78fe4e71ae 100644 (file)
@@ -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;
 }
 
index 83bcf8345d04ba7d63427315869bdfa093023cef..7ad00a03c25dac8bb29a35f871b129a4eb739ee3 100644 (file)
@@ -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; 
index 8f1e0344405d6c202f7765a284213a2005d7551d..891a7633ae94f467960395e6838c1a604ede51d4 100644 (file)
@@ -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;
 }
 
index f153e17790561243e6bd47c3fdc95fada407f318..1128b37eab1cf44c36d42e1dacaec81b67ef6fdc 100644 (file)
@@ -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;