diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-12-16 12:07:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-12-16 12:07:11 +0100 |
commit | 1a5afc122701558b20e95f34115145bb79180f03 (patch) | |
tree | 39263257d5949513238d37c63ea7116d361a18ae /src/nat | |
parent | c26e1a97b2905477723c5e4ddf45d7ae02931cc9 (diff) | |
download | gnunet-1a5afc122701558b20e95f34115145bb79180f03.tar.gz gnunet-1a5afc122701558b20e95f34115145bb79180f03.zip |
fix minor bugs
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/gnunet-nat.c | 67 | ||||
-rw-r--r-- | src/nat/gnunet-service-nat.c | 2 | ||||
-rw-r--r-- | src/nat/nat_api.c | 2 |
3 files changed, 39 insertions, 32 deletions
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index 0574f4355..ff326fe0c 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c | |||
@@ -176,34 +176,38 @@ auto_config_cb (void *cls, | |||
176 | ah = NULL; | 176 | ah = NULL; |
177 | switch (type) | 177 | switch (type) |
178 | { | 178 | { |
179 | case GNUNET_NAT_TYPE_NO_NAT: | 179 | case GNUNET_NAT_TYPE_NO_NAT: |
180 | nat_type = "NO NAT"; | 180 | nat_type = "NO NAT"; |
181 | break; | 181 | break; |
182 | case GNUNET_NAT_TYPE_UNREACHABLE_NAT: | 182 | case GNUNET_NAT_TYPE_UNREACHABLE_NAT: |
183 | nat_type = "NAT but we can traverse"; | 183 | nat_type = "NAT but we can traverse"; |
184 | break; | 184 | break; |
185 | case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT: | 185 | case GNUNET_NAT_TYPE_STUN_PUNCHED_NAT: |
186 | nat_type = "NAT but STUN is able to identify the correct information"; | 186 | nat_type = "NAT but STUN is able to identify the correct information"; |
187 | break; | 187 | break; |
188 | case GNUNET_NAT_TYPE_UPNP_NAT: | 188 | case GNUNET_NAT_TYPE_UPNP_NAT: |
189 | nat_type = "NAT but UPNP opened the ports"; | 189 | nat_type = "NAT but UPNP opened the ports"; |
190 | break; | 190 | break; |
191 | default: | 191 | default: |
192 | SPRINTF (unknown_type, | 192 | SPRINTF (unknown_type, |
193 | "NAT unknown, type %u", | 193 | "NAT unknown, type %u", |
194 | type); | 194 | type); |
195 | nat_type = unknown_type; | 195 | nat_type = unknown_type; |
196 | break; | ||
196 | } | 197 | } |
197 | 198 | ||
198 | PRINTF ("NAT status: %s/%s\n", | 199 | PRINTF ("NAT status: %s/%s\n", |
199 | GNUNET_NAT_status2string (result), | 200 | GNUNET_NAT_status2string (result), |
200 | nat_type); | 201 | nat_type); |
201 | 202 | ||
202 | PRINTF ("SUGGESTED CHANGES:\n"); | 203 | if (NULL != diff) |
203 | GNUNET_CONFIGURATION_iterate_section_values (diff, | 204 | { |
204 | "nat", | 205 | PRINTF ("SUGGESTED CHANGES:\n"); |
205 | &auto_conf_iter, | 206 | GNUNET_CONFIGURATION_iterate_section_values (diff, |
206 | NULL); | 207 | "nat", |
208 | &auto_conf_iter, | ||
209 | NULL); | ||
210 | } | ||
207 | // FIXME: have option to save config | 211 | // FIXME: have option to save config |
208 | test_finished (); | 212 | test_finished (); |
209 | } | 213 | } |
@@ -396,8 +400,18 @@ run (void *cls, | |||
396 | proto = IPPROTO_TCP; | 400 | proto = IPPROTO_TCP; |
397 | if (use_udp) | 401 | if (use_udp) |
398 | proto = IPPROTO_UDP; | 402 | proto = IPPROTO_UDP; |
403 | |||
404 | if (do_auto) | ||
405 | { | ||
406 | ah = GNUNET_NAT_autoconfig_start (c, | ||
407 | &auto_config_cb, | ||
408 | NULL); | ||
409 | } | ||
410 | |||
399 | if (0 == proto) | 411 | if (0 == proto) |
400 | { | 412 | { |
413 | if (do_auto) | ||
414 | return; /* all good, we just run auto config */ | ||
401 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 415 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
402 | "Must specify either TCP or UDP\n"); | 416 | "Must specify either TCP or UDP\n"); |
403 | global_ret = 1; | 417 | global_ret = 1; |
@@ -530,13 +544,6 @@ run (void *cls, | |||
530 | } | 544 | } |
531 | } | 545 | } |
532 | 546 | ||
533 | if (do_auto) | ||
534 | { | ||
535 | ah = GNUNET_NAT_autoconfig_start (c, | ||
536 | &auto_config_cb, | ||
537 | NULL); | ||
538 | } | ||
539 | |||
540 | if (do_stun) | 547 | if (do_stun) |
541 | { | 548 | { |
542 | if (NULL == local_addr) | 549 | if (NULL == local_addr) |
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c index 1ebf75608..0da854883 100644 --- a/src/nat/gnunet-service-nat.c +++ b/src/nat/gnunet-service-nat.c | |||
@@ -351,7 +351,7 @@ match_ipv6 (const char *network, | |||
351 | 351 | ||
352 | if (0 == bits) | 352 | if (0 == bits) |
353 | return GNUNET_YES; | 353 | return GNUNET_YES; |
354 | GNUNET_assert (1 == inet_pton (AF_INET, | 354 | GNUNET_assert (1 == inet_pton (AF_INET6, |
355 | network, | 355 | network, |
356 | &net)); | 356 | &net)); |
357 | memset (&mask, 0, sizeof (mask)); | 357 | memset (&mask, 0, sizeof (mask)); |
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c index cab2b657e..798da0ea6 100644 --- a/src/nat/nat_api.c +++ b/src/nat/nat_api.c | |||
@@ -737,7 +737,7 @@ GNUNET_NAT_status2string (enum GNUNET_NAT_StatusCode err) | |||
737 | case GNUNET_NAT_ERROR_SUCCESS: | 737 | case GNUNET_NAT_ERROR_SUCCESS: |
738 | return _ ("Operation Successful"); | 738 | return _ ("Operation Successful"); |
739 | case GNUNET_NAT_ERROR_IPC_FAILURE: | 739 | case GNUNET_NAT_ERROR_IPC_FAILURE: |
740 | return _ ("Internal Failure (IPC, ...)"); | 740 | return _ ("IPC failure"); |
741 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: | 741 | case GNUNET_NAT_ERROR_INTERNAL_NETWORK_ERROR: |
742 | return _ ("Failure in network subsystem, check permissions."); | 742 | return _ ("Failure in network subsystem, check permissions."); |
743 | case GNUNET_NAT_ERROR_TIMEOUT: | 743 | case GNUNET_NAT_ERROR_TIMEOUT: |