gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (b671c7b -> 21fbcd6)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (b671c7b -> 21fbcd6)
Date: Sun, 25 Dec 2016 00:36:11 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from b671c7b  disambiguate -L option to gnunet-nat
     new 96b2339  improve types, eliminate compiler warning for unused function
     new 21fbcd6  fix upnpc invocation for port mapping with upnpc

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/nat/gnunet-service-nat.c      | 31 +++++++++++++++++++++++++++++++
 src/nat/gnunet-service-nat_mini.c |  5 +++--
 src/nat/nat_api_stun.c            |  4 +---
 src/nat/nat_stun.h                | 21 ++++++++++++---------
 4 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index bf3867f..9ad8db4 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -1059,10 +1059,31 @@ upnp_addr_change_cb (void *cls,
     break;
   case GNUNET_NAT_ERROR_UPNPC_FAILED:
   case GNUNET_NAT_ERROR_UPNPC_TIMEOUT:
+  case GNUNET_NAT_ERROR_IPC_FAILURE:
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "Running upnpc failed: %d\n",
                result);
     return;
+  case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+               "external-ip binary not found\n");
+    return;
+  case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_FAILED:
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               "external-ip binary could not be run\n");
+    return;
+  case GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED:
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+               "upnpc failed to create port mapping\n");
+    return;
+  case GNUNET_NAT_ERROR_EXTERNAL_IP_UTILITY_OUTPUT_INVALID:
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Invalid output from upnpc\n");
+    return;
+  case GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID:
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+               "Invalid address returned by upnpc\n");
+    return;
   default:
     GNUNET_break (0); /* should not be possible */
     return;
@@ -1823,6 +1844,16 @@ shutdown_task (void *cls)
     GNUNET_SCHEDULER_cancel (se->timeout_task);
     GNUNET_free (se);
   }
+  if (NULL != probe_external_ip_task)
+  {
+    GNUNET_SCHEDULER_cancel (probe_external_ip_task);
+    probe_external_ip_task = NULL;
+  }
+  if (NULL != probe_external_ip_op)
+  {
+    GNUNET_NAT_mini_get_external_ipv4_cancel_ (probe_external_ip_op);
+    probe_external_ip_op = NULL;
+  }
   if (NULL != scan_task)
   {
     GNUNET_SCHEDULER_cancel (scan_task);
diff --git a/src/nat/gnunet-service-nat_mini.c 
b/src/nat/gnunet-service-nat_mini.c
index efdc098..e5b9d02 100644
--- a/src/nat/gnunet-service-nat_mini.c
+++ b/src/nat/gnunet-service-nat_mini.c
@@ -139,7 +139,7 @@ read_external_ipv4 (void *cls)
                        eh->buf,
                        &addr))
     {
-      if (0 != addr.s_addr)
+      if (0 == addr.s_addr)
         eh->ret = GNUNET_NAT_ERROR_EXTERNAL_IP_ADDRESS_INVALID;       /* got 
0.0.0.0 */
       else
         eh->ret = GNUNET_NAT_ERROR_SUCCESS;
@@ -578,7 +578,8 @@ process_map_output (void *cls,
     if (GNUNET_YES != mini->did_map)
       mini->ac (mini->ac_cls,
                 GNUNET_SYSERR,
-                NULL, 0,
+                NULL,
+               0,
                 GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED);
     if (NULL == mini->refresh_task)
       mini->refresh_task 
diff --git a/src/nat/nat_api_stun.c b/src/nat/nat_api_stun.c
index 8f5a5f8..7f2ef4e 100644
--- a/src/nat/nat_api_stun.c
+++ b/src/nat/nat_api_stun.c
@@ -199,9 +199,7 @@ stun_dns_callback (void *cls,
 
 /**
  * Make Generic STUN request. Sends a generic stun request to the
- * server specified using the specified socket, possibly waiting for
- * a reply and filling the 'reply' field with the externally visible
- * address.
+ * server specified using the specified socket.  
  *
  * @param server the address of the stun server
  * @param port port of the stun server, in host byte order
diff --git a/src/nat/nat_stun.h b/src/nat/nat_stun.h
index 4c6c178..3e42288 100644
--- a/src/nat/nat_stun.h
+++ b/src/nat/nat_stun.h
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     Copyright (C) 2009, 2015 GNUnet e.V.
+     Copyright (C) 2009, 2015, 2016 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -135,23 +135,24 @@ enum StunAttributes {
  * @param msg the received message
  * @return the converted StunClass
  */
-static int
-decode_class(int msg)
+static enum StunClasses
+decode_class (int msg)
 {
   /* Sorry for the magic, but this maps the class according to rfc5245 */
-  return ((msg & 0x0010) >> 4) | ((msg & 0x0100) >> 7);
+  return (enum StunClasses) ((msg & 0x0010) >> 4) | ((msg & 0x0100) >> 7);
 }
 
+
 /**
  * Convert a message to a StunMethod
  *
  * @param msg the received message
  * @return the converted StunMethod
  */
-static int
-decode_method(int msg)
+static enum StunMethods
+decode_method (int msg)
 {
-  return (msg & 0x000f) | ((msg & 0x00e0) >> 1) | ((msg & 0x3e00) >> 2);
+  return (enum StunMethods) (msg & 0x000f) | ((msg & 0x00e0) >> 1) | ((msg & 
0x3e00) >> 2);
 }
 
 
@@ -161,6 +162,7 @@ decode_method(int msg)
  * @param msg
  * @return string with the message class and method
  */
+GNUNET_UNUSED
 static const char *
 stun_msg2str (int msg)
 {
@@ -172,14 +174,14 @@ stun_msg2str (int msg)
     { STUN_INDICATION, "Indication" },
     { STUN_RESPONSE, "Response" },
     { STUN_ERROR_RESPONSE, "Error Response" },
-    { 0, NULL }
+    { INVALID_CLASS, NULL }
   };
   static const struct {
     enum StunMethods value;
     const char *name;
   } methods[] = {
     { STUN_BINDING, "Binding" },
-    { 0, NULL }
+    { INVALID_METHOD, NULL }
   };
   static char result[64];
   const char *msg_class = NULL;
@@ -215,6 +217,7 @@ stun_msg2str (int msg)
  * @param msg with a attribute type
  * @return string with the attribute name
  */
+GNUNET_UNUSED
 static const char *
 stun_attr2str (enum StunAttributes msg)
 {

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]