aboutsummaryrefslogtreecommitdiff
path: root/src/block
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2011-02-05 21:52:36 +0000
committerPhilipp Tölke <toelke@in.tum.de>2011-02-05 21:52:36 +0000
commit612235341a02beb9bcd00b7e83e7121612b23e45 (patch)
treefe527ba90ffc8b8d7389697131767f2dd871fb39 /src/block
parent79a97ba287c5aa8618fecdb60925a3dacf277d3a (diff)
downloadgnunet-612235341a02beb9bcd00b7e83e7121612b23e45.tar.gz
gnunet-612235341a02beb9bcd00b7e83e7121612b23e45.zip
debug DNS-DHT
Diffstat (limited to 'src/block')
-rw-r--r--src/block/plugin_block_dns.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/block/plugin_block_dns.c b/src/block/plugin_block_dns.c
index 4321baf34..681a659ae 100644
--- a/src/block/plugin_block_dns.c
+++ b/src/block/plugin_block_dns.c
@@ -67,21 +67,36 @@ block_plugin_dns_evaluate (void *cls,
67 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; 67 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
68 68
69 if (reply_block_size != sizeof(struct GNUNET_DNS_Record)) 69 if (reply_block_size != sizeof(struct GNUNET_DNS_Record))
70 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 70 {
71 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: reply_block_size=%d != %d\n", reply_block_size, sizeof(struct GNUNET_DNS_Record));
72 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
73 }
71 74
72 const struct GNUNET_DNS_Record* rec = reply_block; 75 const struct GNUNET_DNS_Record* rec = reply_block;
73 76
74 if (ntohl(rec->purpose.size) != sizeof(struct GNUNET_DNS_Record) - sizeof(struct GNUNET_CRYPTO_RsaSignature)) 77 if (ntohl(rec->purpose.size) != sizeof(struct GNUNET_DNS_Record) - sizeof(struct GNUNET_CRYPTO_RsaSignature))
75 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 78 {
79 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
80 "DNS-Block is invalid: rec->purpose.size=%d != %d\n",
81 ntohl(rec->purpose.size),
82 sizeof(struct GNUNET_DNS_Record) - sizeof(struct GNUNET_CRYPTO_RsaSignature));
83 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
84 }
76 85
77 if (GNUNET_TIME_relative_get_zero().rel_value == GNUNET_TIME_absolute_get_remaining(rec->expiration_time).rel_value) 86 if (GNUNET_TIME_relative_get_zero().rel_value == GNUNET_TIME_absolute_get_remaining(rec->expiration_time).rel_value)
78 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 87 {
88 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: Timeout\n");
89 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
90 }
79 91
80 if (GNUNET_OK != GNUNET_CRYPTO_rsa_verify (htonl(GNUNET_SIGNATURE_PURPOSE_DNS_RECORD), 92 if (GNUNET_OK != GNUNET_CRYPTO_rsa_verify (htonl(GNUNET_SIGNATURE_PURPOSE_DNS_RECORD),
81 &rec->purpose, 93 &rec->purpose,
82 &rec->signature, 94 &rec->signature,
83 &rec->peer)) 95 &rec->peer))
84 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 96 {
97 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DNS-Block is invalid: invalid signature\n");
98 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
99 }
85 100
86 /* How to decide whether there are no more? */ 101 /* How to decide whether there are no more? */
87 return GNUNET_BLOCK_EVALUATION_OK_MORE; 102 return GNUNET_BLOCK_EVALUATION_OK_MORE;