diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-03-09 16:57:01 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-03-09 16:57:11 +0100 |
commit | fd58a3abc404e67e96901e48436922937ea1d629 (patch) | |
tree | aad2e3619fbac8ad881fde59a6d257a4779be998 /src/nat/gnunet-nat.c | |
parent | c0862506a76c168626ecfd32989fd6718c67ff89 (diff) | |
download | gnunet-fd58a3abc404e67e96901e48436922937ea1d629.tar.gz gnunet-fd58a3abc404e67e96901e48436922937ea1d629.zip |
fix issue with NAT logic overwriting port specified by user in manual hole punch; adding some logging
Diffstat (limited to 'src/nat/gnunet-nat.c')
-rw-r--r-- | src/nat/gnunet-nat.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index 80bfb5726..1c5850592 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c | |||
@@ -34,9 +34,9 @@ | |||
34 | static int global_ret; | 34 | static int global_ret; |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Name of section in configuration file to use for | 37 | * Name of section in configuration file to use for |
38 | * additional options. | 38 | * additional options. |
39 | */ | 39 | */ |
40 | static char *section_name; | 40 | static char *section_name; |
41 | 41 | ||
42 | /** | 42 | /** |
@@ -81,7 +81,7 @@ static struct GNUNET_NAT_Handle *nh; | |||
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Listen socket for STUN processing. | 83 | * Listen socket for STUN processing. |
84 | */ | 84 | */ |
85 | static struct GNUNET_NETWORK_Handle *ls; | 85 | static struct GNUNET_NETWORK_Handle *ls; |
86 | 86 | ||
87 | /** | 87 | /** |
@@ -110,7 +110,7 @@ test_finished () | |||
110 | * a function to call whenever our set of 'valid' addresses changes. | 110 | * a function to call whenever our set of 'valid' addresses changes. |
111 | * | 111 | * |
112 | * @param cls closure, NULL | 112 | * @param cls closure, NULL |
113 | * @param add_remove #GNUNET_YES to add a new public IP address, | 113 | * @param add_remove #GNUNET_YES to add a new public IP address, |
114 | * #GNUNET_NO to remove a previous (now invalid) one | 114 | * #GNUNET_NO to remove a previous (now invalid) one |
115 | * @param ac address class the address belongs to | 115 | * @param ac address class the address belongs to |
116 | * @param addr either the previous or the new public IP address | 116 | * @param addr either the previous or the new public IP address |
@@ -123,12 +123,12 @@ address_cb (void *cls, | |||
123 | const struct sockaddr *addr, | 123 | const struct sockaddr *addr, |
124 | socklen_t addrlen) | 124 | socklen_t addrlen) |
125 | { | 125 | { |
126 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 126 | fprintf (stdout, |
127 | "%s %s (%d)\n", | 127 | "%s %s (%d)\n", |
128 | add_remove ? "+" : "-", | 128 | add_remove ? "+" : "-", |
129 | GNUNET_a2s (addr, | 129 | GNUNET_a2s (addr, |
130 | addrlen), | 130 | addrlen), |
131 | (int) ac); | 131 | (int) ac); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
@@ -186,7 +186,7 @@ static void | |||
186 | stun_read_task (void *cls) | 186 | stun_read_task (void *cls) |
187 | { | 187 | { |
188 | ssize_t size; | 188 | ssize_t size; |
189 | 189 | ||
190 | rtask = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, | 190 | rtask = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, |
191 | ls, | 191 | ls, |
192 | &stun_read_task, | 192 | &stun_read_task, |
@@ -204,7 +204,7 @@ stun_read_task (void *cls) | |||
204 | struct sockaddr_storage sa; | 204 | struct sockaddr_storage sa; |
205 | socklen_t salen = sizeof (sa); | 205 | socklen_t salen = sizeof (sa); |
206 | ssize_t ret; | 206 | ssize_t ret; |
207 | 207 | ||
208 | ret = GNUNET_NETWORK_socket_recvfrom (ls, | 208 | ret = GNUNET_NETWORK_socket_recvfrom (ls, |
209 | buf, | 209 | buf, |
210 | size + 1, | 210 | size + 1, |
@@ -318,7 +318,7 @@ run (void *cls, | |||
318 | else if (listen_reversal) | 318 | else if (listen_reversal) |
319 | { | 319 | { |
320 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 320 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
321 | "Use of `-W` only effective in combination with `-i`\n"); | 321 | "Use of `-W` only effective in combination with `-i`\n"); |
322 | global_ret = 1; | 322 | global_ret = 1; |
323 | GNUNET_SCHEDULER_shutdown (); | 323 | GNUNET_SCHEDULER_shutdown (); |
324 | return; | 324 | return; |
@@ -327,7 +327,7 @@ run (void *cls, | |||
327 | if (NULL != remote_addr) | 327 | if (NULL != remote_addr) |
328 | { | 328 | { |
329 | int ret; | 329 | int ret; |
330 | 330 | ||
331 | if ( (NULL == nh) || | 331 | if ( (NULL == nh) || |
332 | (sizeof (struct sockaddr_in) != local_len) ) | 332 | (sizeof (struct sockaddr_in) != local_len) ) |
333 | { | 333 | { |
@@ -365,7 +365,7 @@ run (void *cls, | |||
365 | break; | 365 | break; |
366 | } | 366 | } |
367 | } | 367 | } |
368 | 368 | ||
369 | if (do_stun) | 369 | if (do_stun) |
370 | { | 370 | { |
371 | if (NULL == local_addr) | 371 | if (NULL == local_addr) |