gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: ensure nat clients get noti


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: ensure nat clients get notifications on disconnect about 'lost' addresses
Date: Sun, 25 Dec 2016 18:35:21 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new d39684f  ensure nat clients get notifications on disconnect about 
'lost' addresses
d39684f is described below

commit d39684ffb508e1697abb283413c9bbbee978b49d
Author: Christian Grothoff <address@hidden>
AuthorDate: Sun Dec 25 18:35:15 2016 +0100

    ensure nat clients get notifications on disconnect about 'lost' addresses
---
 doc/man/gnunet-nat.1         |  4 ++--
 src/nat/gnunet-service-nat.c |  4 ++--
 src/nat/nat_api.c            | 20 ++++++++++++++++++++
 3 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/doc/man/gnunet-nat.1 b/doc/man/gnunet-nat.1
index 484537e..2ba2363 100644
--- a/doc/man/gnunet-nat.1
+++ b/doc/man/gnunet-nat.1
@@ -67,7 +67,7 @@ Watch for connection reversal requests.
 
 \fBBasic examples\fR
 
-We are bound to "0.0.0.0:8080" on UDP and want to obtain all applicable IP 
addresses (BUG: sometimes upnpc fails to create mapping, cause unclear):
+We are bound to "0.0.0.0:8080" on UDP and want to obtain all applicable IP 
addresses:
 
   # gnunet-nat -i 0.0.0.0:8080 -u
 
@@ -75,7 +75,7 @@ We are bound to "::0" on port 8080 on TCP and want to obtain 
all applicable IP a
 
   # gnunet-nat -i '[::0]':8080 -t
 
-We are bound to "127.0.0.1:8080" on UDP and want to obtain all applicable IP 
addresses (BUG: currently fails, also gives IPs from other interfaces in 
output!):
+We are bound to "127.0.0.1:8080" on UDP and want to obtain all applicable IP 
addresses:
 
   # gnunet-nat -i 127.0.0.1:8080 -u
 
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index e7173e5..5b5a108 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -28,8 +28,8 @@
  * knowledge about the local network topology.
  *
  * TODO:
- * - TEST UPnPC/PMP-based NAT traversal
- * - implement STUN processing to classify NAT;
+ * - test ICMP based NAT traversal
+ * - implement & test STUN processing to classify NAT;
  *   basically, open port & try different methods.
  * - implement "more" autoconfig
  * - implement NEW logic for external IP detection
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c
index 3fe97ed..481bc6f 100644
--- a/src/nat/nat_api.c
+++ b/src/nat/nat_api.c
@@ -49,6 +49,11 @@ struct AddrEntry
   struct AddrEntry *prev;
 
   /**
+   * Address class of the address.
+   */
+  enum GNUNET_NAT_AddressClass ac;
+  
+  /**
    * Number of bytes that follow.
    */
   socklen_t addrlen;
@@ -130,11 +135,25 @@ do_connect (void *cls);
 static void
 reconnect (struct GNUNET_NAT_Handle *nh)
 {
+  struct AddrEntry *ae;
+  
   if (NULL != nh->mq)
   {
     GNUNET_MQ_destroy (nh->mq);
     nh->mq = NULL;
   }
+  while (NULL != (ae = nh->ae_head))
+  {
+    GNUNET_CONTAINER_DLL_remove (nh->ae_head,
+                                nh->ae_tail,
+                                ae);
+    nh->address_callback (nh->callback_cls,
+                         GNUNET_NO,
+                         ae->ac,
+                         (const struct sockaddr *) &ae[1],
+                         ae->addrlen);
+    GNUNET_free (ae);
+  }
   nh->reconnect_delay
     = GNUNET_TIME_STD_BACKOFF (nh->reconnect_delay);
   nh->reconnect_task
@@ -260,6 +279,7 @@ handle_address_change_notification (void *cls,
   if (GNUNET_YES == ntohl (acn->add_remove))
   {
     ae = GNUNET_malloc (sizeof (*ae) + alen);
+    ae->ac = ac;
     ae->addrlen = alen;
     GNUNET_memcpy (&ae[1],
                   sa,

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



reply via email to

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