aboutsummaryrefslogtreecommitdiff
path: root/src/nat/gnunet-service-nat.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-05 21:23:02 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-05 21:23:02 +0100
commit1b7f6eea0a06abab9b75b30f021aa6313fccfcd4 (patch)
tree0d726dbd6650997c22a7c17ce833ce53c23bde9e /src/nat/gnunet-service-nat.c
parent07d7291d64688ecf9ef0bf2b663b10a168d5fff2 (diff)
downloadgnunet-1b7f6eea0a06abab9b75b30f021aa6313fccfcd4.tar.gz
gnunet-1b7f6eea0a06abab9b75b30f021aa6313fccfcd4.zip
pass section name instead of specific option via IPC
Diffstat (limited to 'src/nat/gnunet-service-nat.c')
-rw-r--r--src/nat/gnunet-service-nat.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index 8af27af9e..79f806f27 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -30,8 +30,6 @@
30 * TODO: 30 * TODO:
31 * - test and document (!) ICMP based NAT traversal 31 * - test and document (!) ICMP based NAT traversal
32 * - test manual hole punching support 32 * - test manual hole punching support
33 * - consider passing transport plugin name instead of
34 * external IP address string (more flexible!)
35 * - adapt existing transports to use new NAT logic 33 * - adapt existing transports to use new NAT logic
36 * - abandon legacy NAT code 34 * - abandon legacy NAT code
37 * 35 *
@@ -186,6 +184,11 @@ struct ClientHandle
186 char *hole_external; 184 char *hole_external;
187 185
188 /** 186 /**
187 * Name of the configuration section this client cares about.
188 */
189 char *section_name;
190
191 /**
189 * Task for periodically re-running the @e ext_dns DNS lookup. 192 * Task for periodically re-running the @e ext_dns DNS lookup.
190 */ 193 */
191 struct GNUNET_SCHEDULER_Task *ext_dns_task; 194 struct GNUNET_SCHEDULER_Task *ext_dns_task;
@@ -505,7 +508,7 @@ check_register (void *cls,
505 off += alen; 508 off += alen;
506 left -= alen; 509 left -= alen;
507 } 510 }
508 if (left != ntohs (message->hole_external_len)) 511 if (left != ntohs (message->str_len))
509 { 512 {
510 GNUNET_break (0); 513 GNUNET_break (0);
511 return GNUNET_SYSERR; 514 return GNUNET_SYSERR;
@@ -1575,10 +1578,14 @@ handle_register (void *cls,
1575 off += alen; 1578 off += alen;
1576 } 1579 }
1577 1580
1578 ch->hole_external 1581 ch->section_name
1579 = GNUNET_strndup (off, 1582 = GNUNET_strndup (off,
1580 ntohs (message->hole_external_len)); 1583 ntohs (message->str_len));
1581 if (0 != ntohs (message->hole_external_len)) 1584 if (GNUNET_OK ==
1585 GNUNET_CONFIGURATION_get_value_string (cfg,
1586 ch->section_name,
1587 "HOLE_EXTERNAL",
1588 &ch->hole_external))
1582 lookup_hole_external (ch); 1589 lookup_hole_external (ch);
1583 1590
1584 /* Actually send IP address list to client */ 1591 /* Actually send IP address list to client */
@@ -2352,6 +2359,7 @@ client_disconnect_cb (void *cls,
2352 ch->ext_dns = NULL; 2359 ch->ext_dns = NULL;
2353 } 2360 }
2354 GNUNET_free (ch->hole_external); 2361 GNUNET_free (ch->hole_external);
2362 GNUNET_free (ch->section_name);
2355 GNUNET_free (ch); 2363 GNUNET_free (ch);
2356} 2364}
2357 2365