aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
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/namestore
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/namestore')
-rw-r--r--src/namestore/gnunet-zoneimport.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 4f4151c94..279bfddea 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -818,13 +818,11 @@ store_completed_cb (void *cls,
818 * Function called with the result of a DNS resolution. 818 * Function called with the result of a DNS resolution.
819 * 819 *
820 * @param cls closure with the `struct Request` 820 * @param cls closure with the `struct Request`
821 * @param rs socket that received the response
822 * @param dns dns response, never NULL 821 * @param dns dns response, never NULL
823 * @param dns_len number of bytes in @a dns 822 * @param dns_len number of bytes in @a dns
824 */ 823 */
825static void 824static void
826process_result (void *cls, 825process_result (void *cls,
827 struct GNUNET_DNSSTUB_RequestSocket *rs,
828 const struct GNUNET_TUN_DnsHeader *dns, 826 const struct GNUNET_TUN_DnsHeader *dns,
829 size_t dns_len) 827 size_t dns_len)
830{ 828{
@@ -833,7 +831,6 @@ process_result (void *cls,
833 struct GNUNET_DNSPARSER_Packet *p; 831 struct GNUNET_DNSPARSER_Packet *p;
834 unsigned int rd_count; 832 unsigned int rd_count;
835 833
836 (void) rs;
837 GNUNET_assert (NULL == req->hn); 834 GNUNET_assert (NULL == req->hn);
838 if (NULL == dns) 835 if (NULL == dns)
839 { 836 {
@@ -970,11 +967,11 @@ submit_req (struct Request *req)
970 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 967 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
971 "Requesting resolution for `%s'\n", 968 "Requesting resolution for `%s'\n",
972 req->hostname); 969 req->hostname);
973 req->rs = GNUNET_DNSSTUB_resolve2 (ctx, 970 req->rs = GNUNET_DNSSTUB_resolve (ctx,
974 req->raw, 971 req->raw,
975 req->raw_len, 972 req->raw_len,
976 &process_result, 973 &process_result,
977 req); 974 req);
978 GNUNET_assert (NULL != req->rs); 975 GNUNET_assert (NULL != req->rs);
979 req->issue_num++; 976 req->issue_num++;
980 last_request = now; 977 last_request = now;
@@ -1396,13 +1393,33 @@ run (void *cls,
1396 (void) args; 1393 (void) args;
1397 (void) cfgfile; 1394 (void) cfgfile;
1398 req_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1395 req_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1399 ctx = GNUNET_DNSSTUB_start (dns_server); 1396 ctx = GNUNET_DNSSTUB_start (256);
1400 if (NULL == ctx) 1397 if (NULL == ctx)
1401 { 1398 {
1402 fprintf (stderr, 1399 fprintf (stderr,
1403 "Failed to initialize GNUnet DNS STUB\n"); 1400 "Failed to initialize GNUnet DNS STUB\n");
1404 return; 1401 return;
1405 } 1402 }
1403 if (NULL == args[1])
1404 {
1405 fprintf (stderr,
1406 "You must provide a list of DNS resolvers on the command line\n");
1407 return;
1408 }
1409 for (unsigned int i=1;NULL != args[i];i++)
1410 {
1411 if (GNUNET_OK !=
1412 GNUNET_DNSSTUB_add_dns_ip (ctx,
1413 args[1]))
1414 {
1415 fprintf (stderr,
1416 "Failed to use `%s' for DNS resolver\n",
1417 args[i]);
1418 return;
1419 }
1420 }
1421
1422
1406 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 1423 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
1407 NULL); 1424 NULL);
1408 ns = GNUNET_NAMESTORE_connect (cfg); 1425 ns = GNUNET_NAMESTORE_connect (cfg);