aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/gnunet-nat.14
-rw-r--r--src/nat/gnunet-service-nat.c4
-rw-r--r--src/nat/nat_api.c20
3 files changed, 24 insertions, 4 deletions
diff --git a/doc/man/gnunet-nat.1 b/doc/man/gnunet-nat.1
index 484537eb0..2ba236399 100644
--- a/doc/man/gnunet-nat.1
+++ b/doc/man/gnunet-nat.1
@@ -67,7 +67,7 @@ Watch for connection reversal requests.
67 67
68\fBBasic examples\fR 68\fBBasic examples\fR
69 69
70We 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): 70We are bound to "0.0.0.0:8080" on UDP and want to obtain all applicable IP addresses:
71 71
72 # gnunet-nat -i 0.0.0.0:8080 -u 72 # gnunet-nat -i 0.0.0.0:8080 -u
73 73
@@ -75,7 +75,7 @@ We are bound to "::0" on port 8080 on TCP and want to obtain all applicable IP a
75 75
76 # gnunet-nat -i '[::0]':8080 -t 76 # gnunet-nat -i '[::0]':8080 -t
77 77
78We 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!): 78We are bound to "127.0.0.1:8080" on UDP and want to obtain all applicable IP addresses:
79 79
80 # gnunet-nat -i 127.0.0.1:8080 -u 80 # gnunet-nat -i 127.0.0.1:8080 -u
81 81
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index e7173e57a..5b5a108eb 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -28,8 +28,8 @@
28 * knowledge about the local network topology. 28 * knowledge about the local network topology.
29 * 29 *
30 * TODO: 30 * TODO:
31 * - TEST UPnPC/PMP-based NAT traversal 31 * - test ICMP based NAT traversal
32 * - implement STUN processing to classify NAT; 32 * - implement & test STUN processing to classify NAT;
33 * basically, open port & try different methods. 33 * basically, open port & try different methods.
34 * - implement "more" autoconfig 34 * - implement "more" autoconfig
35 * - implement NEW logic for external IP detection 35 * - implement NEW logic for external IP detection
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c
index 3fe97ed85..481bc6fde 100644
--- a/src/nat/nat_api.c
+++ b/src/nat/nat_api.c
@@ -49,6 +49,11 @@ struct AddrEntry
49 struct AddrEntry *prev; 49 struct AddrEntry *prev;
50 50
51 /** 51 /**
52 * Address class of the address.
53 */
54 enum GNUNET_NAT_AddressClass ac;
55
56 /**
52 * Number of bytes that follow. 57 * Number of bytes that follow.
53 */ 58 */
54 socklen_t addrlen; 59 socklen_t addrlen;
@@ -130,11 +135,25 @@ do_connect (void *cls);
130static void 135static void
131reconnect (struct GNUNET_NAT_Handle *nh) 136reconnect (struct GNUNET_NAT_Handle *nh)
132{ 137{
138 struct AddrEntry *ae;
139
133 if (NULL != nh->mq) 140 if (NULL != nh->mq)
134 { 141 {
135 GNUNET_MQ_destroy (nh->mq); 142 GNUNET_MQ_destroy (nh->mq);
136 nh->mq = NULL; 143 nh->mq = NULL;
137 } 144 }
145 while (NULL != (ae = nh->ae_head))
146 {
147 GNUNET_CONTAINER_DLL_remove (nh->ae_head,
148 nh->ae_tail,
149 ae);
150 nh->address_callback (nh->callback_cls,
151 GNUNET_NO,
152 ae->ac,
153 (const struct sockaddr *) &ae[1],
154 ae->addrlen);
155 GNUNET_free (ae);
156 }
138 nh->reconnect_delay 157 nh->reconnect_delay
139 = GNUNET_TIME_STD_BACKOFF (nh->reconnect_delay); 158 = GNUNET_TIME_STD_BACKOFF (nh->reconnect_delay);
140 nh->reconnect_task 159 nh->reconnect_task
@@ -260,6 +279,7 @@ handle_address_change_notification (void *cls,
260 if (GNUNET_YES == ntohl (acn->add_remove)) 279 if (GNUNET_YES == ntohl (acn->add_remove))
261 { 280 {
262 ae = GNUNET_malloc (sizeof (*ae) + alen); 281 ae = GNUNET_malloc (sizeof (*ae) + alen);
282 ae->ac = ac;
263 ae->addrlen = alen; 283 ae->addrlen = alen;
264 GNUNET_memcpy (&ae[1], 284 GNUNET_memcpy (&ae[1],
265 sa, 285 sa,