aboutsummaryrefslogtreecommitdiff
path: root/src/exit
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-19 18:38:41 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-19 18:38:41 +0200
commitff4d7b51f37f61633766664647e9b148af1e4f0a (patch)
tree500aa14d9452ce90c19dbbb18cfaec0dd51e6ec2 /src/exit
parent9c699755967529e59815561d03b85e9a90d789f8 (diff)
downloadgnunet-ff4d7b51f37f61633766664647e9b148af1e4f0a.tar.gz
gnunet-ff4d7b51f37f61633766664647e9b148af1e4f0a.zip
support multiple DNS resolvers for queries (in DNSSTUB and GNS2DNS resolution for now)
Diffstat (limited to 'src/exit')
-rw-r--r--src/exit/gnunet-daemon-exit.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c
index 0b3cc505a..5cb1ebfd9 100644
--- a/src/exit/gnunet-daemon-exit.c
+++ b/src/exit/gnunet-daemon-exit.c
@@ -458,13 +458,11 @@ GNUNET_NETWORK_STRUCT_END
458 * succeeded. 458 * succeeded.
459 * 459 *
460 * @param cls NULL 460 * @param cls NULL
461 * @param rs the socket that received the response
462 * @param dns the response itself 461 * @param dns the response itself
463 * @param r number of bytes in @a dns 462 * @param r number of bytes in @a dns
464 */ 463 */
465static void 464static void
466process_dns_result (void *cls, 465process_dns_result (void *cls,
467 struct GNUNET_DNSSTUB_RequestSocket *rs,
468 const struct GNUNET_TUN_DnsHeader *dns, 466 const struct GNUNET_TUN_DnsHeader *dns,
469 size_t r) 467 size_t r)
470{ 468{
@@ -479,8 +477,7 @@ process_dns_result (void *cls,
479 return; 477 return;
480 /* Handle case that this is a reply to a request from a CADET DNS channel */ 478 /* Handle case that this is a reply to a request from a CADET DNS channel */
481 ts = channels[dns->id]; 479 ts = channels[dns->id];
482 if ( (NULL == ts) || 480 if (NULL == ts)
483 (ts->specifics.dns.rs != rs) )
484 return; 481 return;
485 LOG (GNUNET_ERROR_TYPE_DEBUG, 482 LOG (GNUNET_ERROR_TYPE_DEBUG,
486 "Got a response from the stub resolver for DNS request received via CADET!\n"); 483 "Got a response from the stub resolver for DNS request received via CADET!\n");
@@ -557,11 +554,11 @@ handle_dns_request (void *cls,
557 dlen); 554 dlen);
558 dout = (struct GNUNET_TUN_DnsHeader *) buf; 555 dout = (struct GNUNET_TUN_DnsHeader *) buf;
559 dout->id = ts->specifics.dns.my_id; 556 dout->id = ts->specifics.dns.my_id;
560 ts->specifics.dns.rs = GNUNET_DNSSTUB_resolve2 (dnsstub, 557 ts->specifics.dns.rs = GNUNET_DNSSTUB_resolve (dnsstub,
561 buf, 558 buf,
562 dlen, 559 dlen,
563 &process_dns_result, 560 &process_dns_result,
564 NULL); 561 NULL);
565 if (NULL == ts->specifics.dns.rs) 562 if (NULL == ts->specifics.dns.rs)
566 { 563 {
567 GNUNET_break_op (0); 564 GNUNET_break_op (0);
@@ -3545,25 +3542,23 @@ advertise_dns_exit ()
3545 }; 3542 };
3546 char *dns_exit; 3543 char *dns_exit;
3547 struct GNUNET_HashCode port; 3544 struct GNUNET_HashCode port;
3548 struct in_addr dns_exit4;
3549 struct in6_addr dns_exit6;
3550 3545
3551 if (GNUNET_YES != 3546 if (GNUNET_YES !=
3552 GNUNET_CONFIGURATION_get_value_yesno (cfg, 3547 GNUNET_CONFIGURATION_get_value_yesno (cfg,
3553 "exit", 3548 "exit",
3554 "EXIT_DNS")) 3549 "EXIT_DNS"))
3555 return; 3550 return;
3551 GNUNET_assert (NULL != (dnsstub = GNUNET_DNSSTUB_start (128)));
3552 dns_exit = NULL;
3553 /* TODO: support using multiple DNS resolvers */
3556 if ( (GNUNET_OK != 3554 if ( (GNUNET_OK !=
3557 GNUNET_CONFIGURATION_get_value_string (cfg, 3555 GNUNET_CONFIGURATION_get_value_string (cfg,
3558 "exit", 3556 "exit",
3559 "DNS_RESOLVER", 3557 "DNS_RESOLVER",
3560 &dns_exit)) || 3558 &dns_exit)) ||
3561 ( (1 != inet_pton (AF_INET, 3559 (GNUNET_OK !=
3562 dns_exit, 3560 GNUNET_DNSSTUB_add_dns_ip (dnsstub,
3563 &dns_exit4)) && 3561 dns_exit)) )
3564 (1 != inet_pton (AF_INET6,
3565 dns_exit,
3566 &dns_exit6)) ) )
3567 { 3562 {
3568 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, 3563 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
3569 "dns", 3564 "dns",