diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-06-12 11:09:50 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-06-12 11:10:01 +0200 |
commit | ae8b5cb2eac770be0d18b7d46c238bf865e34023 (patch) | |
tree | 78ecc715e15d4116390adde53b4e117f432bb599 | |
parent | bb581dc55bfb90fc7f34797111b55d16e69b7af0 (diff) | |
download | gnunet-ae8b5cb2eac770be0d18b7d46c238bf865e34023.tar.gz gnunet-ae8b5cb2eac770be0d18b7d46c238bf865e34023.zip |
complain if datacache returns expired values
-rw-r--r-- | src/dht/gnunet-service-dht_datacache.c | 5 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 16 | ||||
-rw-r--r-- | src/gnsrecord/gnsrecord_crypto.c | 12 |
3 files changed, 32 insertions, 1 deletions
diff --git a/src/dht/gnunet-service-dht_datacache.c b/src/dht/gnunet-service-dht_datacache.c index 1f01387ff..7ad9aa728 100644 --- a/src/dht/gnunet-service-dht_datacache.c +++ b/src/dht/gnunet-service-dht_datacache.c | |||
@@ -171,6 +171,11 @@ datacache_get_iterator (void *cls, | |||
171 | struct GetRequestContext *ctx = cls; | 171 | struct GetRequestContext *ctx = cls; |
172 | enum GNUNET_BLOCK_EvaluationResult eval; | 172 | enum GNUNET_BLOCK_EvaluationResult eval; |
173 | 173 | ||
174 | if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us) | ||
175 | { | ||
176 | GNUNET_break (0); /* why does datacache return expired values? */ | ||
177 | return GNUNET_OK; /* skip expired record */ | ||
178 | } | ||
174 | if ( (NULL == data) && | 179 | if ( (NULL == data) && |
175 | (0 == data_size) ) | 180 | (0 == data_size) ) |
176 | data = &non_null; /* point anywhere, but not to NULL */ | 181 | data = &non_null; /* point anywhere, but not to NULL */ |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index a90cc4c0e..54c3cba23 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -1377,6 +1377,10 @@ vpn_allocation_cb (void *cls, | |||
1377 | } | 1377 | } |
1378 | } | 1378 | } |
1379 | GNUNET_assert (i < vpn_ctx->rd_count); | 1379 | GNUNET_assert (i < vpn_ctx->rd_count); |
1380 | if (0 == vpn_ctx->rd_count) | ||
1381 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1382 | _("VPN returned empty result for `%s'\n"), | ||
1383 | rh->name); | ||
1380 | handle_gns_resolution_result (rh, | 1384 | handle_gns_resolution_result (rh, |
1381 | vpn_ctx->rd_count, | 1385 | vpn_ctx->rd_count, |
1382 | rd); | 1386 | rd); |
@@ -1859,7 +1863,8 @@ handle_gns_resolution_result (void *cls, | |||
1859 | if (0 == rd_count) | 1863 | if (0 == rd_count) |
1860 | { | 1864 | { |
1861 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1865 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1862 | _("GNS lookup failed (zero records found)\n")); | 1866 | _("GNS lookup failed (zero records found for `%s')\n"), |
1867 | rh->name); | ||
1863 | fail_resolution (rh); | 1868 | fail_resolution (rh); |
1864 | return; | 1869 | return; |
1865 | } | 1870 | } |
@@ -2370,6 +2375,11 @@ handle_dht_response (void *cls, | |||
2370 | fail_resolution (rh); | 2375 | fail_resolution (rh); |
2371 | return; | 2376 | return; |
2372 | } | 2377 | } |
2378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2379 | "Decrypting DHT block of size %u for `%s', expires %s\n", | ||
2380 | ntohl (block->purpose.size), | ||
2381 | rh->name, | ||
2382 | GNUNET_STRINGS_absolute_time_to_string (exp)); | ||
2373 | if (GNUNET_OK != | 2383 | if (GNUNET_OK != |
2374 | GNUNET_GNSRECORD_block_decrypt (block, | 2384 | GNUNET_GNSRECORD_block_decrypt (block, |
2375 | &ac->authority_info.gns_authority, | 2385 | &ac->authority_info.gns_authority, |
@@ -2450,6 +2460,10 @@ handle_gns_namecache_resolution_result (void *cls, | |||
2450 | { | 2460 | { |
2451 | struct GNS_ResolverHandle *rh = cls; | 2461 | struct GNS_ResolverHandle *rh = cls; |
2452 | 2462 | ||
2463 | if (0 == rd_count) | ||
2464 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
2465 | _("GNS namecache returned empty result for `%s'\n"), | ||
2466 | rh->name); | ||
2453 | handle_gns_resolution_result (rh, | 2467 | handle_gns_resolution_result (rh, |
2454 | rd_count, | 2468 | rd_count, |
2455 | rd); | 2469 | rd); |
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index 0752086fe..295d31100 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c | |||
@@ -377,6 +377,8 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
377 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ) | 377 | (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ) |
378 | { | 378 | { |
379 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ | 379 | include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ |
380 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
381 | "Ignoring shadow record\n"); | ||
380 | break; | 382 | break; |
381 | } | 383 | } |
382 | } | 384 | } |
@@ -395,6 +397,16 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
395 | rd[j] = rd[i]; | 397 | rd[j] = rd[i]; |
396 | j++; | 398 | j++; |
397 | } | 399 | } |
400 | else | ||
401 | { | ||
402 | struct GNUNET_TIME_Absolute at; | ||
403 | |||
404 | at.abs_value_us = rd[i].expiration_time; | ||
405 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
406 | "Excluding record that expired %s (%llu ago)\n", | ||
407 | GNUNET_STRINGS_absolute_time_to_string (at), | ||
408 | (unsigned long long) rd[i].expiration_time - now.abs_value_us); | ||
409 | } | ||
398 | } | 410 | } |
399 | rd_count = j; | 411 | rd_count = j; |
400 | if (NULL != proc) | 412 | if (NULL != proc) |