aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-04-23 15:02:30 +0200
committerChristian Grothoff <christian@grothoff.org>2018-04-23 15:02:30 +0200
commit3e2b9dc6d520b6be53a3c41a112f224df12d9f99 (patch)
treee00acaef75ca58a934f51a9bc848d28f88f0583c /src/namestore
parentd6e1cea9a8b3a1eee91e52eb46adc82e2005b975 (diff)
parente1f46c052dca3cd7a390f18f97b10162fe537a15 (diff)
downloadgnunet-3e2b9dc6d520b6be53a3c41a112f224df12d9f99.tar.gz
gnunet-3e2b9dc6d520b6be53a3c41a112f224df12d9f99.zip
merge conflict resolution
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/Makefile.am4
-rw-r--r--src/namestore/gnunet-namestore.c2
-rw-r--r--src/namestore/gnunet-service-namestore.c16
-rw-r--r--src/namestore/gnunet-zoneimport.c70
-rw-r--r--src/namestore/namestore_api.c2
-rw-r--r--src/namestore/plugin_rest_namestore.c2
6 files changed, 52 insertions, 44 deletions
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index fd8f8054f..5f18506a7 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -124,9 +124,7 @@ libexec_PROGRAMS = \
124 gnunet-service-namestore 124 gnunet-service-namestore
125 125
126bin_PROGRAMS = \ 126bin_PROGRAMS = \
127 gnunet-namestore 127 gnunet-namestore \
128
129noinst_PROGRAMS = \
130 gnunet-zoneimport 128 gnunet-zoneimport
131 129
132if HAVE_MHD 130if HAVE_MHD
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 9a1805af4..660737595 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -408,7 +408,7 @@ display_record (void *cls,
408 { 408 {
409 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && 409 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
410 (0 != strcmp (rname, 410 (0 != strcmp (rname,
411 GNUNET_GNS_MASTERZONE_STR)) ) 411 GNUNET_GNS_EMPTY_LABEL_AT)) )
412 continue; 412 continue;
413 typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); 413 typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
414 s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type, 414 s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 3a3291c07..3685c93af 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -362,13 +362,13 @@ client_connect_cb (void *cls,
362 362
363 363
364/** 364/**
365 * Function called with the records for the #GNUNET_GNS_MASTERZONE_STR 365 * Function called with the records for the #GNUNET_GNS_EMPTY_LABEL_AT
366 * label in the zone. Used to locate the #GNUNET_GNSRECORD_TYPE_NICK 366 * label in the zone. Used to locate the #GNUNET_GNSRECORD_TYPE_NICK
367 * record, which (if found) is then copied to @a cls for future use. 367 * record, which (if found) is then copied to @a cls for future use.
368 * 368 *
369 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found) 369 * @param cls a `struct GNUNET_GNSRECORD_Data **` for storing the nick (if found)
370 * @param private_key the private key of the zone (unused) 370 * @param private_key the private key of the zone (unused)
371 * @param label should be #GNUNET_GNS_MASTERZONE_STR 371 * @param label should be #GNUNET_GNS_EMPTY_LABEL_AT
372 * @param rd_count number of records in @a rd 372 * @param rd_count number of records in @a rd
373 * @param rd records stored under @a label in the zone 373 * @param rd records stored under @a label in the zone
374 */ 374 */
@@ -382,7 +382,7 @@ lookup_nick_it (void *cls,
382 struct GNUNET_GNSRECORD_Data **res = cls; 382 struct GNUNET_GNSRECORD_Data **res = cls;
383 383
384 (void) private_key; 384 (void) private_key;
385 if (0 != strcmp (label, GNUNET_GNS_MASTERZONE_STR)) 385 if (0 != strcmp (label, GNUNET_GNS_EMPTY_LABEL_AT))
386 { 386 {
387 GNUNET_break (0); 387 GNUNET_break (0);
388 return; 388 return;
@@ -423,7 +423,7 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
423 nick = NULL; 423 nick = NULL;
424 res = GSN_database->lookup_records (GSN_database->cls, 424 res = GSN_database->lookup_records (GSN_database->cls,
425 zone, 425 zone,
426 GNUNET_GNS_MASTERZONE_STR, 426 GNUNET_GNS_EMPTY_LABEL_AT,
427 &lookup_nick_it, 427 &lookup_nick_it,
428 &nick); 428 &nick);
429 if ( (GNUNET_OK != res) || 429 if ( (GNUNET_OK != res) ||
@@ -531,7 +531,7 @@ send_lookup_response (struct NamestoreClient *nc,
531 char *rd_ser; 531 char *rd_ser;
532 532
533 nick = get_nick_record (zone_key); 533 nick = get_nick_record (zone_key);
534 if ((NULL != nick) && (0 != strcmp(name, GNUNET_GNS_MASTERZONE_STR))) 534 if ((NULL != nick) && (0 != strcmp(name, GNUNET_GNS_EMPTY_LABEL_AT)))
535 { 535 {
536 nick->flags = (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; 536 nick->flags = (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
537 merge_with_nick_records (nick, 537 merge_with_nick_records (nick,
@@ -766,7 +766,7 @@ lookup_it (void *cls,
766 { 766 {
767 if ( (NULL != rlc->nick) && 767 if ( (NULL != rlc->nick) &&
768 (0 != strcmp (label, 768 (0 != strcmp (label,
769 GNUNET_GNS_MASTERZONE_STR)) ) 769 GNUNET_GNS_EMPTY_LABEL_AT)) )
770 { 770 {
771 /* Merge */ 771 /* Merge */
772 rd_res = NULL; 772 rd_res = NULL;
@@ -1043,12 +1043,12 @@ handle_record_store (void *cls,
1043 unsigned int rd_clean_off; 1043 unsigned int rd_clean_off;
1044 1044
1045 /* remove "NICK" records, unless this is for the 1045 /* remove "NICK" records, unless this is for the
1046 #GNUNET_GNS_MASTERZONE_STR label */ 1046 #GNUNET_GNS_EMPTY_LABEL_AT label */
1047 rd_clean_off = 0; 1047 rd_clean_off = 0;
1048 for (unsigned int i=0;i<rd_count;i++) 1048 for (unsigned int i=0;i<rd_count;i++)
1049 { 1049 {
1050 rd_clean[rd_clean_off] = rd[i]; 1050 rd_clean[rd_clean_off] = rd[i];
1051 if ( (0 == strcmp (GNUNET_GNS_MASTERZONE_STR, 1051 if ( (0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT,
1052 conv_name)) || 1052 conv_name)) ||
1053 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) ) 1053 (GNUNET_GNSRECORD_TYPE_NICK != rd[i].record_type) )
1054 rd_clean_off++; 1054 rd_clean_off++;
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index a01772e67..2926fe9bd 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -21,9 +21,6 @@
21 * @file src/namestore/gnunet-zoneimport.c 21 * @file src/namestore/gnunet-zoneimport.c
22 * @brief import a DNS zone for publication in GNS, incremental 22 * @brief import a DNS zone for publication in GNS, incremental
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 *
25 * TODO:
26 * - set NICKname for zone's records
27 */ 24 */
28#include "platform.h" 25#include "platform.h"
29#include <gnunet_util_lib.h> 26#include <gnunet_util_lib.h>
@@ -50,11 +47,6 @@
50 */ 47 */
51#define MAX_RETRIES 5 48#define MAX_RETRIES 5
52 49
53/**
54 * After how many lookups should we always sync to disk?
55 */
56#define TRANSACTION_SYNC_FREQ 100
57
58 50
59/** 51/**
60 * Some zones may include authoritative records for other 52 * Some zones may include authoritative records for other
@@ -165,9 +157,9 @@ struct Request
165 157
166 /** 158 /**
167 * Namestore operation pending for this record. 159 * Namestore operation pending for this record.
168 */ 160 */
169 struct GNUNET_NAMESTORE_QueueEntry *qe; 161 struct GNUNET_NAMESTORE_QueueEntry *qe;
170 162
171 /** 163 /**
172 * Zone responsible for this request. 164 * Zone responsible for this request.
173 */ 165 */
@@ -481,7 +473,7 @@ check_for_glue (void *cls,
481 } 473 }
482 if (NULL == 474 if (NULL ==
483 inet_ntop (AF_INET, 475 inet_ntop (AF_INET,
484 &rec->data.raw.data, 476 rec->data.raw.data,
485 ip, 477 ip,
486 ip_size)) 478 ip_size))
487 { 479 {
@@ -515,7 +507,7 @@ check_for_glue (void *cls,
515 } 507 }
516 if (NULL == 508 if (NULL ==
517 inet_ntop (AF_INET6, 509 inet_ntop (AF_INET6,
518 &rec->data.raw.data, 510 rec->data.raw.data,
519 ip, 511 ip,
520 ip_size)) 512 ip_size))
521 { 513 {
@@ -801,6 +793,7 @@ store_completed_cb (void *cls,
801{ 793{
802 static unsigned int pdot; 794 static unsigned int pdot;
803 struct Request *req = cls; 795 struct Request *req = cls;
796 struct Record *rec;
804 797
805 req->qe = NULL; 798 req->qe = NULL;
806 pending--; 799 pending--;
@@ -820,6 +813,14 @@ store_completed_cb (void *cls,
820 if (0 == pdot % 1000) 813 if (0 == pdot % 1000)
821 fprintf (stderr, "."); 814 fprintf (stderr, ".");
822 } 815 }
816 /* Free records */
817 while (NULL != (rec = req->rec_head))
818 {
819 GNUNET_CONTAINER_DLL_remove (req->rec_head,
820 req->rec_tail,
821 rec);
822 GNUNET_free (rec);
823 }
823} 824}
824 825
825 826
@@ -827,13 +828,11 @@ store_completed_cb (void *cls,
827 * Function called with the result of a DNS resolution. 828 * Function called with the result of a DNS resolution.
828 * 829 *
829 * @param cls closure with the `struct Request` 830 * @param cls closure with the `struct Request`
830 * @param rs socket that received the response
831 * @param dns dns response, never NULL 831 * @param dns dns response, never NULL
832 * @param dns_len number of bytes in @a dns 832 * @param dns_len number of bytes in @a dns
833 */ 833 */
834static void 834static void
835process_result (void *cls, 835process_result (void *cls,
836 struct GNUNET_DNSSTUB_RequestSocket *rs,
837 const struct GNUNET_TUN_DnsHeader *dns, 836 const struct GNUNET_TUN_DnsHeader *dns,
838 size_t dns_len) 837 size_t dns_len)
839{ 838{
@@ -842,7 +841,6 @@ process_result (void *cls,
842 struct GNUNET_DNSPARSER_Packet *p; 841 struct GNUNET_DNSPARSER_Packet *p;
843 unsigned int rd_count; 842 unsigned int rd_count;
844 843
845 (void) rs;
846 GNUNET_assert (NULL == req->hn); 844 GNUNET_assert (NULL == req->hn);
847 if (NULL == dns) 845 if (NULL == dns)
848 { 846 {
@@ -889,14 +887,6 @@ process_result (void *cls,
889 pending--; 887 pending--;
890 return; 888 return;
891 } 889 }
892 /* Free old/legacy records */
893 while (NULL != (rec = req->rec_head))
894 {
895 GNUNET_CONTAINER_DLL_remove (req->rec_head,
896 req->rec_tail,
897 rec);
898 GNUNET_free (rec);
899 }
900 /* import new records */ 890 /* import new records */
901 req->issue_num = 0; /* success, reset counter! */ 891 req->issue_num = 0; /* success, reset counter! */
902 req->p = p; 892 req->p = p;
@@ -979,11 +969,11 @@ submit_req (struct Request *req)
979 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 969 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
980 "Requesting resolution for `%s'\n", 970 "Requesting resolution for `%s'\n",
981 req->hostname); 971 req->hostname);
982 req->rs = GNUNET_DNSSTUB_resolve2 (ctx, 972 req->rs = GNUNET_DNSSTUB_resolve (ctx,
983 req->raw, 973 req->raw,
984 req->raw_len, 974 req->raw_len,
985 &process_result, 975 &process_result,
986 req); 976 req);
987 GNUNET_assert (NULL != req->rs); 977 GNUNET_assert (NULL != req->rs);
988 req->issue_num++; 978 req->issue_num++;
989 last_request = now; 979 last_request = now;
@@ -1176,7 +1166,7 @@ ns_lookup_result_cb (void *cls,
1176 const struct GNUNET_GNSRECORD_Data *rd) 1166 const struct GNUNET_GNSRECORD_Data *rd)
1177{ 1167{
1178 struct Request *req = cls; 1168 struct Request *req = cls;
1179 1169
1180 req->qe = NULL; 1170 req->qe = NULL;
1181 pending--; 1171 pending--;
1182 GNUNET_break (0 == memcmp (zone, 1172 GNUNET_break (0 == memcmp (zone,
@@ -1457,13 +1447,33 @@ run (void *cls,
1457 (void) args; 1447 (void) args;
1458 (void) cfgfile; 1448 (void) cfgfile;
1459 req_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1449 req_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1460 ctx = GNUNET_DNSSTUB_start (dns_server); 1450 ctx = GNUNET_DNSSTUB_start (256);
1461 if (NULL == ctx) 1451 if (NULL == ctx)
1462 { 1452 {
1463 fprintf (stderr, 1453 fprintf (stderr,
1464 "Failed to initialize GNUnet DNS STUB\n"); 1454 "Failed to initialize GNUnet DNS STUB\n");
1465 return; 1455 return;
1466 } 1456 }
1457 if (NULL == args[1])
1458 {
1459 fprintf (stderr,
1460 "You must provide a list of DNS resolvers on the command line\n");
1461 return;
1462 }
1463 for (unsigned int i=1;NULL != args[i];i++)
1464 {
1465 if (GNUNET_OK !=
1466 GNUNET_DNSSTUB_add_dns_ip (ctx,
1467 args[1]))
1468 {
1469 fprintf (stderr,
1470 "Failed to use `%s' for DNS resolver\n",
1471 args[i]);
1472 return;
1473 }
1474 }
1475
1476
1467 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 1477 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
1468 NULL); 1478 NULL);
1469 ns = GNUNET_NAMESTORE_connect (cfg); 1479 ns = GNUNET_NAMESTORE_connect (cfg);
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index a187bd250..05bdf17da 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -1087,7 +1087,7 @@ GNUNET_NAMESTORE_set_nick (struct GNUNET_NAMESTORE_Handle *h,
1087 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE; 1087 rd.flags |= GNUNET_GNSRECORD_RF_PRIVATE;
1088 return GNUNET_NAMESTORE_records_store (h, 1088 return GNUNET_NAMESTORE_records_store (h,
1089 pkey, 1089 pkey,
1090 GNUNET_GNS_MASTERZONE_STR, 1090 GNUNET_GNS_EMPTY_LABEL_AT,
1091 1, 1091 1,
1092 &rd, 1092 &rd,
1093 cont, 1093 cont,
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 4602106da..aedb39159 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -460,7 +460,7 @@ namestore_list_response (void *cls,
460 for (unsigned int i=0; i<rd_len; i++) 460 for (unsigned int i=0; i<rd_len; i++)
461 { 461 {
462 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && 462 if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
463 (0 != strcmp (rname, GNUNET_GNS_MASTERZONE_STR)) ) 463 (0 != strcmp (rname, GNUNET_GNS_EMPTY_LABEL_AT)) )
464 continue; 464 continue;
465 465
466 if ( (rd[i].record_type != handle->type) && 466 if ( (rd[i].record_type != handle->type) &&