diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-05 20:26:55 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-05 20:26:55 +0100 |
commit | 97b06492321615b8ad3823bf6e6ff8320641ccc4 (patch) | |
tree | 8f58e7943e2a0812374bc4bf8bb122995b00f1ca /src/nat | |
parent | 8c1ee5dd1319bcd9ddb6c55d2104c286b61b2e99 (diff) |
handle 'AUTO' option in manual hole punching setup
Diffstat (limited to 'src/nat')
-rw-r--r-- | src/nat/gnunet-service-nat.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c index 7edee9f5b3..9a87c0586a 100644 --- a/src/nat/gnunet-service-nat.c +++ b/src/nat/gnunet-service-nat.c @@ -29,7 +29,6 @@ * * TODO: * - test and document (!) ICMP based NAT traversal - * - implement manual hole punching support (AUTO missing) * - test manual hole punching support * - implement "more" autoconfig: * + consider moving autoconfig-logic into separate service! @@ -918,6 +917,24 @@ notify_client_external_ipv4_change (void *cls, struct sockaddr_in sa; int have_v4; + /* (0) check if this impacts 'hole_external' */ + if (0 == strcasecmp (ch->hole_external, + "AUTO")) + { + struct LocalAddressList lal; + struct sockaddr_in *s4; + + memset (&lal, 0, sizeof (lal)); + s4 = (struct sockaddr_in *) &lal.addr; + s4->sin_family = AF_INET; + s4->sin_port = htons (ch->ext_dns_port); + lal.af = AF_INET; + lal.ac = GNUNET_NAT_AC_GLOBAL | GNUNET_NAT_AC_MANUAL; + check_notify_client (&lal, + ch, + add); + } + /* (1) check if client cares. */ if (! ch->natted_address) return; @@ -936,7 +953,7 @@ notify_client_external_ipv4_change (void *cls, if (GNUNET_NO == have_v4) return; /* IPv6-only */ - /* build address info */ + /* (2) build address info */ memset (&sa, 0, sizeof (sa)); @@ -1437,8 +1454,7 @@ lookup_hole_external (struct ClientHandle *ch) if (0 == strcasecmp (ch->hole_external, "AUTO")) { - // FIXME: use `external-ip` address(es)! - GNUNET_break (0); // not implemented! + /* handled in #notify_client_external_ipv4_change() */ GNUNET_free (lal); return; } |