aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-05 11:52:49 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-05 11:52:49 +0000
commit792c76e8191e9d40e02aebc66c12765972131ec3 (patch)
treee74c1264b9348b00997b1723b7d99a350c126b5e
parent6d021e2931dbe18230ab763ca1251012fa753ced (diff)
downloadgnunet-792c76e8191e9d40e02aebc66c12765972131ec3.tar.gz
gnunet-792c76e8191e9d40e02aebc66c12765972131ec3.zip
-activate shortening logic (#3012)
-rw-r--r--src/gns/gnunet-service-gns_resolver.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index f91e9b2ad..49906accd 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -25,7 +25,6 @@
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 * 26 *
27 * URGENT: 27 * URGENT:
28 * - shortening triggers
29 * - We currently go to the DHT simply if we find no local reply; this 28 * - We currently go to the DHT simply if we find no local reply; this
30 * is incorrect; the correct rules for going to DHT are: 29 * is incorrect; the correct rules for going to DHT are:
31 * 30 *
@@ -42,7 +41,7 @@
42 * TODO: 41 * TODO:
43 * - GNS: handle special SRV names --- no delegation, direct lookup; 42 * - GNS: handle special SRV names --- no delegation, direct lookup;
44 * can likely be done in 'resolver_lookup_get_next_label'. (#3003) 43 * can likely be done in 'resolver_lookup_get_next_label'. (#3003)
45 * - revocation checks (make optional: privacy!), (#3004) 44 * - revocation checks (use CORE-level broadcasts!), (#3004)
46 * - DNAME support (#3005) 45 * - DNAME support (#3005)
47 */ 46 */
48#include "platform.h" 47#include "platform.h"
@@ -506,6 +505,7 @@ fail_resolution (void *cls,
506 GNS_resolver_lookup_cancel (rh); 505 GNS_resolver_lookup_cancel (rh);
507} 506}
508 507
508
509#if (defined WINDOWS) || (defined DARWIN) 509#if (defined WINDOWS) || (defined DARWIN)
510/* Don't have this on W32, here's a naive implementation 510/* Don't have this on W32, here's a naive implementation
511 * Was somehow removed on OS X ... */ 511 * Was somehow removed on OS X ... */
@@ -522,6 +522,7 @@ memrchr (const void *s, int c, size_t n)
522} 522}
523#endif 523#endif
524 524
525
525/** 526/**
526 * Get the next, rightmost label from the name that we are trying to resolve, 527 * Get the next, rightmost label from the name that we are trying to resolve,
527 * and update the resolution position accordingly. 528 * and update the resolution position accordingly.
@@ -706,7 +707,7 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh);
706 * we were attempting to make 707 * we were attempting to make
707 * @param rs socket that received the response 708 * @param rs socket that received the response
708 * @param dns dns response, never NULL 709 * @param dns dns response, never NULL
709 * @param dns_len number of bytes in 'dns' 710 * @param dns_len number of bytes in @a dns
710 */ 711 */
711static void 712static void
712dns_result_parser (void *cls, 713dns_result_parser (void *cls,
@@ -1323,6 +1324,22 @@ handle_gns_resolution_result (void *cls,
1323 } 1324 }
1324 } 1325 }
1325 break; 1326 break;
1327 case GNUNET_NAMESTORE_TYPE_PKEY:
1328 /* tigger shortening */
1329 if (NULL != rh->shorten_key)
1330 {
1331 struct GNUNET_CRYPTO_EccPublicKey pub;
1332
1333 if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicKey))
1334 {
1335 GNUNET_break_op (0);
1336 break;
1337 }
1338 memcpy (&pub, rd[i].data, rd[i].data_size);
1339 GNS_shorten_start (rh->ac_tail->label,
1340 &pub,
1341 rh->shorten_key);
1342 }
1326 default: 1343 default:
1327 break; 1344 break;
1328 } 1345 }
@@ -1356,6 +1373,12 @@ handle_gns_resolution_result (void *cls,
1356 rd[i].data, 1373 rd[i].data,
1357 sizeof (struct GNUNET_CRYPTO_EccPublicKey)); 1374 sizeof (struct GNUNET_CRYPTO_EccPublicKey));
1358 ac->label = resolver_lookup_get_next_label (rh); 1375 ac->label = resolver_lookup_get_next_label (rh);
1376 /* tigger shortening */
1377 if (NULL != rh->shorten_key)
1378 GNS_shorten_start (rh->ac_tail->label,
1379 &ac->authority_info.gns_authority,
1380 rh->shorten_key);
1381 /* add AC to tail */
1359 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1382 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1360 rh->ac_tail, 1383 rh->ac_tail,
1361 ac); 1384 ac);