aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-05 20:26:55 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-05 20:26:55 +0100
commit97b06492321615b8ad3823bf6e6ff8320641ccc4 (patch)
tree8f58e7943e2a0812374bc4bf8bb122995b00f1ca /src
parent8c1ee5dd1319bcd9ddb6c55d2104c286b61b2e99 (diff)
downloadgnunet-97b06492321615b8ad3823bf6e6ff8320641ccc4.tar.gz
gnunet-97b06492321615b8ad3823bf6e6ff8320641ccc4.zip
handle 'AUTO' option in manual hole punching setup
Diffstat (limited to 'src')
-rw-r--r--src/nat/gnunet-service-nat.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index 7edee9f5b..9a87c0586 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -29,7 +29,6 @@
29 * 29 *
30 * TODO: 30 * TODO:
31 * - test and document (!) ICMP based NAT traversal 31 * - test and document (!) ICMP based NAT traversal
32 * - implement manual hole punching support (AUTO missing)
33 * - test manual hole punching support 32 * - test manual hole punching support
34 * - implement "more" autoconfig: 33 * - implement "more" autoconfig:
35 * + consider moving autoconfig-logic into separate service! 34 * + consider moving autoconfig-logic into separate service!
@@ -918,6 +917,24 @@ notify_client_external_ipv4_change (void *cls,
918 struct sockaddr_in sa; 917 struct sockaddr_in sa;
919 int have_v4; 918 int have_v4;
920 919
920 /* (0) check if this impacts 'hole_external' */
921 if (0 == strcasecmp (ch->hole_external,
922 "AUTO"))
923 {
924 struct LocalAddressList lal;
925 struct sockaddr_in *s4;
926
927 memset (&lal, 0, sizeof (lal));
928 s4 = (struct sockaddr_in *) &lal.addr;
929 s4->sin_family = AF_INET;
930 s4->sin_port = htons (ch->ext_dns_port);
931 lal.af = AF_INET;
932 lal.ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL;
933 check_notify_client (&lal,
934 ch,
935 add);
936 }
937
921 /* (1) check if client cares. */ 938 /* (1) check if client cares. */
922 if (! ch->natted_address) 939 if (! ch->natted_address)
923 return; 940 return;
@@ -936,7 +953,7 @@ notify_client_external_ipv4_change (void *cls,
936 if (GNUNET_NO == have_v4) 953 if (GNUNET_NO == have_v4)
937 return; /* IPv6-only */ 954 return; /* IPv6-only */
938 955
939 /* build address info */ 956 /* (2) build address info */
940 memset (&sa, 957 memset (&sa,
941 0, 958 0,
942 sizeof (sa)); 959 sizeof (sa));
@@ -1437,8 +1454,7 @@ lookup_hole_external (struct ClientHandle *ch)
1437 if (0 == strcasecmp (ch->hole_external, 1454 if (0 == strcasecmp (ch->hole_external,
1438 "AUTO")) 1455 "AUTO"))
1439 { 1456 {
1440 // FIXME: use `external-ip` address(es)! 1457 /* handled in #notify_client_external_ipv4_change() */
1441 GNUNET_break (0); // not implemented!
1442 GNUNET_free (lal); 1458 GNUNET_free (lal);
1443 return; 1459 return;
1444 } 1460 }