aboutsummaryrefslogtreecommitdiff
path: root/src/nat/gnunet-service-nat_mini.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-12-18 07:35:34 +0100
committerChristian Grothoff <christian@grothoff.org>2016-12-18 07:35:34 +0100
commit605227ee99846471196e222c6c25cafbe0a64232 (patch)
treec8e018743aeca724111fac8ca5c544984ce303eb /src/nat/gnunet-service-nat_mini.c
parentbc4a5aeac8a6f1a1d25b118a26233d4fe7d23741 (diff)
downloadgnunet-605227ee99846471196e222c6c25cafbe0a64232.tar.gz
gnunet-605227ee99846471196e222c6c25cafbe0a64232.zip
properly process external IP addresses from upnpc-based hole punching
Diffstat (limited to 'src/nat/gnunet-service-nat_mini.c')
-rw-r--r--src/nat/gnunet-service-nat_mini.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nat/gnunet-service-nat_mini.c b/src/nat/gnunet-service-nat_mini.c
index 658ec72b7..efdc0988b 100644
--- a/src/nat/gnunet-service-nat_mini.c
+++ b/src/nat/gnunet-service-nat_mini.c
@@ -431,7 +431,7 @@ process_refresh_output (void *cls,
431 } 431 }
432 return; 432 return;
433 } 433 }
434 if (!mini->did_map) 434 if (! mini->did_map)
435 return; /* never mapped, won't find our mapping anyway */ 435 return; /* never mapped, won't find our mapping anyway */
436 436
437 /* we're looking for output of the form: 437 /* we're looking for output of the form:
@@ -538,8 +538,8 @@ do_refresh (void *cls)
538 mini->refresh_cmd = NULL; 538 mini->refresh_cmd = NULL;
539 ac = GNUNET_YES; 539 ac = GNUNET_YES;
540 } 540 }
541 mini->refresh_cmd = 541 mini->refresh_cmd
542 GNUNET_OS_command_run (&process_refresh_output, 542 = GNUNET_OS_command_run (&process_refresh_output,
543 mini, 543 mini,
544 MAP_TIMEOUT, 544 MAP_TIMEOUT,
545 "upnpc", 545 "upnpc",
@@ -581,10 +581,10 @@ process_map_output (void *cls,
581 NULL, 0, 581 NULL, 0,
582 GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED); 582 GNUNET_NAT_ERROR_UPNPC_PORTMAP_FAILED);
583 if (NULL == mini->refresh_task) 583 if (NULL == mini->refresh_task)
584 mini->refresh_task = 584 mini->refresh_task
585 GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ, 585 = GNUNET_SCHEDULER_add_delayed (MAP_REFRESH_FREQ,
586 &do_refresh, 586 &do_refresh,
587 mini); 587 mini);
588 return; 588 return;
589 } 589 }
590 /* 590 /*
@@ -600,7 +600,9 @@ process_map_output (void *cls,
600 } 600 }
601 ipa = GNUNET_strdup (ipaddr + 1); 601 ipa = GNUNET_strdup (ipaddr + 1);
602 strstr (ipa, ":")[0] = '\0'; 602 strstr (ipa, ":")[0] = '\0';
603 if (1 != inet_pton (AF_INET, ipa, &mini->current_addr.sin_addr)) 603 if (1 != inet_pton (AF_INET,
604 ipa,
605 &mini->current_addr.sin_addr))
604 { 606 {
605 GNUNET_free (ipa); 607 GNUNET_free (ipa);
606 return; /* skip line */ 608 return; /* skip line */
@@ -613,7 +615,8 @@ process_map_output (void *cls,
613 mini->current_addr.sin_len = sizeof (struct sockaddr_in); 615 mini->current_addr.sin_len = sizeof (struct sockaddr_in);
614#endif 616#endif
615 mini->did_map = GNUNET_YES; 617 mini->did_map = GNUNET_YES;
616 mini->ac (mini->ac_cls, GNUNET_YES, 618 mini->ac (mini->ac_cls,
619 GNUNET_YES,
617 (const struct sockaddr *) &mini->current_addr, 620 (const struct sockaddr *) &mini->current_addr,
618 sizeof (mini->current_addr), 621 sizeof (mini->current_addr),
619 GNUNET_NAT_ERROR_SUCCESS); 622 GNUNET_NAT_ERROR_SUCCESS);