diff options
-rw-r--r-- | doc/man/gnunet-nat.1 | 4 | ||||
-rw-r--r-- | src/nat/gnunet-service-nat.c | 4 | ||||
-rw-r--r-- | 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 484537eb03..2ba2363998 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 e7173e57ad..5b5a108eb4 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 3fe97ed851..481bc6fded 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, |