aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-06-12 11:09:50 +0200
committerChristian Grothoff <christian@grothoff.org>2018-06-12 11:10:01 +0200
commitae8b5cb2eac770be0d18b7d46c238bf865e34023 (patch)
tree78ecc715e15d4116390adde53b4e117f432bb599
parentbb581dc55bfb90fc7f34797111b55d16e69b7af0 (diff)
complain if datacache returns expired values
-rw-r--r--src/dht/gnunet-service-dht_datacache.c5
-rw-r--r--src/gns/gnunet-service-gns_resolver.c16
-rw-r--r--src/gnsrecord/gnsrecord_crypto.c12
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 1f01387ff8..7ad9aa7280 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 a90cc4c0ed..54c3cba23c 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 0752086feb..295d311007 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)