From: Christian Grothoff Date: Tue, 12 Jun 2018 09:09:50 +0000 (+0200) Subject: complain if datacache returns expired values X-Git-Tag: v0.11.0~319^2~23^2~7^2~5 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ae8b5cb2eac770be0d18b7d46c238bf865e34023;p=oweals%2Fgnunet.git complain if datacache returns expired values --- 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, struct GetRequestContext *ctx = cls; enum GNUNET_BLOCK_EvaluationResult eval; + if (0 == GNUNET_TIME_absolute_get_remaining (exp).rel_value_us) + { + GNUNET_break (0); /* why does datacache return expired values? */ + return GNUNET_OK; /* skip expired record */ + } if ( (NULL == data) && (0 == data_size) ) 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, } } GNUNET_assert (i < vpn_ctx->rd_count); + if (0 == vpn_ctx->rd_count) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + _("VPN returned empty result for `%s'\n"), + rh->name); handle_gns_resolution_result (rh, vpn_ctx->rd_count, rd); @@ -1859,7 +1863,8 @@ handle_gns_resolution_result (void *cls, if (0 == rd_count) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, - _("GNS lookup failed (zero records found)\n")); + _("GNS lookup failed (zero records found for `%s')\n"), + rh->name); fail_resolution (rh); return; } @@ -2370,6 +2375,11 @@ handle_dht_response (void *cls, fail_resolution (rh); return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Decrypting DHT block of size %u for `%s', expires %s\n", + ntohl (block->purpose.size), + rh->name, + GNUNET_STRINGS_absolute_time_to_string (exp)); if (GNUNET_OK != GNUNET_GNSRECORD_block_decrypt (block, &ac->authority_info.gns_authority, @@ -2450,6 +2460,10 @@ handle_gns_namecache_resolution_result (void *cls, { struct GNS_ResolverHandle *rh = cls; + if (0 == rd_count) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + _("GNS namecache returned empty result for `%s'\n"), + rh->name); handle_gns_resolution_result (rh, rd_count, 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, (0 == (rd[k].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD)) ) { include_record = GNUNET_NO; /* We have a non-expired, non-shadow record of the same type */ + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Ignoring shadow record\n"); break; } } @@ -395,6 +397,16 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, rd[j] = rd[i]; j++; } + else + { + struct GNUNET_TIME_Absolute at; + + at.abs_value_us = rd[i].expiration_time; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Excluding record that expired %s (%llu ago)\n", + GNUNET_STRINGS_absolute_time_to_string (at), + (unsigned long long) rd[i].expiration_time - now.abs_value_us); + } } rd_count = j; if (NULL != proc)