diff options
17 files changed, 622 insertions, 293 deletions
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 2b62cec53..cbf4a02bb 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -39,7 +39,8 @@ check_PROGRAMS = \ | |||
39 | test_gns_simple_zkey_lookup \ | 39 | test_gns_simple_zkey_lookup \ |
40 | test_gns_dht_delegated_lookup \ | 40 | test_gns_dht_delegated_lookup \ |
41 | test_gns_pseu_shorten \ | 41 | test_gns_pseu_shorten \ |
42 | test_gns_max_queries | 42 | test_gns_max_queries \ |
43 | test_gns_dht_threepeer | ||
43 | 44 | ||
44 | 45 | ||
45 | # test_gns_simple_lookup | 46 | # test_gns_simple_lookup |
@@ -50,16 +51,18 @@ check_PROGRAMS = \ | |||
50 | plugin_LTLIBRARIES = \ | 51 | plugin_LTLIBRARIES = \ |
51 | libgnunet_plugin_block_gns.la | 52 | libgnunet_plugin_block_gns.la |
52 | 53 | ||
53 | #test_gns_twopeer_SOURCES = \ | 54 | test_gns_dht_threepeer_SOURCES = \ |
54 | # test_gns_twopeer.c | 55 | test_gns_dht_threepeer.c |
55 | #test_gns_twopeer_LDADD = \ | 56 | test_gns_dht_threepeer_LDADD = \ |
56 | # $(top_builddir)/src/util/libgnunetutil.la \ | 57 | $(top_builddir)/src/util/libgnunetutil.la \ |
57 | # $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 58 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
58 | # $(top_builddir)/src/testing/libgnunettesting.la | 59 | $(top_builddir)/src/gns/libgnunetgns.la \ |
59 | #test_gns_twopeer_DEPENDENCIES = \ | 60 | $(top_builddir)/src/testing/libgnunettesting.la |
60 | # $(top_builddir)/src/util/libgnunetutil.la \ | 61 | test_gns_dht_threepeer_DEPENDENCIES = \ |
61 | # $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 62 | $(top_builddir)/src/util/libgnunetutil.la \ |
62 | # $(top_builddir)/src/testing/libgnunettesting.la | 63 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
64 | $(top_builddir)/src/gns/libgnunetgns.la \ | ||
65 | $(top_builddir)/src/testing/libgnunettesting.la | ||
63 | 66 | ||
64 | test_gns_simple_lookup_SOURCES = \ | 67 | test_gns_simple_lookup_SOURCES = \ |
65 | test_gns_simple_lookup.c | 68 | test_gns_simple_lookup.c |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index ca46fa1ae..b3ecdfdf9 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -67,6 +67,11 @@ static struct GNUNET_CRYPTO_ShortHashCode our_zone; | |||
67 | static struct GNUNET_CRYPTO_RsaPrivateKey *our_key; | 67 | static struct GNUNET_CRYPTO_RsaPrivateKey *our_key; |
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Default timeout | ||
71 | */ | ||
72 | static struct GNUNET_TIME_Relative default_lookup_timeout; | ||
73 | |||
74 | /** | ||
70 | * Reply to dns request with the result from our lookup. | 75 | * Reply to dns request with the result from our lookup. |
71 | * | 76 | * |
72 | * @param cls the closure to the request (an InterceptLookupHandle) | 77 | * @param cls the closure to the request (an InterceptLookupHandle) |
@@ -240,7 +245,7 @@ start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, | |||
240 | /* Start resolution in our zone */ | 245 | /* Start resolution in our zone */ |
241 | gns_resolver_lookup_record(our_zone, q->type, q->name, | 246 | gns_resolver_lookup_record(our_zone, q->type, q->name, |
242 | our_key, | 247 | our_key, |
243 | GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT, | 248 | default_lookup_timeout, |
244 | &reply_to_dns, ilh); | 249 | &reply_to_dns, ilh); |
245 | } | 250 | } |
246 | 251 | ||
@@ -341,6 +346,8 @@ gns_interceptor_init(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
341 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 346 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
342 | const struct GNUNET_CONFIGURATION_Handle *c) | 347 | const struct GNUNET_CONFIGURATION_Handle *c) |
343 | { | 348 | { |
349 | unsigned long long default_lookup_timeout_secs = 0; | ||
350 | |||
344 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 351 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
345 | "DNS hijacking enabled... connecting to service.\n"); | 352 | "DNS hijacking enabled... connecting to service.\n"); |
346 | 353 | ||
@@ -353,6 +360,17 @@ gns_interceptor_init(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
353 | GNUNET_DNS_FLAG_PRE_RESOLUTION, | 360 | GNUNET_DNS_FLAG_PRE_RESOLUTION, |
354 | &handle_dns_request, /* rh */ | 361 | &handle_dns_request, /* rh */ |
355 | NULL); /* Closure */ | 362 | NULL); /* Closure */ |
363 | |||
364 | if (GNUNET_OK == | ||
365 | GNUNET_CONFIGURATION_get_value_number(c, "gns", | ||
366 | "DEFAULT_LOOKUP_TIMEOUT", | ||
367 | &default_lookup_timeout_secs)) | ||
368 | { | ||
369 | default_lookup_timeout = GNUNET_TIME_relative_multiply( | ||
370 | GNUNET_TIME_UNIT_SECONDS, | ||
371 | default_lookup_timeout_secs); | ||
372 | } | ||
373 | |||
356 | if (NULL == dns_handle) | 374 | if (NULL == dns_handle) |
357 | { | 375 | { |
358 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 376 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index ae01dafa9..de6e9ccc3 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -69,6 +69,8 @@ static unsigned long long max_allowed_background_queries; | |||
69 | */ | 69 | */ |
70 | static struct GNUNET_CRYPTO_ShortHashCode local_zone; | 70 | static struct GNUNET_CRYPTO_ShortHashCode local_zone; |
71 | 71 | ||
72 | static unsigned long long rid = 0; | ||
73 | |||
72 | /** | 74 | /** |
73 | * Namestore calls this function if we have record for this name. | 75 | * Namestore calls this function if we have record for this name. |
74 | * (or with rd_count=0 to indicate no matches) | 76 | * (or with rd_count=0 to indicate no matches) |
@@ -470,8 +472,8 @@ cleanup_pending_background_queries(void* cls, | |||
470 | ResolverCleanupContinuation cont = cls; | 472 | ResolverCleanupContinuation cont = cls; |
471 | 473 | ||
472 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 474 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
473 | "GNS_CLEANUP: Terminating background lookup for %s\n", | 475 | "GNS_CLEANUP-%d: Terminating background lookup for %s\n", |
474 | rh->name); | 476 | rh->id, rh->name); |
475 | GNUNET_DHT_get_stop(rh->get_handle); | 477 | GNUNET_DHT_get_stop(rh->get_handle); |
476 | rh->get_handle = NULL; | 478 | rh->get_handle = NULL; |
477 | rh->proc(rh->proc_cls, rh, 0, NULL); | 479 | rh->proc(rh->proc_cls, rh, 0, NULL); |
@@ -601,8 +603,8 @@ dht_lookup_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
601 | char new_name[MAX_DNS_NAME_LENGTH]; | 603 | char new_name[MAX_DNS_NAME_LENGTH]; |
602 | 604 | ||
603 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 605 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
604 | "GNS_PHASE_REC: dht lookup for query %s timed out.\n", | 606 | "GNS_PHASE_REC-%d: dht lookup for query %s (%ds)timed out.\n", |
605 | rh->name); | 607 | rh->id, rh->name, rh->timeout.rel_value); |
606 | /** | 608 | /** |
607 | * Start resolution in bg | 609 | * Start resolution in bg |
608 | */ | 610 | */ |
@@ -612,8 +614,8 @@ dht_lookup_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
612 | rh->name, GNUNET_GNS_TLD); | 614 | rh->name, GNUNET_GNS_TLD); |
613 | 615 | ||
614 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 616 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
615 | "GNS_PHASE_REC: Starting background lookup for %s type %d\n", | 617 | "GNS_PHASE_REC-%d: Starting background lookup for %s type %d\n", |
616 | new_name, rlh->record_type); | 618 | rh->id, new_name, rlh->record_type); |
617 | 619 | ||
618 | gns_resolver_lookup_record(rh->authority, | 620 | gns_resolver_lookup_record(rh->authority, |
619 | rlh->record_type, | 621 | rlh->record_type, |
@@ -664,16 +666,17 @@ process_record_result_dht(void* cls, | |||
664 | char* rd_data = (char*)data; | 666 | char* rd_data = (char*)data; |
665 | int i; | 667 | int i; |
666 | int rd_size; | 668 | int rd_size; |
667 | 669 | ||
670 | rh = (struct ResolverHandle *)cls; | ||
668 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 671 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
669 | "GNS_PHASE_REC: got dht result (size=%d)\n", size); | 672 | "GNS_PHASE_REC-%d: got dht result (size=%d)\n", rh->id, size); |
670 | 673 | ||
671 | if (data == NULL) | 674 | if (data == NULL) |
672 | return; | 675 | return; |
673 | 676 | ||
674 | //FIXME maybe check expiration here, check block type | 677 | //FIXME maybe check expiration here, check block type |
675 | 678 | ||
676 | rh = (struct ResolverHandle *)cls; | 679 | |
677 | rlh = (struct RecordLookupHandle *) rh->proc_cls; | 680 | rlh = (struct RecordLookupHandle *) rh->proc_cls; |
678 | nrb = (struct GNSNameRecordBlock*)data; | 681 | nrb = (struct GNSNameRecordBlock*)data; |
679 | 682 | ||
@@ -707,21 +710,25 @@ process_record_result_dht(void* cls, | |||
707 | num_records, | 710 | num_records, |
708 | rd)) | 711 | rd)) |
709 | { | 712 | { |
710 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Error deserializing data!\n"); | 713 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
714 | "GNS_PHASE_REC-%d: Error deserializing data!\n", rh->id); | ||
711 | return; | 715 | return; |
712 | } | 716 | } |
713 | 717 | ||
714 | for (i=0; i<num_records; i++) | 718 | for (i=0; i<num_records; i++) |
715 | { | 719 | { |
716 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 720 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
717 | "GNS_PHASE_REC: Got name: %s (wanted %s)\n", name, rh->name); | 721 | "GNS_PHASE_REC-%d: Got name: %s (wanted %s)\n", |
722 | rh->id, name, rh->name); | ||
718 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 723 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
719 | "GNS_PHASE_REC: Got type: %d\n", | 724 | "GNS_PHASE_REC-%d: Got type: %d\n", |
720 | rd[i].record_type); | 725 | rh->id, rd[i].record_type); |
721 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 726 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
722 | "GNS_PHASE_REC: Got data length: %d\n", rd[i].data_size); | 727 | "GNS_PHASE_REC-%d: Got data length: %d\n", |
728 | rh->id, rd[i].data_size); | ||
723 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 729 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
724 | "GNS_PHASE_REC: Got flag %d\n", rd[i].flags); | 730 | "GNS_PHASE_REC-%d: Got flag %d\n", |
731 | rh->id, rd[i].flags); | ||
725 | 732 | ||
726 | if ((strcmp(name, rh->name) == 0) && | 733 | if ((strcmp(name, rh->name) == 0) && |
727 | (rd[i].record_type == rlh->record_type)) | 734 | (rd[i].record_type == rlh->record_type)) |
@@ -782,8 +789,8 @@ resolve_record_dht(struct ResolverHandle *rh) | |||
782 | GNUNET_CRYPTO_hash_to_enc (&lookup_key, &lookup_key_string); | 789 | GNUNET_CRYPTO_hash_to_enc (&lookup_key, &lookup_key_string); |
783 | 790 | ||
784 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 791 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
785 | "GNS_PHASE_REC: starting dht lookup for %s with key: %s\n", | 792 | "GNS_PHASE_REC-%d: starting dht lookup for %s with key: %s\n", |
786 | rh->name, (char*)&lookup_key_string); | 793 | rh->id, rh->name, (char*)&lookup_key_string); |
787 | 794 | ||
788 | //rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 795 | //rh->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
789 | rh->dht_heap_node = NULL; | 796 | rh->dht_heap_node = NULL; |
@@ -797,7 +804,7 @@ resolve_record_dht(struct ResolverHandle *rh) | |||
797 | { | 804 | { |
798 | 805 | ||
799 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 806 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
800 | "GNS_PHASE_REC: Adjusting timeout\n"); | 807 | "GNS_PHASE_REC-%d: Adjusting timeout\n", rh->id); |
801 | /* | 808 | /* |
802 | * Set timeout for authority lookup phase to 1/2 | 809 | * Set timeout for authority lookup phase to 1/2 |
803 | */ | 810 | */ |
@@ -823,8 +830,8 @@ resolve_record_dht(struct ResolverHandle *rh) | |||
823 | rh_heap_root->dht_heap_node = NULL; | 830 | rh_heap_root->dht_heap_node = NULL; |
824 | 831 | ||
825 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 832 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
826 | "GNS_PHASE_REC: Replacing oldest background query for %s\n", | 833 | "GNS_PHASE_REC-%d: Replacing oldest background query for %s\n", |
827 | rh_heap_root->name); | 834 | rh->id, rh_heap_root->name); |
828 | rh_heap_root->proc(rh_heap_root->proc_cls, | 835 | rh_heap_root->proc(rh_heap_root->proc_cls, |
829 | rh_heap_root, | 836 | rh_heap_root, |
830 | 0, | 837 | 0, |
@@ -904,12 +911,12 @@ process_record_result_ns(void* cls, | |||
904 | * Lookup terminated and no results | 911 | * Lookup terminated and no results |
905 | */ | 912 | */ |
906 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 913 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
907 | "GNS_PHASE_REC: Namestore lookup for %s terminated without results\n", | 914 | "GNS_PHASE_REC-%d: Namestore lookup for %s terminated without results\n", |
908 | name); | 915 | rh->id, name); |
909 | 916 | ||
910 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 917 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
911 | "GNS_PHASE_REC: Record %s unknown in namestore\n", | 918 | "GNS_PHASE_REC-%d: Record %s unknown in namestore\n", |
912 | rh->name); | 919 | rh->id, rh->name); |
913 | /** | 920 | /** |
914 | * Our zone and no result? Cannot resolve TT | 921 | * Our zone and no result? Cannot resolve TT |
915 | */ | 922 | */ |
@@ -921,8 +928,8 @@ process_record_result_ns(void* cls, | |||
921 | { | 928 | { |
922 | 929 | ||
923 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 930 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
924 | "GNS_PHASE_REC: Processing additional result %s from namestore\n", | 931 | "GNS_PHASE_REC-%d: Processing additional result %s from namestore\n", |
925 | name); | 932 | rh->id, name); |
926 | int i; | 933 | int i; |
927 | for (i=0; i<rd_count;i++) | 934 | for (i=0; i<rd_count;i++) |
928 | { | 935 | { |
@@ -934,7 +941,8 @@ process_record_result_ns(void* cls, | |||
934 | == 0) | 941 | == 0) |
935 | { | 942 | { |
936 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 943 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
937 | "GNS_PHASE_REC: This record is expired. Skipping\n"); | 944 | "GNS_PHASE_REC-%d: This record is expired. Skipping\n", |
945 | rh->id); | ||
938 | continue; | 946 | continue; |
939 | } | 947 | } |
940 | 948 | ||
@@ -948,14 +956,14 @@ process_record_result_ns(void* cls, | |||
948 | if (rh->answered == 0) | 956 | if (rh->answered == 0) |
949 | { | 957 | { |
950 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 958 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
951 | "GNS_PHASE_REC: No answers found. This is odd!\n"); | 959 | "GNS_PHASE_REC-%d: No answers found. This is odd!\n", rh->id); |
952 | rh->proc(rh->proc_cls, rh, 0, NULL); | 960 | rh->proc(rh->proc_cls, rh, 0, NULL); |
953 | return; | 961 | return; |
954 | } | 962 | } |
955 | 963 | ||
956 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 964 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
957 | "GNS_PHASE_REC: Found %d answer(s) to query in %d records!\n", | 965 | "GNS_PHASE_REC-%d: Found %d answer(s) to query in %d records!\n", |
958 | rh->answered, rd_count); | 966 | rh->id, rh->answered, rd_count); |
959 | 967 | ||
960 | rh->proc(rh->proc_cls, rh, rd_count, rd); | 968 | rh->proc(rh->proc_cls, rh, rd_count, rd); |
961 | } | 969 | } |
@@ -1012,8 +1020,8 @@ dht_authority_lookup_timeout(void *cls, | |||
1012 | char new_name[MAX_DNS_NAME_LENGTH]; | 1020 | char new_name[MAX_DNS_NAME_LENGTH]; |
1013 | 1021 | ||
1014 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1022 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1015 | "GNS_PHASE_DELEGATE_DHT: dht lookup for query %s timed out.\n", | 1023 | "GNS_PHASE_DELEGATE_DHT-%d: dht lookup for query %s (%ds)timed out.\n", |
1016 | rh->authority_name); | 1024 | rh->id, rh->authority_name, rh->timeout.rel_value); |
1017 | 1025 | ||
1018 | rh->status |= TIMED_OUT; | 1026 | rh->status |= TIMED_OUT; |
1019 | 1027 | ||
@@ -1044,8 +1052,8 @@ dht_authority_lookup_timeout(void *cls, | |||
1044 | strcpy(rh->name, new_name); | 1052 | strcpy(rh->name, new_name); |
1045 | 1053 | ||
1046 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1054 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1047 | "GNS_PHASE_DELEGATE_DHT: Starting background query for %s type %d\n", | 1055 | "GNS_PHASE_DELEGATE_DHT-%d: Starting background query for %s type %d\n", |
1048 | rh->name, rlh->record_type); | 1056 | rh->id, rh->name, rlh->record_type); |
1049 | 1057 | ||
1050 | gns_resolver_lookup_record(rh->authority, | 1058 | gns_resolver_lookup_record(rh->authority, |
1051 | rlh->record_type, | 1059 | rlh->record_type, |
@@ -1115,16 +1123,15 @@ process_delegation_result_dht(void* cls, | |||
1115 | int rd_size; | 1123 | int rd_size; |
1116 | struct GNUNET_CRYPTO_ShortHashCode zone, name_hash; | 1124 | struct GNUNET_CRYPTO_ShortHashCode zone, name_hash; |
1117 | GNUNET_HashCode zone_hash_double, name_hash_double; | 1125 | GNUNET_HashCode zone_hash_double, name_hash_double; |
1126 | |||
1127 | rh = (struct ResolverHandle *)cls; | ||
1118 | 1128 | ||
1119 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1129 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1120 | "GNS_PHASE_DELEGATE_DHT: Got DHT result\n"); | 1130 | "GNS_PHASE_DELEGATE_DHT-%d: Got DHT result\n", rh->id); |
1121 | 1131 | ||
1122 | if (data == NULL) | 1132 | if (data == NULL) |
1123 | return; | 1133 | return; |
1124 | 1134 | ||
1125 | //FIXME check expiration? | ||
1126 | |||
1127 | rh = (struct ResolverHandle *)cls; | ||
1128 | nrb = (struct GNSNameRecordBlock*)data; | 1135 | nrb = (struct GNSNameRecordBlock*)data; |
1129 | 1136 | ||
1130 | /* stop dht lookup and timeout task */ | 1137 | /* stop dht lookup and timeout task */ |
@@ -1152,33 +1159,36 @@ process_delegation_result_dht(void* cls, | |||
1152 | rd)) | 1159 | rd)) |
1153 | { | 1160 | { |
1154 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1161 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1155 | "GNS_PHASE_DELEGATE_DHT: Error deserializing data!\n"); | 1162 | "GNS_PHASE_DELEGATE_DHT-%d: Error deserializing data!\n", |
1163 | rh->id); | ||
1156 | return; | 1164 | return; |
1157 | } | 1165 | } |
1158 | 1166 | ||
1159 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1167 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1160 | "GNS_PHASE_DELEGATE_DHT: Got name: %s (wanted %s)\n", | 1168 | "GNS_PHASE_DELEGATE_DHT-%d: Got name: %s (wanted %s)\n", |
1161 | name, rh->authority_name); | 1169 | rh->id, name, rh->authority_name); |
1162 | for (i=0; i<num_records; i++) | 1170 | for (i=0; i<num_records; i++) |
1163 | { | 1171 | { |
1164 | 1172 | ||
1165 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1173 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1166 | "GNS_PHASE_DELEGATE_DHT: Got name: %s (wanted %s)\n", | 1174 | "GNS_PHASE_DELEGATE_DHT-%d: Got name: %s (wanted %s)\n", |
1167 | name, rh->authority_name); | 1175 | rh->id, name, rh->authority_name); |
1168 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1176 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1169 | "GNS_PHASE_DELEGATE_DHT: Got type: %d (wanted %d)\n", | 1177 | "GNS_PHASE_DELEGATE_DHT-%d: Got type: %d (wanted %d)\n", |
1170 | rd[i].record_type, GNUNET_GNS_RECORD_PKEY); | 1178 | rh->id, rd[i].record_type, GNUNET_GNS_RECORD_PKEY); |
1171 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1179 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1172 | "GNS_PHASE_DELEGATE_DHT: Got data length: %d\n", | 1180 | "GNS_PHASE_DELEGATE_DHT-%d: Got data length: %d\n", |
1173 | rd[i].data_size); | 1181 | rh->id, rd[i].data_size); |
1174 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1182 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1175 | "GNS_PHASE_DELEGATE_DHT: Got flag %d\n", rd[i].flags); | 1183 | "GNS_PHASE_DELEGATE_DHT-%d: Got flag %d\n", |
1184 | rh->id, rd[i].flags); | ||
1176 | 1185 | ||
1177 | if ((strcmp(name, rh->authority_name) == 0) && | 1186 | if ((strcmp(name, rh->authority_name) == 0) && |
1178 | (rd[i].record_type == GNUNET_GNS_RECORD_PKEY)) | 1187 | (rd[i].record_type == GNUNET_GNS_RECORD_PKEY)) |
1179 | { | 1188 | { |
1180 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1189 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1181 | "GNS_PHASE_DELEGATE_DHT: Authority found in DHT\n"); | 1190 | "GNS_PHASE_DELEGATE_DHT-%d: Authority found in DHT\n", |
1191 | rh->id); | ||
1182 | rh->answered = 1; | 1192 | rh->answered = 1; |
1183 | memcpy(&rh->authority, rd[i].data, sizeof(struct GNUNET_CRYPTO_ShortHashCode)); | 1193 | memcpy(&rh->authority, rd[i].data, sizeof(struct GNUNET_CRYPTO_ShortHashCode)); |
1184 | struct AuthorityChain *auth = | 1194 | struct AuthorityChain *auth = |
@@ -1229,8 +1239,8 @@ process_delegation_result_dht(void* cls, | |||
1229 | * FIXME in this case. should we ask namestore again? | 1239 | * FIXME in this case. should we ask namestore again? |
1230 | */ | 1240 | */ |
1231 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1241 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1232 | "GNS_PHASE_DELEGATE_DHT: Answer from DHT for %s. Yet to resolve: %s\n", | 1242 | "GNS_PHASE_DELEGATE_DHT-%d: Answer from DHT for %s. Yet to resolve: %s\n", |
1233 | rh->authority_name, rh->name); | 1243 | rh->id, rh->authority_name, rh->name); |
1234 | if (strcmp(rh->name, "") == 0) | 1244 | if (strcmp(rh->name, "") == 0) |
1235 | { | 1245 | { |
1236 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1246 | rh->proc(rh->proc_cls, rh, 0, NULL); |
@@ -1248,8 +1258,8 @@ process_delegation_result_dht(void* cls, | |||
1248 | * promote back | 1258 | * promote back |
1249 | */ | 1259 | */ |
1250 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1260 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1251 | "GNS_PHASE_DELEGATE_DHT: Adding %s back to %s\n", | 1261 | "GNS_PHASE_DELEGATE_DHT-%d: Adding %s back to %s\n", |
1252 | rh->authority_name, rh->name); | 1262 | rh->id, rh->authority_name, rh->name); |
1253 | if (strcmp(rh->name, "") == 0) | 1263 | if (strcmp(rh->name, "") == 0) |
1254 | strcpy(rh->name, rh->authority_name); | 1264 | strcpy(rh->name, rh->authority_name); |
1255 | else | 1265 | else |
@@ -1257,9 +1267,10 @@ process_delegation_result_dht(void* cls, | |||
1257 | rh->name, rh->authority_name); //FIXME ret | 1267 | rh->name, rh->authority_name); //FIXME ret |
1258 | 1268 | ||
1259 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1269 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1260 | "GNS_PHASE_DELEGATE_DHT: %s restored\n", rh->name); | 1270 | "GNS_PHASE_DELEGATE_DHT-%d: %s restored\n", rh->id, rh->name); |
1261 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1271 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1262 | "GNS_PHASE_DELEGATE_DHT: DHT authority lookup found no match!\n"); | 1272 | "GNS_PHASE_DELEGATE_DHT-%d: DHT authority lookup found no match!\n", |
1273 | rh->id); | ||
1263 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1274 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1264 | } | 1275 | } |
1265 | 1276 | ||
@@ -1416,8 +1427,8 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
1416 | if (rd_count == 0) | 1427 | if (rd_count == 0) |
1417 | { | 1428 | { |
1418 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1429 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1419 | "GNS_PHASE_REC: No records for %s found in DHT. Aborting\n", | 1430 | "GNS_PHASE_REC-%d: No records for %s found in DHT. Aborting\n", |
1420 | rh->name); | 1431 | rh->id, rh->name); |
1421 | /* give up, cannot resolve */ | 1432 | /* give up, cannot resolve */ |
1422 | finish_lookup(rh, rlh, 0, NULL); | 1433 | finish_lookup(rh, rlh, 0, NULL); |
1423 | free_resolver_handle(rh); | 1434 | free_resolver_handle(rh); |
@@ -1426,7 +1437,7 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
1426 | 1437 | ||
1427 | /* results found yay */ | 1438 | /* results found yay */ |
1428 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1439 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1429 | "GNS_PHASE_REC: Record resolved from DHT!"); | 1440 | "GNS_PHASE_REC-%d: Record resolved from DHT!", rh->id); |
1430 | 1441 | ||
1431 | finish_lookup(rh, rlh, rd_count, rd); | 1442 | finish_lookup(rh, rlh, rd_count, rd); |
1432 | free_resolver_handle(rh); | 1443 | free_resolver_handle(rh); |
@@ -1452,7 +1463,8 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, | |||
1452 | if (rd_count == 0) | 1463 | if (rd_count == 0) |
1453 | { | 1464 | { |
1454 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1465 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1455 | "GNS_PHASE_REC: NS returned no records. (status: %d)!\n", | 1466 | "GNS_PHASE_REC-%d: NS returned no records. (status: %d)!\n", |
1467 | rh->id, | ||
1456 | rh->status); | 1468 | rh->status); |
1457 | 1469 | ||
1458 | /** | 1470 | /** |
@@ -1482,7 +1494,7 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, | |||
1482 | 1494 | ||
1483 | /* results found yay */ | 1495 | /* results found yay */ |
1484 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1496 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1485 | "GNS_PHASE_REC: Record resolved from namestore!"); | 1497 | "GNS_PHASE_REC-%d: Record resolved from namestore!", rh->id); |
1486 | 1498 | ||
1487 | finish_lookup(rh, rlh, rd_count, rd); | 1499 | finish_lookup(rh, rlh, rd_count, rd); |
1488 | 1500 | ||
@@ -1568,7 +1580,7 @@ is_tld(const char* name, const char* tld) | |||
1568 | offset = strlen(name)-strlen(tld); | 1580 | offset = strlen(name)-strlen(tld); |
1569 | if (strcmp(name+offset, tld) != 0) | 1581 | if (strcmp(name+offset, tld) != 0) |
1570 | { | 1582 | { |
1571 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1583 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1572 | "%s is not in .%s TLD\n", name, tld); | 1584 | "%s is not in .%s TLD\n", name, tld); |
1573 | return GNUNET_NO; | 1585 | return GNUNET_NO; |
1574 | } | 1586 | } |
@@ -1597,14 +1609,16 @@ handle_delegation_dht(void* cls, struct ResolverHandle *rh, | |||
1597 | if ((rlh->record_type == GNUNET_GNS_RECORD_PKEY)) | 1609 | if ((rlh->record_type == GNUNET_GNS_RECORD_PKEY)) |
1598 | { | 1610 | { |
1599 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1611 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1600 | "GNS_PHASE_DELEGATE_DHT: Resolved queried PKEY via DHT.\n"); | 1612 | "GNS_PHASE_DELEGATE_DHT-%d: Resolved queried PKEY via DHT.\n", |
1613 | rh->id); | ||
1601 | finish_lookup(rh, rlh, rd_count, rd); | 1614 | finish_lookup(rh, rlh, rd_count, rd); |
1602 | free_resolver_handle(rh); | 1615 | free_resolver_handle(rh); |
1603 | return; | 1616 | return; |
1604 | } | 1617 | } |
1605 | /* We resolved full name for delegation. resolving record */ | 1618 | /* We resolved full name for delegation. resolving record */ |
1606 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1619 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1607 | "GNS_PHASE_DELEGATE_DHT: Resolved full name for delegation via DHT.\n"); | 1620 | "GNS_PHASE_DELEGATE_DHT-%d: Resolved full name for delegation via DHT.\n", |
1621 | rh->id); | ||
1608 | strcpy(rh->name, "+\0"); | 1622 | strcpy(rh->name, "+\0"); |
1609 | rh->proc = &handle_record_ns; | 1623 | rh->proc = &handle_record_ns; |
1610 | resolve_record_ns(rh); | 1624 | resolve_record_ns(rh); |
@@ -1617,16 +1631,17 @@ handle_delegation_dht(void* cls, struct ResolverHandle *rh, | |||
1617 | if (is_canonical(rh->name)) | 1631 | if (is_canonical(rh->name)) |
1618 | { | 1632 | { |
1619 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1633 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1620 | "GNS_PHASE_DELEGATE_DHT: Resolving canonical record %s in ns\n", | 1634 | "GNS_PHASE_DELEGATE_DHT-%d: Resolving canonical record %s in ns\n", |
1621 | rh->name); | 1635 | rh->id, |
1636 | rh->name); | ||
1622 | rh->proc = &handle_record_ns; | 1637 | rh->proc = &handle_record_ns; |
1623 | resolve_record_ns(rh); | 1638 | resolve_record_ns(rh); |
1624 | return; | 1639 | return; |
1625 | } | 1640 | } |
1626 | /* give up, cannot resolve */ | 1641 | /* give up, cannot resolve */ |
1627 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1642 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1628 | "GNS_PHASE_DELEGATE_DHT: Cannot fully resolve delegation for %s via DHT!\n", | 1643 | "GNS_PHASE_DELEGATE_DHT-%d: Cannot fully resolve delegation for %s via DHT!\n", |
1629 | rh->name); | 1644 | rh->id, rh->name); |
1630 | finish_lookup(rh, rlh, 0, NULL); | 1645 | finish_lookup(rh, rlh, 0, NULL); |
1631 | free_resolver_handle(rh); | 1646 | free_resolver_handle(rh); |
1632 | } | 1647 | } |
@@ -1677,8 +1692,8 @@ resolve_delegation_dht(struct ResolverHandle *rh) | |||
1677 | rh_heap_root->dht_heap_node = NULL; | 1692 | rh_heap_root->dht_heap_node = NULL; |
1678 | 1693 | ||
1679 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1694 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1680 | "GNS_PHASE_DELEGATE_DHT: Replacing oldest background query for %s\n", | 1695 | "GNS_PHASE_DELEGATE_DHT-%d: Replacing oldest background query for %s\n", |
1681 | rh_heap_root->authority_name); | 1696 | rh->id, rh_heap_root->authority_name); |
1682 | 1697 | ||
1683 | rh_heap_root->proc(rh_heap_root->proc_cls, | 1698 | rh_heap_root->proc(rh_heap_root->proc_cls, |
1684 | rh_heap_root, | 1699 | rh_heap_root, |
@@ -1729,14 +1744,16 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1729 | { | 1744 | { |
1730 | GNUNET_assert(rd_count == 1); | 1745 | GNUNET_assert(rd_count == 1); |
1731 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1746 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1732 | "GNS_PHASE_DELEGATE_NS: Resolved queried PKEY in NS.\n"); | 1747 | "GNS_PHASE_DELEGATE_NS-%d: Resolved queried PKEY in NS.\n", |
1748 | rh->id); | ||
1733 | finish_lookup(rh, rlh, rd_count, rd); | 1749 | finish_lookup(rh, rlh, rd_count, rd); |
1734 | free_resolver_handle(rh); | 1750 | free_resolver_handle(rh); |
1735 | return; | 1751 | return; |
1736 | } | 1752 | } |
1737 | /* We resolved full name for delegation. resolving record */ | 1753 | /* We resolved full name for delegation. resolving record */ |
1738 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1754 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1739 | "GNS_PHASE_DELEGATE_NS: Resolved full name for delegation.\n"); | 1755 | "GNS_PHASE_DELEGATE_NS-%d: Resolved full name for delegation.\n", |
1756 | rh->id); | ||
1740 | strcpy(rh->name, "+\0"); | 1757 | strcpy(rh->name, "+\0"); |
1741 | rh->proc = &handle_record_ns; | 1758 | rh->proc = &handle_record_ns; |
1742 | resolve_record_ns(rh); | 1759 | resolve_record_ns(rh); |
@@ -1756,7 +1773,8 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1756 | if (is_canonical(rh->name)) | 1773 | if (is_canonical(rh->name)) |
1757 | { | 1774 | { |
1758 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1775 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1759 | "GNS_PHASE_DELEGATE_NS: Resolving canonical record %s\n", | 1776 | "GNS_PHASE_DELEGATE_NS-%d: Resolving canonical record %s\n", |
1777 | rh->id, | ||
1760 | rh->name); | 1778 | rh->name); |
1761 | rh->proc = &handle_record_ns; | 1779 | rh->proc = &handle_record_ns; |
1762 | resolve_record_ns(rh); | 1780 | resolve_record_ns(rh); |
@@ -1765,8 +1783,9 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1765 | { | 1783 | { |
1766 | /* give up, cannot resolve */ | 1784 | /* give up, cannot resolve */ |
1767 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1785 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1768 | "GNS_PHASE_DELEGATE_NS: Cannot fully resolve delegation for %s!\n", | 1786 | "GNS_PHASE_DELEGATE_NS-%d: Cannot fully resolve delegation for %s!\n", |
1769 | rh->name); | 1787 | rh->id, |
1788 | rh->name); | ||
1770 | finish_lookup(rh, rlh, rd_count, rd); | 1789 | finish_lookup(rh, rlh, rd_count, rd); |
1771 | //rlh->proc(rlh->proc_cls, 0, NULL); | 1790 | //rlh->proc(rlh->proc_cls, 0, NULL); |
1772 | } | 1791 | } |
@@ -1774,8 +1793,8 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1774 | } | 1793 | } |
1775 | 1794 | ||
1776 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1795 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1777 | "GNS_PHASE_DELEGATE_NS: Trying to resolve delegation for %s via DHT\n", | 1796 | "GNS_PHASE_DELEGATE_NS-%d: Trying to resolve delegation for %s via DHT\n", |
1778 | rh->name); | 1797 | rh->id, rh->name); |
1779 | rh->proc = &handle_delegation_dht; | 1798 | rh->proc = &handle_delegation_dht; |
1780 | resolve_delegation_dht(rh); | 1799 | resolve_delegation_dht(rh); |
1781 | } | 1800 | } |
@@ -1809,12 +1828,12 @@ process_delegation_result_ns(void* cls, | |||
1809 | struct GNUNET_TIME_Relative remaining_time; | 1828 | struct GNUNET_TIME_Relative remaining_time; |
1810 | struct GNUNET_CRYPTO_ShortHashCode zone; | 1829 | struct GNUNET_CRYPTO_ShortHashCode zone; |
1811 | char new_name[MAX_DNS_NAME_LENGTH]; | 1830 | char new_name[MAX_DNS_NAME_LENGTH]; |
1812 | 1831 | ||
1832 | rh = (struct ResolverHandle *)cls; | ||
1813 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1833 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1814 | "GNS_PHASE_DELEGATE_NS: Got %d records from authority lookup\n", | 1834 | "GNS_PHASE_DELEGATE_NS-%d: Got %d records from authority lookup\n", |
1815 | rd_count); | 1835 | rh->id, rd_count); |
1816 | 1836 | ||
1817 | rh = (struct ResolverHandle *)cls; | ||
1818 | GNUNET_CRYPTO_short_hash(key, | 1837 | GNUNET_CRYPTO_short_hash(key, |
1819 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 1838 | sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
1820 | &zone); | 1839 | &zone); |
@@ -1850,16 +1869,16 @@ process_delegation_result_ns(void* cls, | |||
1850 | { | 1869 | { |
1851 | /* simply promote back */ | 1870 | /* simply promote back */ |
1852 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1871 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1853 | "GNS_PHASE_DELEGATE_NS: Promoting %s back to name\n", | 1872 | "GNS_PHASE_DELEGATE_NS-%d: Promoting %s back to name\n", |
1854 | rh->authority_name); | 1873 | rh->id, rh->authority_name); |
1855 | strcpy(rh->name, rh->authority_name); | 1874 | strcpy(rh->name, rh->authority_name); |
1856 | } | 1875 | } |
1857 | else | 1876 | else |
1858 | { | 1877 | { |
1859 | /* add back to existing name */ | 1878 | /* add back to existing name */ |
1860 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1879 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1861 | "GNS_PHASE_DELEGATE_NS: Adding %s back to %s\n", | 1880 | "GNS_PHASE_DELEGATE_NS-%d: Adding %s back to %s\n", |
1862 | rh->authority_name, rh->name); | 1881 | rh->id, rh->authority_name, rh->name); |
1863 | //memset(new_name, 0, strlen(rh->name) + strlen(rh->authority_name) + 2); | 1882 | //memset(new_name, 0, strlen(rh->name) + strlen(rh->authority_name) + 2); |
1864 | GNUNET_snprintf(new_name, MAX_DNS_NAME_LENGTH, "%s.%s", | 1883 | GNUNET_snprintf(new_name, MAX_DNS_NAME_LENGTH, "%s.%s", |
1865 | rh->name, rh->authority_name); | 1884 | rh->name, rh->authority_name); |
@@ -1868,7 +1887,7 @@ process_delegation_result_ns(void* cls, | |||
1868 | //strcpy(new_name+strlen(new_name), rh->authority_name); | 1887 | //strcpy(new_name+strlen(new_name), rh->authority_name); |
1869 | strcpy(rh->name, new_name); | 1888 | strcpy(rh->name, new_name); |
1870 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1889 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1871 | "GNS_PHASE_DELEGATE_NS: %s restored\n", rh->name); | 1890 | "GNS_PHASE_DELEGATE_NS-%d: %s restored\n", rh->id, rh->name); |
1872 | } | 1891 | } |
1873 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1892 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1874 | return; | 1893 | return; |
@@ -1890,11 +1909,13 @@ process_delegation_result_ns(void* cls, | |||
1890 | == 0) | 1909 | == 0) |
1891 | { | 1910 | { |
1892 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1911 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1893 | "GNS_PHASE_DELEGATE_NS: This pkey is expired.\n"); | 1912 | "GNS_PHASE_DELEGATE_NS-%d: This pkey is expired.\n", |
1913 | rh->id); | ||
1894 | if (remaining_time.rel_value == 0) | 1914 | if (remaining_time.rel_value == 0) |
1895 | { | 1915 | { |
1896 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1916 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1897 | "GNS_PHASE_DELEGATE_NS: This dht entry is expired.\n"); | 1917 | "GNS_PHASE_DELEGATE_NS-%d: This dht entry is expired.\n", |
1918 | rh->id); | ||
1898 | rh->authority_chain_head->fresh = 0; | 1919 | rh->authority_chain_head->fresh = 0; |
1899 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1920 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1900 | return; | 1921 | return; |
@@ -1937,7 +1958,7 @@ process_delegation_result_ns(void* cls, | |||
1937 | * no answers found | 1958 | * no answers found |
1938 | */ | 1959 | */ |
1939 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1960 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1940 | "GNS_PHASE_DELEGATE_NS: Authority lookup and no PKEY...\n"); | 1961 | "GNS_PHASE_DELEGATE_NS-%d: Authority lookup and no PKEY...\n", rh->id); |
1941 | rh->proc(rh->proc_cls, rh, 0, NULL); | 1962 | rh->proc(rh->proc_cls, rh, 0, NULL); |
1942 | } | 1963 | } |
1943 | 1964 | ||
@@ -1951,7 +1972,8 @@ static void | |||
1951 | resolve_delegation_ns(struct ResolverHandle *rh) | 1972 | resolve_delegation_ns(struct ResolverHandle *rh) |
1952 | { | 1973 | { |
1953 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1974 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1954 | "GNS_PHASE_DELEGATE_NS: Resolving delegation for %s\n", rh->name); | 1975 | "GNS_PHASE_DELEGATE_NS-%d: Resolving delegation for %s\n", |
1976 | rh->id, rh->name); | ||
1955 | pop_tld(rh->name, rh->authority_name); | 1977 | pop_tld(rh->name, rh->authority_name); |
1956 | GNUNET_NAMESTORE_lookup_record(namestore_handle, | 1978 | GNUNET_NAMESTORE_lookup_record(namestore_handle, |
1957 | &rh->authority, | 1979 | &rh->authority, |
@@ -2007,6 +2029,7 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2007 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); | 2029 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); |
2008 | 2030 | ||
2009 | rh->authority = zone; | 2031 | rh->authority = zone; |
2032 | rh->id = rid++; | ||
2010 | rh->proc_cls = rlh; | 2033 | rh->proc_cls = rlh; |
2011 | rh->priv_key = key; | 2034 | rh->priv_key = key; |
2012 | rh->timeout = timeout; | 2035 | rh->timeout = timeout; |
@@ -2016,6 +2039,8 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2016 | /* | 2039 | /* |
2017 | * Set timeout for authority lookup phase to 1/2 | 2040 | * Set timeout for authority lookup phase to 1/2 |
2018 | */ | 2041 | */ |
2042 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2043 | "Timeout for lookup set to %ds\n", rh->timeout.rel_value); | ||
2019 | rh->timeout_task = GNUNET_SCHEDULER_add_delayed( | 2044 | rh->timeout_task = GNUNET_SCHEDULER_add_delayed( |
2020 | GNUNET_TIME_relative_divide(timeout, 2), | 2045 | GNUNET_TIME_relative_divide(timeout, 2), |
2021 | &handle_lookup_timeout, | 2046 | &handle_lookup_timeout, |
@@ -2299,6 +2324,7 @@ handle_delegation_ns_shorten(void* cls, | |||
2299 | { | 2324 | { |
2300 | rh_bg = GNUNET_malloc(sizeof(struct ResolverHandle)); | 2325 | rh_bg = GNUNET_malloc(sizeof(struct ResolverHandle)); |
2301 | memcpy(rh_bg, rh, sizeof(struct ResolverHandle)); | 2326 | memcpy(rh_bg, rh, sizeof(struct ResolverHandle)); |
2327 | rh_bg->id = rid++; | ||
2302 | } | 2328 | } |
2303 | 2329 | ||
2304 | /* backtrack authorities for names */ | 2330 | /* backtrack authorities for names */ |
@@ -2448,9 +2474,11 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2448 | 2474 | ||
2449 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); | 2475 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); |
2450 | rh->authority = zone; | 2476 | rh->authority = zone; |
2477 | rh->id = rid++; | ||
2451 | rh->priv_key = key; | 2478 | rh->priv_key = key; |
2452 | rh->proc = &handle_delegation_ns_shorten; | 2479 | rh->proc = &handle_delegation_ns_shorten; |
2453 | rh->proc_cls = nsh; | 2480 | rh->proc_cls = nsh; |
2481 | rh->id = rid++; | ||
2454 | 2482 | ||
2455 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2483 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2456 | "Checking for TLD...\n"); | 2484 | "Checking for TLD...\n"); |
@@ -2615,6 +2643,7 @@ gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2615 | nah = GNUNET_malloc(sizeof (struct GetNameAuthorityHandle)); | 2643 | nah = GNUNET_malloc(sizeof (struct GetNameAuthorityHandle)); |
2616 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); | 2644 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); |
2617 | rh->authority = zone; | 2645 | rh->authority = zone; |
2646 | rh->id = rid++; | ||
2618 | 2647 | ||
2619 | if (strcmp(GNUNET_GNS_TLD, name) == 0) | 2648 | if (strcmp(GNUNET_GNS_TLD, name) == 0) |
2620 | { | 2649 | { |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index 85c21e324..2da9bff1d 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -160,6 +160,11 @@ struct ResolverHandle | |||
160 | */ | 160 | */ |
161 | struct GNUNET_CONTAINER_HeapNode *dht_heap_node; | 161 | struct GNUNET_CONTAINER_HeapNode *dht_heap_node; |
162 | 162 | ||
163 | /** | ||
164 | * Id for resolution process | ||
165 | */ | ||
166 | unsigned long long id; | ||
167 | |||
163 | }; | 168 | }; |
164 | 169 | ||
165 | 170 | ||
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index 7dfaab0fa..46ce1249d 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c | |||
@@ -77,7 +77,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
77 | uint32_t record_xquery; | 77 | uint32_t record_xquery; |
78 | unsigned int record_match; | 78 | unsigned int record_match; |
79 | 79 | ||
80 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "RB SIZE %d\n", reply_block_size); | 80 | //GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "RB SIZE %d\n", reply_block_size); |
81 | 81 | ||
82 | if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) | 82 | if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) |
83 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 83 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
@@ -113,9 +113,9 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
113 | GNUNET_CRYPTO_hash_to_enc (&query_key, &xor_exp); | 113 | GNUNET_CRYPTO_hash_to_enc (&query_key, &xor_exp); |
114 | GNUNET_CRYPTO_hash_to_enc (query, &xor_got); | 114 | GNUNET_CRYPTO_hash_to_enc (query, &xor_got); |
115 | 115 | ||
116 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 116 | //GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
117 | "BLOCK_TEST for %s got %s expected %s\n", | 117 | // "BLOCK_TEST for %s got %s expected %s\n", |
118 | name, (char*) &xor_got, (char*) &xor_exp); | 118 | // name, (char*) &xor_got, (char*) &xor_exp); |
119 | 119 | ||
120 | /* Check query key against public key */ | 120 | /* Check query key against public key */ |
121 | if (0 != GNUNET_CRYPTO_hash_cmp(query, &query_key)) | 121 | if (0 != GNUNET_CRYPTO_hash_cmp(query, &query_key)) |
@@ -184,7 +184,6 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
184 | GNUNET_BLOCK_mingle_hash(&chash, bf_mutator, &mhash); | 184 | GNUNET_BLOCK_mingle_hash(&chash, bf_mutator, &mhash); |
185 | if (NULL != *bf) | 185 | if (NULL != *bf) |
186 | { | 186 | { |
187 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Check BF\n"); | ||
188 | if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(*bf, &mhash)) | 187 | if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test(*bf, &mhash)) |
189 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; | 188 | return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; |
190 | } | 189 | } |
diff --git a/src/gns/test_gns_defaults.conf b/src/gns/test_gns_defaults.conf new file mode 100644 index 000000000..762c9641b --- /dev/null +++ b/src/gns/test_gns_defaults.conf | |||
@@ -0,0 +1,75 @@ | |||
1 | [PATHS] | ||
2 | SERVICEHOME = /tmp/test-gnunet-testing/ | ||
3 | DEFAULTCONFIG = test_testing_defaults.conf | ||
4 | |||
5 | [resolver] | ||
6 | PORT = 2564 | ||
7 | |||
8 | [transport] | ||
9 | PORT = 2565 | ||
10 | PLUGINS = tcp | ||
11 | |||
12 | [arm] | ||
13 | PORT = 2566 | ||
14 | DEFAULTSERVICES = | ||
15 | |||
16 | [statistics] | ||
17 | PORT = 2567 | ||
18 | |||
19 | [transport-tcp] | ||
20 | PORT = 2568 | ||
21 | BINDTO = 127.0.0.1 | ||
22 | |||
23 | [peerinfo] | ||
24 | PORT = 2569 | ||
25 | |||
26 | [core] | ||
27 | PORT = 2570 | ||
28 | |||
29 | [testing] | ||
30 | NUM_PEERS = 5 | ||
31 | WEAKRANDOM = YES | ||
32 | F2F = YES | ||
33 | HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat | ||
34 | |||
35 | [dht] | ||
36 | AUTOSTART = NO | ||
37 | |||
38 | [nat] | ||
39 | DISABLEV6 = YES | ||
40 | ENABLE_UPNP = NO | ||
41 | BEHIND_NAT = NO | ||
42 | ALLOW_NAT = NO | ||
43 | INTERNAL_ADDRESS = 127.0.0.1 | ||
44 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
45 | USE_LOCALADDR = NO | ||
46 | |||
47 | [dns] | ||
48 | AUTOSTART = NO | ||
49 | |||
50 | [nse] | ||
51 | AUTOSTART = NO | ||
52 | |||
53 | [mesh] | ||
54 | AUTOSTART = NO | ||
55 | |||
56 | [datastore] | ||
57 | AUTOSTART = NO | ||
58 | |||
59 | [fs] | ||
60 | AUTOSTART = NO | ||
61 | |||
62 | [dv] | ||
63 | AUTOSTART = NO | ||
64 | |||
65 | [chat] | ||
66 | AUTOSTART = NO | ||
67 | |||
68 | [vpn] | ||
69 | AUTOSTART = NO | ||
70 | |||
71 | [gns] | ||
72 | AUTOSTART = NO | ||
73 | |||
74 | [namestore] | ||
75 | AUTOSTART = NO \ No newline at end of file | ||
diff --git a/src/gns/test_gns_dht_alice.conf b/src/gns/test_gns_dht_alice.conf new file mode 100644 index 000000000..98f176796 --- /dev/null +++ b/src/gns/test_gns_dht_alice.conf | |||
@@ -0,0 +1,92 @@ | |||
1 | @INLINE@ test_gns_defaults.conf | ||
2 | [PATHS] | ||
3 | SERVICEHOME = /tmp/test-gnunet-gns-alice/ | ||
4 | DEFAULTCONFIG = test_gns_dht_alice.conf | ||
5 | |||
6 | [transport-tcp] | ||
7 | PORT = 32568 | ||
8 | |||
9 | [dht] | ||
10 | UNIXPATH = /tmp/gnunet-alice-service-dht.sock | ||
11 | DEBUG = NO | ||
12 | AUTOSTART = YES | ||
13 | ACCEPT_FROM6 = ::1; | ||
14 | ACCEPT_FROM = 127.0.0.1; | ||
15 | HOSTNAME = localhost | ||
16 | PORT = 2101 | ||
17 | BINARY = gnunet-service-dht | ||
18 | |||
19 | [block] | ||
20 | plugins = dht test gns | ||
21 | |||
22 | [dhtcache] | ||
23 | QUOTA = 1 MB | ||
24 | DATABASE = sqlite | ||
25 | |||
26 | [arm] | ||
27 | PORT = 12566 | ||
28 | DEFAULTSERVICES = core namstore gns | ||
29 | UNIXPATH = /tmp/gnunet-alice-service-arm.sock | ||
30 | |||
31 | [statistics] | ||
32 | PORT = 12567 | ||
33 | UNIXPATH = /tmp/gnunet-alice-service-statistics.sock | ||
34 | |||
35 | [resolver] | ||
36 | PORT = 12564 | ||
37 | UNIXPATH = /tmp/gnunet-alice-service-resolver.sock | ||
38 | |||
39 | [peerinfo] | ||
40 | PORT = 12569 | ||
41 | UNIXPATH = /tmp/gnunet-alice-service-peerinfo.sock | ||
42 | |||
43 | [transport] | ||
44 | PORT = 12565 | ||
45 | UNIXPATH = /tmp/gnunet-alice-service-transport.sock | ||
46 | |||
47 | [core] | ||
48 | PORT = 12570 | ||
49 | UNIXPATH = /tmp/gnunet-alice-service-core.sock | ||
50 | |||
51 | [ats] | ||
52 | PORT = 12571 | ||
53 | UNIXPATH = /tmp/gnunet-alice-service-ats.sock | ||
54 | |||
55 | [dns] | ||
56 | UNIXPATH = /tmp/gnunet-alice-service-dns.sock | ||
57 | PORT = 12369 | ||
58 | AUTOSTART = YES | ||
59 | DNS_EXIT = 8.8.8.8 | ||
60 | |||
61 | [gns] | ||
62 | PORT = 12370 | ||
63 | #PREFIX = valgrind -v --leak-check=full --track-origins=yes. | ||
64 | AUTOSTART = YES | ||
65 | BINARY = gnunet-service-gns | ||
66 | ZONEKEY = testkeys/KAILNI4SSH8M6QR6S8QRSGBBLMA8377HL6F60TEMO7S7TT1OR8CG.zkey | ||
67 | HIJACK_DNS = YES | ||
68 | UNIXPATH = /tmp/gnunet-service-gns-alice.sock | ||
69 | HOME = $SERVICEHOME | ||
70 | CONFIG = $DEFAULTCONFIG | ||
71 | AUTO_IMPORT_PKEY = NO | ||
72 | MAX_PARALLEL_BACKGROUND_QUERIES = 10 | ||
73 | DEFAULT_LOOKUP_TIMEOUT = 60 | ||
74 | |||
75 | [namestore] | ||
76 | PORT = 12371 | ||
77 | AUTOSTART = YES | ||
78 | UNIXPATH = /tmp/gnunet-service-namestore-alice.sock | ||
79 | UNIX_MATCH_UID = YES | ||
80 | UNIX_MATCH_GID = YES | ||
81 | HOSTNAME = localhost | ||
82 | HOME = $SERVICEHOME | ||
83 | CONFIG = $DEFAULTCONFIG | ||
84 | BINARY = gnunet-service-namestore | ||
85 | ACCEPT_FROM = 127.0.0.1; | ||
86 | ACCEPT_FROM6 = ::1; | ||
87 | DATABASE = sqlite | ||
88 | ZONEFILE_DIRECTORY = testkeys/ | ||
89 | |||
90 | [namestore-sqlite] | ||
91 | FILENAME = testdb/sqlite-alice.db | ||
92 | |||
diff --git a/src/gns/test_gns_dht_bob.conf b/src/gns/test_gns_dht_bob.conf new file mode 100644 index 000000000..72dc21a10 --- /dev/null +++ b/src/gns/test_gns_dht_bob.conf | |||
@@ -0,0 +1,92 @@ | |||
1 | @INLINE@ test_gns_defaults.conf | ||
2 | [PATHS] | ||
3 | SERVICEHOME = /tmp/test-gnunet-gns-bob/ | ||
4 | DEFAULTCONFIG = test_gns_dht_bob.conf | ||
5 | |||
6 | [transport-tcp] | ||
7 | PORT = 22568 | ||
8 | |||
9 | [dht] | ||
10 | UNIXPATH = /tmp/gnunet-bob-service-dht.sock | ||
11 | DEBUG = NO | ||
12 | AUTOSTART = YES | ||
13 | ACCEPT_FROM6 = ::1; | ||
14 | ACCEPT_FROM = 127.0.0.1; | ||
15 | HOSTNAME = localhost | ||
16 | PORT = 2102 | ||
17 | BINARY = gnunet-service-dht | ||
18 | |||
19 | [block] | ||
20 | plugins = dht test gns | ||
21 | |||
22 | [dhtcache] | ||
23 | QUOTA = 1 MB | ||
24 | DATABASE = sqlite | ||
25 | |||
26 | [arm] | ||
27 | PORT = 22566 | ||
28 | DEFAULTSERVICES = core namestore gns | ||
29 | UNIXPATH = /tmp/gnunet-bob-service-arm.sock | ||
30 | |||
31 | [statistics] | ||
32 | PORT = 22567 | ||
33 | UNIXPATH = /tmp/gnunet-bob-service-statistics.sock | ||
34 | |||
35 | [resolver] | ||
36 | PORT = 22564 | ||
37 | UNIXPATH = /tmp/gnunet-bob-service-resolver.sock | ||
38 | |||
39 | [peerinfo] | ||
40 | PORT = 22569 | ||
41 | UNIXPATH = /tmp/gnunet-bob-service-peerinfo.sock | ||
42 | |||
43 | [transport] | ||
44 | PORT = 22565 | ||
45 | UNIXPATH = /tmp/gnunet-bob-service-transport.sock | ||
46 | |||
47 | [core] | ||
48 | PORT = 22570 | ||
49 | UNIXPATH = /tmp/gnunet-bob-service-core.sock | ||
50 | |||
51 | [ats] | ||
52 | PORT = 22571 | ||
53 | UNIXPATH = /tmp/gnunet-bob-service-ats.sock | ||
54 | |||
55 | [dns] | ||
56 | UNIXPATH = /tmp/gnunet-bob-service-dns.sock | ||
57 | PORT = 22369 | ||
58 | AUTOSTART = YES | ||
59 | DNS_EXIT = 8.8.8.8 | ||
60 | |||
61 | [gns] | ||
62 | PORT = 22370 | ||
63 | #PREFIX = valgrind -v --leak-check=full --track-origins=yes. | ||
64 | AUTOSTART = YES | ||
65 | BINARY = gnunet-service-gns | ||
66 | ZONEKEY = testkeys/KRPVFMVBFKEGUS6KL8SFPEUMORFPP9ERE6AC98KO9NADBMPF7TOG.zkey | ||
67 | HIJACK_DNS = NO | ||
68 | UNIXPATH = /tmp/gnunet-service-gns-bob.sock | ||
69 | HOME = $SERVICEHOME | ||
70 | CONFIG = $DEFAULTCONFIG | ||
71 | AUTO_IMPORT_PKEY = NO | ||
72 | MAX_PARALLEL_BACKGROUND_QUERIES = 10 | ||
73 | DEFAULT_LOOKUP_TIMEOUT = 5 | ||
74 | |||
75 | [namestore] | ||
76 | PORT = 22371 | ||
77 | AUTOSTART = YES | ||
78 | UNIXPATH = /tmp/gnunet-service-namestore-bob.sock | ||
79 | UNIX_MATCH_UID = YES | ||
80 | UNIX_MATCH_GID = YES | ||
81 | HOSTNAME = localhost | ||
82 | HOME = $SERVICEHOME | ||
83 | CONFIG = $DEFAULTCONFIG | ||
84 | BINARY = gnunet-service-namestore | ||
85 | ACCEPT_FROM = 127.0.0.1; | ||
86 | ACCEPT_FROM6 = ::1; | ||
87 | DATABASE = sqlite | ||
88 | ZONEFILE_DIRECTORY = testkeys/ | ||
89 | |||
90 | [namestore-sqlite] | ||
91 | FILENAME = testdb/sqlite-bob.db | ||
92 | |||
diff --git a/src/gns/test_gns_dht_dave.conf b/src/gns/test_gns_dht_dave.conf new file mode 100644 index 000000000..5f0b20a8c --- /dev/null +++ b/src/gns/test_gns_dht_dave.conf | |||
@@ -0,0 +1,92 @@ | |||
1 | @INLINE@ test_gns_defaults.conf | ||
2 | [PATHS] | ||
3 | SERVICEHOME = /tmp/test-gnunet-gns-dave/ | ||
4 | DEFAULTCONFIG = test_gns_dht_dave.conf | ||
5 | |||
6 | [transport-tcp] | ||
7 | PORT = 32568 | ||
8 | |||
9 | [dht] | ||
10 | UNIXPATH = /tmp/gnunet-service-dht-dave.sock | ||
11 | DEBUG = NO | ||
12 | AUTOSTART = YES | ||
13 | ACCEPT_FROM6 = ::1; | ||
14 | ACCEPT_FROM = 127.0.0.1; | ||
15 | HOSTNAME = localhost | ||
16 | PORT = 2103 | ||
17 | BINARY = gnunet-service-dht | ||
18 | |||
19 | [block] | ||
20 | plugins = dht test gns | ||
21 | |||
22 | [dhtcache] | ||
23 | QUOTA = 1 MB | ||
24 | DATABASE = sqlite | ||
25 | |||
26 | [arm] | ||
27 | PORT = 32566 | ||
28 | DEFAULTSERVICES = core namestore gns | ||
29 | UNIXPATH = /tmp/gnunet-dave-service-arm.sock | ||
30 | |||
31 | [statistics] | ||
32 | PORT = 32567 | ||
33 | UNIXPATH = /tmp/gnunet-dave-service-statistics.sock | ||
34 | |||
35 | [resolver] | ||
36 | PORT = 32564 | ||
37 | UNIXPATH = /tmp/gnunet-dave-service-resolver.sock | ||
38 | |||
39 | [peerinfo] | ||
40 | PORT = 32569 | ||
41 | UNIXPATH = /tmp/gnunet-dave-service-peerinfo.sock | ||
42 | |||
43 | [transport] | ||
44 | PORT = 32565 | ||
45 | UNIXPATH = /tmp/gnunet-dave-service-transport.sock | ||
46 | |||
47 | [core] | ||
48 | PORT = 32570 | ||
49 | UNIXPATH = /tmp/gnunet-dave-service-core.sock | ||
50 | |||
51 | [ats] | ||
52 | PORT = 32571 | ||
53 | UNIXPATH = /tmp/gnunet-dave-service-ats.sock | ||
54 | |||
55 | [dns] | ||
56 | UNIXPATH = /tmp/gnunet-service-dns-dave.sock | ||
57 | PORT = 32369 | ||
58 | AUTOSTART = YES | ||
59 | DNS_EXIT = 8.8.8.8 | ||
60 | |||
61 | [gns] | ||
62 | PORT = 32370 | ||
63 | #PREFIX = valgrind -v --leak-check=full --track-origins=yes. | ||
64 | AUTOSTART = YES | ||
65 | BINARY = gnunet-service-gns | ||
66 | ZONEKEY = testkeys/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey | ||
67 | HIJACK_DNS = NO | ||
68 | UNIXPATH = /tmp/gnunet-service-gns-dave.sock | ||
69 | HOME = $SERVICEHOME | ||
70 | CONFIG = $DEFAULTCONFIG | ||
71 | AUTO_IMPORT_PKEY = NO | ||
72 | MAX_PARALLEL_BACKGROUND_QUERIES = 10 | ||
73 | DEFAULT_LOOKUP_TIMEOUT = 5 | ||
74 | |||
75 | [namestore] | ||
76 | PORT = 32371 | ||
77 | AUTOSTART = YES | ||
78 | UNIXPATH = /tmp/gnunet-service-namestore-dave.sock | ||
79 | UNIX_MATCH_UID = YES | ||
80 | UNIX_MATCH_GID = YES | ||
81 | HOSTNAME = localhost | ||
82 | HOME = $SERVICEHOME | ||
83 | CONFIG = $DEFAULTCONFIG | ||
84 | BINARY = gnunet-service-namestore | ||
85 | ACCEPT_FROM = 127.0.0.1; | ||
86 | ACCEPT_FROM6 = ::1; | ||
87 | DATABASE = sqlite | ||
88 | ZONEFILE_DIRECTORY = testkeys/ | ||
89 | |||
90 | [namestore-sqlite] | ||
91 | FILENAME = testdb/sqlite-dave.db | ||
92 | |||
diff --git a/src/gns/test_gns_twopeer.c b/src/gns/test_gns_dht_threepeer.c index 8ebb9611b..7d8ed6c6b 100644 --- a/src/gns/test_gns_twopeer.c +++ b/src/gns/test_gns_dht_threepeer.c | |||
@@ -18,25 +18,17 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file gns/test_gns_twopeer.c | 21 | * @file gns/test_gns_dht_threepeer.c |
22 | * @brief base testcase for testing DHT service with | 22 | * @brief tests dht lookup over 3 peers |
23 | * two running peers. | 23 | * |
24 | * topology: | ||
25 | * alice <----> bob <-----> dave | ||
26 | * | ||
27 | * alice queries for www.buddy.bob.gnunet | ||
24 | * | 28 | * |
25 | * This testcase starts peers using the GNUNET_TESTING_daemons_start | ||
26 | * function call. On peer start, connects to the peers DHT service | ||
27 | * by calling GNUNET_DHT_connected. Once notified about all peers | ||
28 | * being started (by the peers_started_callback function), calls | ||
29 | * GNUNET_TESTING_connect_topology, which connects the peers in a | ||
30 | * "straight line" topology. On notification that all peers have | ||
31 | * been properly connected, calls the do_get function which initiates | ||
32 | * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get | ||
33 | * function starts, runs the do_put function to insert data at the first peer. | ||
34 | * If the GET is successful, schedules finish_testing | ||
35 | * to stop the test and shut down peers. If GET is unsuccessful | ||
36 | * after GET_TIMEOUT seconds, prints an error message and shuts down | ||
37 | * the peers. | ||
38 | */ | 29 | */ |
39 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_disk_lib.h" | ||
40 | #include "gnunet_testing_lib.h" | 32 | #include "gnunet_testing_lib.h" |
41 | #include "gnunet_core_service.h" | 33 | #include "gnunet_core_service.h" |
42 | #include "gnunet_dht_service.h" | 34 | #include "gnunet_dht_service.h" |
@@ -55,6 +47,9 @@ | |||
55 | /* If number of peers not in config file, use this number */ | 47 | /* If number of peers not in config file, use this number */ |
56 | #define DEFAULT_NUM_PEERS 2 | 48 | #define DEFAULT_NUM_PEERS 2 |
57 | 49 | ||
50 | #define TEST_DOMAIN "www.buddy.bob.gnunet" | ||
51 | #define TEST_IP "1.1.1.1" | ||
52 | |||
58 | /* Globals */ | 53 | /* Globals */ |
59 | 54 | ||
60 | /** | 55 | /** |
@@ -74,6 +69,7 @@ static unsigned long long peers_left; | |||
74 | 69 | ||
75 | struct GNUNET_TESTING_Daemon *d1; | 70 | struct GNUNET_TESTING_Daemon *d1; |
76 | struct GNUNET_TESTING_Daemon *d2; | 71 | struct GNUNET_TESTING_Daemon *d2; |
72 | struct GNUNET_TESTING_Daemon *d3; | ||
77 | 73 | ||
78 | 74 | ||
79 | /** | 75 | /** |
@@ -103,7 +99,11 @@ GNUNET_SCHEDULER_TaskIdentifier bob_task; | |||
103 | /* Global return value (0 for success, anything else for failure) */ | 99 | /* Global return value (0 for success, anything else for failure) */ |
104 | static int ok; | 100 | static int ok; |
105 | 101 | ||
106 | int bob_online, alice_online; | 102 | int bob_online, alice_online, dave_online; |
103 | |||
104 | struct GNUNET_CONFIGURATION_Handle *cfg_alice; | ||
105 | struct GNUNET_CONFIGURATION_Handle *cfg_bob; | ||
106 | struct GNUNET_CONFIGURATION_Handle *cfg_dave; | ||
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Check whether peers successfully shut down. | 109 | * Check whether peers successfully shut down. |
@@ -126,13 +126,17 @@ static void | |||
126 | finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 126 | finish_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
127 | { | 127 | { |
128 | ok = 0; | 128 | ok = 0; |
129 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer1!\n"); | 129 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down alice!\n"); |
130 | GNUNET_TESTING_daemon_stop (d1, TIMEOUT, &shutdown_callback, NULL, | 130 | GNUNET_TESTING_daemon_stop (d1, TIMEOUT, &shutdown_callback, NULL, |
131 | GNUNET_YES, GNUNET_NO); | 131 | GNUNET_YES, GNUNET_NO); |
132 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer2!\n"); | 132 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down bob!\n"); |
133 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &shutdown_callback, NULL, | 133 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &shutdown_callback, NULL, |
134 | GNUNET_YES, GNUNET_NO); | 134 | GNUNET_YES, GNUNET_NO); |
135 | GNUNET_SCHEDULER_cancel(bob_task); | 135 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down dave\n"); |
136 | GNUNET_TESTING_daemon_stop (d3, TIMEOUT, &shutdown_callback, NULL, | ||
137 | GNUNET_YES, GNUNET_NO); | ||
138 | GNUNET_DISK_file_copy ("testdb/sqlite-alice.db.bak", | ||
139 | "testdb/sqlite-alice.db.bak"); | ||
136 | GNUNET_SCHEDULER_cancel(die_task); | 140 | GNUNET_SCHEDULER_cancel(die_task); |
137 | } | 141 | } |
138 | 142 | ||
@@ -149,6 +153,10 @@ end_badly_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
149 | if (d2 != NULL) | 153 | if (d2 != NULL) |
150 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &shutdown_callback, NULL, | 154 | GNUNET_TESTING_daemon_stop (d2, TIMEOUT, &shutdown_callback, NULL, |
151 | GNUNET_YES, GNUNET_NO); | 155 | GNUNET_YES, GNUNET_NO); |
156 | ; | ||
157 | if (d3 != NULL) | ||
158 | GNUNET_TESTING_daemon_stop (d3, TIMEOUT, &shutdown_callback, NULL, | ||
159 | GNUNET_YES, GNUNET_NO); | ||
152 | } | 160 | } |
153 | 161 | ||
154 | /** | 162 | /** |
@@ -161,49 +169,39 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
161 | { | 169 | { |
162 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Failing test with error: `%s'!\n", | 170 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Failing test with error: `%s'!\n", |
163 | (char *) cls); | 171 | (char *) cls); |
164 | GNUNET_SCHEDULER_cancel(bob_task); | ||
165 | GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL); | 172 | GNUNET_SCHEDULER_add_now (&end_badly_cont, NULL); |
166 | ok = 1; | 173 | ok = 1; |
167 | } | 174 | } |
168 | 175 | ||
169 | static void | 176 | static void |
170 | do_lookup(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 177 | commence_testing(void) |
171 | { | 178 | { |
179 | struct hostent *he; | ||
180 | struct in_addr a; | ||
181 | char* addr; | ||
182 | |||
183 | he = gethostbyname (TEST_DOMAIN); | ||
184 | |||
185 | if (he) | ||
186 | { | ||
187 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "name: %s\n", he->h_name); | ||
188 | while (*he->h_addr_list) | ||
189 | { | ||
190 | bcopy(*he->h_addr_list++, (char *) &a, sizeof(a)); | ||
191 | addr = inet_ntoa(a); | ||
192 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr); | ||
193 | if (strcmp(addr, TEST_IP) == 0) | ||
194 | ok = 0; | ||
195 | } | ||
196 | } | ||
197 | else | ||
198 | ok = 1; | ||
172 | //do lookup here | 199 | //do lookup here |
173 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 200 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
174 | (GNUNET_TIME_UNIT_SECONDS, 30), | 201 | (GNUNET_TIME_UNIT_SECONDS, 30), |
175 | &finish_testing, NULL); | 202 | &finish_testing, NULL); |
176 | } | 203 | } |
177 | 204 | ||
178 | static void | ||
179 | gns_started(void *cls, const struct GNUNET_PeerIdentity *id, | ||
180 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
181 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | ||
182 | { | ||
183 | if (NULL != emsg) | ||
184 | { | ||
185 | if (d == d1) | ||
186 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNS failed to start alice\n"); | ||
187 | else | ||
188 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNS failed to start bob\n"); | ||
189 | return; | ||
190 | } | ||
191 | if (d == d1) | ||
192 | { | ||
193 | /* start gns for bob */ | ||
194 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNS started on alice\n"); | ||
195 | GNUNET_TESTING_daemon_start_service (d2, "gns", TIMEOUT, &gns_started, | ||
196 | NULL); | ||
197 | return; | ||
198 | } | ||
199 | |||
200 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "GNS started on bob\n"); | ||
201 | |||
202 | /* start the lookup tests */ | ||
203 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
204 | (GNUNET_TIME_UNIT_SECONDS, 1), | ||
205 | &do_lookup, NULL); | ||
206 | } | ||
207 | 205 | ||
208 | /** | 206 | /** |
209 | * This function is called whenever a connection attempt is finished between two of | 207 | * This function is called whenever a connection attempt is finished between two of |
@@ -251,10 +249,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *first, | |||
251 | #endif | 249 | #endif |
252 | GNUNET_SCHEDULER_cancel (die_task); | 250 | GNUNET_SCHEDULER_cancel (die_task); |
253 | die_task = | 251 | die_task = |
254 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from test lookup"); | 252 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from connect"); |
255 | 253 | commence_testing(); | |
256 | /* start gns for alice */ | ||
257 | GNUNET_TESTING_daemon_start_service (d1, "gns", TIMEOUT, &gns_started, NULL); | ||
258 | 254 | ||
259 | } | 255 | } |
260 | else if (total_connections + failed_connections == expected_connections) | 256 | else if (total_connections + failed_connections == expected_connections) |
@@ -264,55 +260,49 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *first, | |||
264 | GNUNET_SCHEDULER_add_now (&end_badly, | 260 | GNUNET_SCHEDULER_add_now (&end_badly, |
265 | "from topology_callback (too many failed connections)"); | 261 | "from topology_callback (too many failed connections)"); |
266 | } | 262 | } |
263 | else | ||
264 | { | ||
265 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting peers dave, bob\n"); | ||
266 | GNUNET_TESTING_daemons_connect (d3, d2, TIMEOUT, 5, 1, | ||
267 | ¬ify_connect, NULL); | ||
268 | } | ||
267 | } | 269 | } |
268 | 270 | ||
269 | /** | 271 | /** |
270 | * Set up some data, and call API PUT function | 272 | * Set up some data, and call API PUT function |
271 | */ | 273 | */ |
272 | static void | 274 | static void |
273 | alice_idle (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 275 | connect_ab (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
274 | { | 276 | { |
275 | 277 | ||
276 | alice_online = 1; | 278 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting peers alice, bob\n"); |
277 | if (!bob_online) | ||
278 | { | ||
279 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
280 | (GNUNET_TIME_UNIT_SECONDS, 2), | ||
281 | &alice_idle, NULL); | ||
282 | return; | ||
283 | } | ||
284 | |||
285 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Connecting peers\n"); | ||
286 | GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, 5, 1, | 279 | GNUNET_TESTING_daemons_connect (d1, d2, TIMEOUT, 5, 1, |
287 | ¬ify_connect, NULL); | 280 | ¬ify_connect, NULL); |
288 | } | 281 | } |
289 | 282 | ||
283 | |||
290 | static void | 284 | static void |
291 | bob_idle (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 285 | dave_started (void *cls, const struct GNUNET_PeerIdentity *id, |
286 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
287 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | ||
292 | { | 288 | { |
293 | /* he's lazy FIXME forever */ | 289 | if (emsg != NULL) |
294 | bob_online = 1; | 290 | { |
295 | bob_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 291 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
296 | (GNUNET_TIME_UNIT_SECONDS, 20), | 292 | "Failed to start daemon with error: `%s'\n", emsg); |
297 | &bob_idle, NULL); | 293 | return; |
294 | } | ||
295 | GNUNET_assert (id != NULL); | ||
296 | |||
297 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
298 | (GNUNET_TIME_UNIT_SECONDS, 2), | ||
299 | &connect_ab, NULL); | ||
298 | } | 300 | } |
299 | 301 | ||
300 | 302 | ||
301 | 303 | ||
302 | |||
303 | /** | ||
304 | * Callback which is called whenever a peer is started (as a result of the | ||
305 | * GNUNET_TESTING_daemons_start call. | ||
306 | * | ||
307 | * @param cls closure argument given to GNUNET_TESTING_daemons_start | ||
308 | * @param id the GNUNET_PeerIdentity of the started peer | ||
309 | * @param cfg the configuration for this specific peer (needed to connect | ||
310 | * to the DHT) | ||
311 | * @param d the handle to the daemon started | ||
312 | * @param emsg NULL if peer started, non-NULL on error | ||
313 | */ | ||
314 | static void | 304 | static void |
315 | alice_started (void *cls, const struct GNUNET_PeerIdentity *id, | 305 | bob_started (void *cls, const struct GNUNET_PeerIdentity *id, |
316 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 306 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
317 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 307 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
318 | { | 308 | { |
@@ -324,13 +314,27 @@ alice_started (void *cls, const struct GNUNET_PeerIdentity *id, | |||
324 | } | 314 | } |
325 | GNUNET_assert (id != NULL); | 315 | GNUNET_assert (id != NULL); |
326 | 316 | ||
327 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 317 | //Start bob |
328 | (GNUNET_TIME_UNIT_SECONDS, 2), | 318 | d3 = GNUNET_TESTING_daemon_start(cfg_dave, TIMEOUT, GNUNET_NO, NULL, NULL, 0, |
329 | &alice_idle, NULL); | 319 | NULL, NULL, NULL, &dave_started, NULL); |
320 | |||
330 | } | 321 | } |
331 | 322 | ||
323 | |||
324 | |||
325 | /** | ||
326 | * Callback which is called whenever a peer is started (as a result of the | ||
327 | * GNUNET_TESTING_daemons_start call. | ||
328 | * | ||
329 | * @param cls closure argument given to GNUNET_TESTING_daemons_start | ||
330 | * @param id the GNUNET_PeerIdentity of the started peer | ||
331 | * @param cfg the configuration for this specific peer (needed to connect | ||
332 | * to the DHT) | ||
333 | * @param d the handle to the daemon started | ||
334 | * @param emsg NULL if peer started, non-NULL on error | ||
335 | */ | ||
332 | static void | 336 | static void |
333 | bob_started (void *cls, const struct GNUNET_PeerIdentity *id, | 337 | alice_started (void *cls, const struct GNUNET_PeerIdentity *id, |
334 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 338 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
335 | struct GNUNET_TESTING_Daemon *d, const char *emsg) | 339 | struct GNUNET_TESTING_Daemon *d, const char *emsg) |
336 | { | 340 | { |
@@ -342,9 +346,10 @@ bob_started (void *cls, const struct GNUNET_PeerIdentity *id, | |||
342 | } | 346 | } |
343 | GNUNET_assert (id != NULL); | 347 | GNUNET_assert (id != NULL); |
344 | 348 | ||
345 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 349 | //Start bob |
346 | (GNUNET_TIME_UNIT_SECONDS, 2), | 350 | d2 = GNUNET_TESTING_daemon_start(cfg_bob, TIMEOUT, GNUNET_NO, NULL, NULL, 0, |
347 | &bob_idle, NULL); | 351 | NULL, NULL, NULL, &bob_started, NULL); |
352 | |||
348 | } | 353 | } |
349 | 354 | ||
350 | static void | 355 | static void |
@@ -352,12 +357,6 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
352 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 357 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
353 | { | 358 | { |
354 | 359 | ||
355 | struct GNUNET_NAMESTORE_Handle* namestore_handle; | ||
356 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey, bob_pkey; | ||
357 | struct GNUNET_CRYPTO_RsaPrivateKey *alice_key, *bob_key; | ||
358 | char* bob_keyfile; | ||
359 | char* alice_keyfile; | ||
360 | |||
361 | /* Get path from configuration file */ | 360 | /* Get path from configuration file */ |
362 | if (GNUNET_YES != | 361 | if (GNUNET_YES != |
363 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", | 362 | GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome", |
@@ -376,95 +375,22 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
376 | /* Set peers_left so we know when all peers started */ | 375 | /* Set peers_left so we know when all peers started */ |
377 | peers_left = num_peers; | 376 | peers_left = num_peers; |
378 | 377 | ||
379 | /* Somebody care to explain? */ | ||
380 | uint16_t port = 6000; | ||
381 | uint32_t upnum = 23; | ||
382 | uint32_t fdnum = 42; | ||
383 | |||
384 | /** | 378 | /** |
385 | * Modify some config options for bob | 379 | * Modify some config options for peers |
386 | * namely swap keys and disable dns hijacking | ||
387 | */ | 380 | */ |
388 | struct GNUNET_CONFIGURATION_Handle *cfg2 = GNUNET_TESTING_create_cfg(cfg, | 381 | cfg_alice = GNUNET_CONFIGURATION_create(); |
389 | 23, &port, &upnum, | 382 | GNUNET_CONFIGURATION_load (cfg_alice, "test_gns_dht_alice.conf"); |
390 | NULL, &fdnum); | 383 | |
391 | 384 | cfg_bob = GNUNET_CONFIGURATION_create(); | |
392 | GNUNET_CONFIGURATION_set_value_string (cfg2, "paths", "servicehome", | 385 | GNUNET_CONFIGURATION_load (cfg_bob, "test_gns_dht_bob.conf"); |
393 | "/tmp/test-gnunetd-gns-peer-2/"); | ||
394 | GNUNET_CONFIGURATION_set_value_string (cfg2, "gns", "HIJACK_DNS", | ||
395 | "NO"); | ||
396 | GNUNET_CONFIGURATION_set_value_string (cfg2, "gns", "ZONEKEY", | ||
397 | "/tmp/bobkey"); | ||
398 | 386 | ||
399 | /* put records into namestore */ | 387 | cfg_dave = GNUNET_CONFIGURATION_create(); |
400 | namestore_handle = GNUNET_NAMESTORE_connect(cfg); | 388 | GNUNET_CONFIGURATION_load (cfg_dave, "test_gns_dht_dave.conf"); |
401 | if (NULL == namestore_handle) | ||
402 | { | ||
403 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to connect to namestore\n"); | ||
404 | ok = -1; | ||
405 | return; | ||
406 | } | ||
407 | 389 | ||
408 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns", | 390 | GNUNET_CONFIGURATION_load (cfg_alice, "test_gns_dht_alice.conf"); |
409 | "ZONEKEY", | 391 | GNUNET_CONFIGURATION_load (cfg_bob, "test_gns_dht_bob.conf"); |
410 | &alice_keyfile)) | 392 | GNUNET_CONFIGURATION_load (cfg_dave, "test_gns_dht_dave.conf"); |
411 | { | ||
412 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get alice's key from cfg\n"); | ||
413 | ok = -1; | ||
414 | return; | ||
415 | } | ||
416 | 393 | ||
417 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg2, "gns", | ||
418 | "ZONEKEY", | ||
419 | &bob_keyfile)) | ||
420 | { | ||
421 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to get bob's key from cfg\n"); | ||
422 | ok = -1; | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile); | ||
427 | bob_key = GNUNET_CRYPTO_rsa_key_create_from_file (bob_keyfile); | ||
428 | |||
429 | GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey); | ||
430 | GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey); | ||
431 | |||
432 | struct GNUNET_NAMESTORE_RecordData rd; | ||
433 | rd.data = &bob_pkey; | ||
434 | rd.expiration = GNUNET_TIME_absolute_get_forever (); | ||
435 | rd.data_size = sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded); | ||
436 | rd.record_type = GNUNET_GNS_RECORD_PKEY; | ||
437 | |||
438 | GNUNET_NAMESTORE_record_create (namestore_handle, | ||
439 | alice_key, | ||
440 | "bob", | ||
441 | &rd, | ||
442 | NULL, | ||
443 | NULL); | ||
444 | |||
445 | rd.data = &alice_pkey; | ||
446 | GNUNET_NAMESTORE_record_create (namestore_handle, | ||
447 | bob_key, | ||
448 | "alice", | ||
449 | &rd, | ||
450 | NULL, | ||
451 | NULL); | ||
452 | |||
453 | char* ip = "127.0.0.1"; | ||
454 | struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); | ||
455 | GNUNET_assert(1 == inet_pton (AF_INET, ip, web)); | ||
456 | |||
457 | rd.data_size = sizeof(struct in_addr); | ||
458 | rd.data = web; | ||
459 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; | ||
460 | |||
461 | GNUNET_NAMESTORE_record_create (namestore_handle, | ||
462 | bob_key, | ||
463 | "www", | ||
464 | &rd, | ||
465 | NULL, | ||
466 | NULL); | ||
467 | |||
468 | /* Set up a task to end testing if peer start fails */ | 394 | /* Set up a task to end testing if peer start fails */ |
469 | die_task = | 395 | die_task = |
470 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, | 396 | GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, |
@@ -472,16 +398,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
472 | 398 | ||
473 | alice_online = 0; | 399 | alice_online = 0; |
474 | bob_online = 0; | 400 | bob_online = 0; |
475 | expected_connections = 1; | 401 | dave_online = 0; |
402 | expected_connections = 2; | ||
476 | 403 | ||
477 | /* Start alice */ | 404 | /* Start alice */ |
478 | d1 = GNUNET_TESTING_daemon_start(cfg, TIMEOUT, GNUNET_NO, NULL, NULL, 0, | 405 | d1 = GNUNET_TESTING_daemon_start(cfg_alice, TIMEOUT, GNUNET_NO, NULL, NULL, 0, |
479 | NULL, NULL, NULL, &alice_started, NULL); | 406 | NULL, NULL, NULL, &alice_started, NULL); |
480 | 407 | ||
481 | 408 | ||
482 | //Start bob | ||
483 | d2 = GNUNET_TESTING_daemon_start(cfg2, TIMEOUT, GNUNET_NO, NULL, NULL, 0, | ||
484 | NULL, NULL, NULL, &bob_started, NULL); | ||
485 | 409 | ||
486 | 410 | ||
487 | } | 411 | } |
diff --git a/src/gns/testdb/sqlite-alice.db b/src/gns/testdb/sqlite-alice.db new file mode 100644 index 000000000..3a428a881 --- /dev/null +++ b/src/gns/testdb/sqlite-alice.db | |||
Binary files differ | |||
diff --git a/src/gns/testdb/sqlite-alice.db.bak b/src/gns/testdb/sqlite-alice.db.bak new file mode 100644 index 000000000..e4b98a13b --- /dev/null +++ b/src/gns/testdb/sqlite-alice.db.bak | |||
Binary files differ | |||
diff --git a/src/gns/testdb/sqlite-bob.db b/src/gns/testdb/sqlite-bob.db new file mode 100644 index 000000000..14749db37 --- /dev/null +++ b/src/gns/testdb/sqlite-bob.db | |||
Binary files differ | |||
diff --git a/src/gns/testdb/sqlite-dave.db b/src/gns/testdb/sqlite-dave.db new file mode 100644 index 000000000..10b9d82c6 --- /dev/null +++ b/src/gns/testdb/sqlite-dave.db | |||
Binary files differ | |||
diff --git a/src/gns/testkeys/KAILNI4SSH8M6QR6S8QRSGBBLMA8377HL6F60TEMO7S7TT1OR8CG.zkey b/src/gns/testkeys/KAILNI4SSH8M6QR6S8QRSGBBLMA8377HL6F60TEMO7S7TT1OR8CG.zkey new file mode 100644 index 000000000..54dcd2d50 --- /dev/null +++ b/src/gns/testkeys/KAILNI4SSH8M6QR6S8QRSGBBLMA8377HL6F60TEMO7S7TT1OR8CG.zkey | |||
Binary files differ | |||
diff --git a/src/gns/testkeys/KRPVFMVBFKEGUS6KL8SFPEUMORFPP9ERE6AC98KO9NADBMPF7TOG.zkey b/src/gns/testkeys/KRPVFMVBFKEGUS6KL8SFPEUMORFPP9ERE6AC98KO9NADBMPF7TOG.zkey new file mode 100644 index 000000000..8407313af --- /dev/null +++ b/src/gns/testkeys/KRPVFMVBFKEGUS6KL8SFPEUMORFPP9ERE6AC98KO9NADBMPF7TOG.zkey | |||
Binary files differ | |||
diff --git a/src/gns/testkeys/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey b/src/gns/testkeys/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey new file mode 100644 index 000000000..871fc90ed --- /dev/null +++ b/src/gns/testkeys/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey | |||
Binary files differ | |||