fix minor bugs
authorChristian Grothoff <christian@grothoff.org>
Fri, 16 Dec 2016 11:07:11 +0000 (12:07 +0100)
committerChristian Grothoff <christian@grothoff.org>
Fri, 16 Dec 2016 11:07:11 +0000 (12:07 +0100)
src/nat/gnunet-nat.c
src/nat/gnunet-service-nat.c
src/nat/nat_api.c

index 0574f43559a593d781b58bf85249a34a50cdbcd8..ff326fe0c26751142089cf1462cd6950c08d5f6d 100644 (file)
@@ -176,34 +176,38 @@ auto_config_cb (void *cls,
   ah = NULL;
   switch (type)
   {
-    case GNUNET_NAT_TYPE_NO_NAT:
-      nat_type = "NO NAT";
-      break;
-    case GNUNET_NAT_TYPE_UNREACHABLE_NAT:
-      nat_type = "NAT but we can traverse";
-      break;
-    case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT:
-      nat_type = "NAT but STUN is able to identify the correct information";
-      break;
-    case GNUNET_NAT_TYPE_UPNP_NAT:
-      nat_type = "NAT but UPNP opened the ports";
-      break;
-    default:
-      SPRINTF (unknown_type,
-              "NAT unknown, type %u",
-              type);
-      nat_type = unknown_type;
+  case GNUNET_NAT_TYPE_NO_NAT:
+    nat_type = "NO NAT";
+    break;
+  case GNUNET_NAT_TYPE_UNREACHABLE_NAT:
+    nat_type = "NAT but we can traverse";
+    break;
+  case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT:
+    nat_type = "NAT but STUN is able to identify the correct information";
+    break;
+  case GNUNET_NAT_TYPE_UPNP_NAT:
+    nat_type = "NAT but UPNP opened the ports";
+    break;
+  default:
+    SPRINTF (unknown_type,
+            "NAT unknown, type %u",
+            type);
+    nat_type = unknown_type;
+    break;
   }
 
   PRINTF ("NAT status: %s/%s\n",
          GNUNET_NAT_status2string (result),
          nat_type);
-  
-  PRINTF ("SUGGESTED CHANGES:\n");
-  GNUNET_CONFIGURATION_iterate_section_values (diff,
-                                               "nat",
-                                               &auto_conf_iter,
-                                               NULL);
+
+  if (NULL != diff)
+  {
+    PRINTF ("SUGGESTED CHANGES:\n");
+    GNUNET_CONFIGURATION_iterate_section_values (diff,
+                                                "nat",
+                                                &auto_conf_iter,
+                                                NULL);
+  }
   // FIXME: have option to save config
   test_finished ();
 }
@@ -396,8 +400,18 @@ run (void *cls,
     proto = IPPROTO_TCP;
   if (use_udp)
     proto = IPPROTO_UDP;
+
+  if (do_auto)
+  {
+    ah = GNUNET_NAT_autoconfig_start (c,
+                                     &auto_config_cb,
+                                     NULL);
+  }
+
   if (0 == proto)
   {
+    if (do_auto)
+      return; /* all good, we just run auto config */
     GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
                "Must specify either TCP or UDP\n");
     global_ret = 1;
@@ -530,13 +544,6 @@ run (void *cls,
     }
   }
   
-  if (do_auto)
-  {
-    ah = GNUNET_NAT_autoconfig_start (c,
-                                     &auto_config_cb,
-                                     NULL);
-  }
-
   if (do_stun)
   {
     if (NULL == local_addr)
index 1ebf75608ea81a7abbafc297e4bf76aae3e6afbe..0da85488398607c78b037876973039f55d361922 100644 (file)
@@ -351,7 +351,7 @@ match_ipv6 (const char *network,
   
   if (0 == bits)
     return GNUNET_YES;
-  GNUNET_assert (1 == inet_pton (AF_INET,
+  GNUNET_assert (1 == inet_pton (AF_INET6,
                                 network,
                                 &net));
   memset (&mask, 0, sizeof (mask));
index cab2b657eecee853b3d8355d4e3355af8b59f22d..798da0ea6ea42ea1e1e1cf63510fb4a3fd745551 100644 (file)
@@ -737,7 +737,7 @@ GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err)
   case GNUNET_NAT_ERROR_SUCCESS:
     return _ ("Operation Successful");
   case GNUNET_NAT_ERROR_IPC_FAILURE:
-    return _ ("Internal Failure (IPC, ...)");
+    return _ ("IPC failure");
   case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR:
     return _ ("Failure in network subsystem, check permissions.");
   case GNUNET_NAT_ERROR_TIMEOUT: