aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-02-19 16:06:34 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-19 16:06:34 +0100
commit95ffa9b9ac9711539aac3feb15eefcfebfc14825 (patch)
tree9f4d5a853807d60f8e1a786ff3d48eb078792e68 /src/dht
parent901b2fcc56a618a0d3e9d3e65c8688f84e3e180c (diff)
downloadgnunet-95ffa9b9ac9711539aac3feb15eefcfebfc14825.tar.gz
gnunet-95ffa9b9ac9711539aac3feb15eefcfebfc14825.zip
-fix htons/htonl bug introduced by message format change
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/gnunet-dht-get.c24
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c107
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h8
3 files changed, 80 insertions, 59 deletions
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c
index f1076490b..42ffe75ba 100644
--- a/src/dht/gnunet-dht-get.c
+++ b/src/dht/gnunet-dht-get.c
@@ -58,6 +58,11 @@ static unsigned int verbose;
58static int demultixplex_everywhere; 58static int demultixplex_everywhere;
59 59
60/** 60/**
61 * Use #GNUNET_DHT_RO_RECORD_ROUTE.
62 */
63static int record_route;
64
65/**
61 * Handle to the DHT 66 * Handle to the DHT
62 */ 67 */
63static struct GNUNET_DHT_Handle *dht_handle; 68static struct GNUNET_DHT_Handle *dht_handle;
@@ -160,9 +165,9 @@ get_result_iterator (void *cls,
160 : _ ("Result %d, type %d:\n"), 165 : _ ("Result %d, type %d:\n"),
161 result_count, 166 result_count,
162 type, 167 type,
163 (unsigned int) size, 168 (int) size,
164 (char *) data); 169 (char *) data);
165 if (verbose) 170 if (record_route && verbose)
166 { 171 {
167 fprintf (stdout, 172 fprintf (stdout,
168 " GET path: "); 173 " GET path: ");
@@ -200,6 +205,7 @@ run (void *cls,
200 const struct GNUNET_CONFIGURATION_Handle *c) 205 const struct GNUNET_CONFIGURATION_Handle *c)
201{ 206{
202 struct GNUNET_HashCode key; 207 struct GNUNET_HashCode key;
208 enum GNUNET_DHT_RouteOption ro;
203 209
204 cfg = c; 210 cfg = c;
205 if (NULL == query_key) 211 if (NULL == query_key)
@@ -228,13 +234,16 @@ run (void *cls,
228 GNUNET_h2s_full (&key)); 234 GNUNET_h2s_full (&key));
229 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL); 235 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
230 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, &timeout_task, NULL); 236 tt = GNUNET_SCHEDULER_add_delayed (timeout_request, &timeout_task, NULL);
237 ro = GNUNET_DHT_RO_NONE;
238 if (demultixplex_everywhere)
239 ro |= GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE;
240 if (record_route)
241 ro |= GNUNET_DHT_RO_RECORD_ROUTE;
231 get_handle = GNUNET_DHT_get_start (dht_handle, 242 get_handle = GNUNET_DHT_get_start (dht_handle,
232 query_type, 243 query_type,
233 &key, 244 &key,
234 replication, 245 replication,
235 (demultixplex_everywhere) 246 ro,
236 ? GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE
237 : GNUNET_DHT_RO_NONE,
238 NULL, 247 NULL,
239 0, 248 0,
240 &get_result_iterator, 249 &get_result_iterator,
@@ -265,6 +274,11 @@ main (int argc, char *const *argv)
265 "LEVEL", 274 "LEVEL",
266 gettext_noop ("how many parallel requests (replicas) to create"), 275 gettext_noop ("how many parallel requests (replicas) to create"),
267 &replication), 276 &replication),
277 GNUNET_GETOPT_option_flag (
278 'R',
279 "record",
280 gettext_noop ("use DHT's record route option"),
281 &record_route),
268 GNUNET_GETOPT_option_uint ( 282 GNUNET_GETOPT_option_uint (
269 't', 283 't',
270 "type", 284 "type",
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 68d431d17..fb965b569 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -71,6 +71,7 @@
71#define DHT_MINIMUM_FIND_PEER_INTERVAL GNUNET_TIME_relative_multiply ( \ 71#define DHT_MINIMUM_FIND_PEER_INTERVAL GNUNET_TIME_relative_multiply ( \
72 GNUNET_TIME_UNIT_MINUTES, 2) 72 GNUNET_TIME_UNIT_MINUTES, 2)
73 73
74
74/** 75/**
75 * How long to additionally wait on average per #bucket_size to send out the 76 * How long to additionally wait on average per #bucket_size to send out the
76 * FIND PEER requests if we did successfully connect (!) to a a new peer and 77 * FIND PEER requests if we did successfully connect (!) to a a new peer and
@@ -80,7 +81,7 @@
80 * top). Also the range in which we randomize, so the effective value 81 * top). Also the range in which we randomize, so the effective value
81 * is half of the number given here. 82 * is half of the number given here.
82 */ 83 */
83#define DHT_AVG_FIND_PEER_INTERVAL GNUNET_TIME_relative_multiply ( \ 84#define DHT_AVG_FIND_PEER_INTERVAL GNUNET_TIME_relative_multiply ( \
84 GNUNET_TIME_UNIT_SECONDS, 6) 85 GNUNET_TIME_UNIT_SECONDS, 6)
85 86
86/** 87/**
@@ -629,7 +630,7 @@ send_find_peer_message (void *cls)
629 GNUNET_CRYPTO_QUALITY_WEAK, 630 GNUNET_CRYPTO_QUALITY_WEAK,
630 GNUNET_TIME_relative_multiply ( 631 GNUNET_TIME_relative_multiply (
631 DHT_AVG_FIND_PEER_INTERVAL, 632 DHT_AVG_FIND_PEER_INTERVAL,
632 100 * (1 + newly_found_peers) / bucket_size).rel_value_us); 633 1 + 100 * (1 + newly_found_peers) / bucket_size).rel_value_us);
633 newly_found_peers = 0; 634 newly_found_peers = 0;
634 GNUNET_assert (NULL == find_peer_task); 635 GNUNET_assert (NULL == find_peer_task);
635 find_peer_task = 636 find_peer_task =
@@ -712,7 +713,7 @@ update_hold (struct PeerBucket *bucket)
712 { 713 {
713 if (off > bucket_size) 714 if (off > bucket_size)
714 break; /* We only hold up to #bucket_size peers per bucket */ 715 break; /* We only hold up to #bucket_size peers per bucket */
715 bucket_size++; 716 off++;
716 for (struct Target *tp = pos->t_head; 717 for (struct Target *tp = pos->t_head;
717 NULL != tp; 718 NULL != tp;
718 tp = tp->next) 719 tp = tp->next)
@@ -878,8 +879,8 @@ GDS_u_disconnect (void *ctx)
878 * @return Some number of peers to forward the message to 879 * @return Some number of peers to forward the message to
879 */ 880 */
880static unsigned int 881static unsigned int
881get_forward_count (uint32_t hop_count, 882get_forward_count (uint16_t hop_count,
882 uint32_t target_replication) 883 uint16_t target_replication)
883{ 884{
884 uint32_t random_value; 885 uint32_t random_value;
885 uint32_t forward_count; 886 uint32_t forward_count;
@@ -1225,8 +1226,8 @@ select_peer (const struct GNUNET_HashCode *key,
1225static unsigned int 1226static unsigned int
1226get_target_peers (const struct GNUNET_HashCode *key, 1227get_target_peers (const struct GNUNET_HashCode *key,
1227 struct GNUNET_CONTAINER_BloomFilter *bloom, 1228 struct GNUNET_CONTAINER_BloomFilter *bloom,
1228 uint32_t hop_count, 1229 uint16_t hop_count,
1229 uint32_t target_replication, 1230 uint16_t target_replication,
1230 struct PeerInfo ***targets) 1231 struct PeerInfo ***targets)
1231{ 1232{
1232 unsigned int target; 1233 unsigned int target;
@@ -1285,8 +1286,8 @@ get_target_peers (const struct GNUNET_HashCode *key,
1285enum GNUNET_GenericReturnValue 1286enum GNUNET_GenericReturnValue
1286GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd, 1287GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
1287 enum GNUNET_DHT_RouteOption options, 1288 enum GNUNET_DHT_RouteOption options,
1288 uint32_t desired_replication_level, 1289 uint16_t desired_replication_level,
1289 uint32_t hop_count, 1290 uint16_t hop_count,
1290 struct GNUNET_CONTAINER_BloomFilter *bf) 1291 struct GNUNET_CONTAINER_BloomFilter *bf)
1291{ 1292{
1292 unsigned int target_count; 1293 unsigned int target_count;
@@ -1312,9 +1313,11 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
1312 } 1313 }
1313#endif 1314#endif
1314 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1315 "Adding myself (%s) to PUT bloomfilter for %s\n", 1316 "Adding myself (%s) to PUT bloomfilter for %s with RO(%s/%s)\n",
1316 GNUNET_i2s (&GDS_my_identity), 1317 GNUNET_i2s (&GDS_my_identity),
1317 GNUNET_h2s (&bd->key)); 1318 GNUNET_h2s (&bd->key),
1319 (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-",
1320 (options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-");
1318 GNUNET_CONTAINER_bloomfilter_add (bf, 1321 GNUNET_CONTAINER_bloomfilter_add (bf,
1319 &GDS_my_identity_hash); 1322 &GDS_my_identity_hash);
1320 GNUNET_STATISTICS_update (GDS_stats, 1323 GNUNET_STATISTICS_update (GDS_stats,
@@ -1367,11 +1370,11 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
1367 ppm = (struct PeerPutMessage *) buf; 1370 ppm = (struct PeerPutMessage *) buf;
1368 ppm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_PUT); 1371 ppm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_PUT);
1369 ppm->header.size = htons (sizeof (buf)); 1372 ppm->header.size = htons (sizeof (buf));
1370 ppm->options = htonl (options);
1371 ppm->type = htonl (bd->type); 1373 ppm->type = htonl (bd->type);
1372 ppm->hop_count = htonl (hop_count + 1); 1374 ppm->options = htons (options);
1373 ppm->desired_replication_level = htonl (desired_replication_level); 1375 ppm->hop_count = htons (hop_count + 1);
1374 ppm->put_path_length = htonl (put_path_length); 1376 ppm->desired_replication_level = htons (desired_replication_level);
1377 ppm->put_path_length = htons (put_path_length);
1375 ppm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); 1378 ppm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
1376 GNUNET_break (GNUNET_YES == 1379 GNUNET_break (GNUNET_YES ==
1377 GNUNET_CONTAINER_bloomfilter_test (bf, 1380 GNUNET_CONTAINER_bloomfilter_test (bf,
@@ -1417,8 +1420,8 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
1417enum GNUNET_GenericReturnValue 1420enum GNUNET_GenericReturnValue
1418GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, 1421GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1419 enum GNUNET_DHT_RouteOption options, 1422 enum GNUNET_DHT_RouteOption options,
1420 uint32_t desired_replication_level, 1423 uint16_t desired_replication_level,
1421 uint32_t hop_count, 1424 uint16_t hop_count,
1422 const struct GNUNET_HashCode *key, 1425 const struct GNUNET_HashCode *key,
1423 const void *xquery, 1426 const void *xquery,
1424 size_t xquery_size, 1427 size_t xquery_size,
@@ -1444,9 +1447,12 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1444 desired_replication_level, 1447 desired_replication_level,
1445 &targets); 1448 &targets);
1446 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1449 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1447 "Adding myself (%s) to GET bloomfilter for %s\n", 1450 "Adding myself (%s) to GET bloomfilter for %s with RO(%s/%s)\n",
1448 GNUNET_i2s (&GDS_my_identity), 1451 GNUNET_i2s (&GDS_my_identity),
1449 GNUNET_h2s (key)); 1452 GNUNET_h2s (key),
1453 (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-",
1454 (options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-");
1455
1450 GNUNET_CONTAINER_bloomfilter_add (peer_bf, 1456 GNUNET_CONTAINER_bloomfilter_add (peer_bf,
1451 &GDS_my_identity_hash); 1457 &GDS_my_identity_hash);
1452 if (0 == target_count) 1458 if (0 == target_count)
@@ -1494,10 +1500,10 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
1494 pgm = (struct PeerGetMessage *) buf; 1500 pgm = (struct PeerGetMessage *) buf;
1495 pgm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_GET); 1501 pgm->header.type = htons (GNUNET_MESSAGE_TYPE_DHT_P2P_GET);
1496 pgm->header.size = htons (sizeof (buf)); 1502 pgm->header.size = htons (sizeof (buf));
1497 pgm->options = htonl (options);
1498 pgm->type = htonl (type); 1503 pgm->type = htonl (type);
1499 pgm->hop_count = htonl (hop_count + 1); 1504 pgm->options = htons (options);
1500 pgm->desired_replication_level = htonl (desired_replication_level); 1505 pgm->hop_count = htons (hop_count + 1);
1506 pgm->desired_replication_level = htons (desired_replication_level);
1501 pgm->xquery_size = htonl (xquery_size); 1507 pgm->xquery_size = htonl (xquery_size);
1502 pgm->bf_mutator = bf_nonce; 1508 pgm->bf_mutator = bf_nonce;
1503 GNUNET_break (GNUNET_YES == 1509 GNUNET_break (GNUNET_YES ==
@@ -1605,8 +1611,8 @@ GDS_NEIGHBOURS_handle_reply (struct PeerInfo *pi,
1605 prm->header.size = htons (sizeof (buf)); 1611 prm->header.size = htons (sizeof (buf));
1606 prm->type = htonl (bd->type); 1612 prm->type = htonl (bd->type);
1607 prm->reserved = htonl (0); 1613 prm->reserved = htonl (0);
1608 prm->put_path_length = htonl (ppl); 1614 prm->put_path_length = htons (ppl);
1609 prm->get_path_length = htonl (get_path_length); 1615 prm->get_path_length = htons (get_path_length);
1610 prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time); 1616 prm->expiration_time = GNUNET_TIME_absolute_hton (bd->expiration_time);
1611 prm->key = *query_hash; 1617 prm->key = *query_hash;
1612 paths = (struct GNUNET_DHT_PathElement *) &prm[1]; 1618 paths = (struct GNUNET_DHT_PathElement *) &prm[1];
@@ -1664,7 +1670,7 @@ check_dht_p2p_put (void *cls,
1664 const struct PeerPutMessage *put) 1670 const struct PeerPutMessage *put)
1665{ 1671{
1666 uint16_t msize = ntohs (put->header.size); 1672 uint16_t msize = ntohs (put->header.size);
1667 uint32_t putlen = ntohl (put->put_path_length); 1673 uint16_t putlen = ntohs (put->put_path_length);
1668 1674
1669 (void) cls; 1675 (void) cls;
1670 if ( (msize < 1676 if ( (msize <
@@ -1694,7 +1700,7 @@ handle_dht_p2p_put (void *cls,
1694 struct PeerInfo *peer = t->pi; 1700 struct PeerInfo *peer = t->pi;
1695 uint16_t msize = ntohs (put->header.size); 1701 uint16_t msize = ntohs (put->header.size);
1696 enum GNUNET_DHT_RouteOption options 1702 enum GNUNET_DHT_RouteOption options
1697 = (enum GNUNET_DHT_RouteOption) ntohl (put->options); 1703 = (enum GNUNET_DHT_RouteOption) ntohs (put->options);
1698 struct GDS_DATACACHE_BlockData bd = { 1704 struct GDS_DATACACHE_BlockData bd = {
1699 .key = put->key, 1705 .key = put->key,
1700 .expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time), 1706 .expiration_time = GNUNET_TIME_absolute_ntoh (put->expiration_time),
@@ -1702,16 +1708,18 @@ handle_dht_p2p_put (void *cls,
1702 }; 1708 };
1703 const struct GNUNET_DHT_PathElement *put_path 1709 const struct GNUNET_DHT_PathElement *put_path
1704 = (const struct GNUNET_DHT_PathElement *) &put[1]; 1710 = (const struct GNUNET_DHT_PathElement *) &put[1];
1705 uint32_t putlen 1711 uint16_t putlen
1706 = ntohl (put->put_path_length); 1712 = ntohs (put->put_path_length);
1707 1713
1708 bd.data_size = msize - (sizeof(*put) 1714 bd.data_size = msize - (sizeof(*put)
1709 + putlen * sizeof(struct GNUNET_DHT_PathElement)); 1715 + putlen * sizeof(struct GNUNET_DHT_PathElement));
1710 bd.data = &put_path[putlen]; 1716 bd.data = &put_path[putlen];
1711 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1712 "PUT for `%s' from %s\n", 1718 "PUT for `%s' from %s with RO (%s/%s)\n",
1713 GNUNET_h2s (&put->key), 1719 GNUNET_h2s (&put->key),
1714 GNUNET_i2s (&peer->id)); 1720 GNUNET_i2s (&peer->id),
1721 (options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-",
1722 (options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-");
1715 if (GNUNET_TIME_absolute_is_past (bd.expiration_time)) 1723 if (GNUNET_TIME_absolute_is_past (bd.expiration_time))
1716 { 1724 {
1717 GNUNET_STATISTICS_update (GDS_stats, 1725 GNUNET_STATISTICS_update (GDS_stats,
@@ -1782,6 +1790,14 @@ handle_dht_p2p_put (void *cls,
1782 bd.put_path_length = putlen + 1; 1790 bd.put_path_length = putlen + 1;
1783 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE)) 1791 if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
1784 { 1792 {
1793 GNUNET_memcpy (pp,
1794 put_path,
1795 putlen * sizeof(struct GNUNET_DHT_PathElement));
1796 pp[putlen].pred = peer->id;
1797 /* zero-out signature, not valid until we actually do forward! */
1798 memset (&pp[putlen].sig,
1799 0,
1800 sizeof (pp[putlen].sig));
1785#if SANITY_CHECKS 1801#if SANITY_CHECKS
1786 for (unsigned int i = 0; i <= putlen; i++) 1802 for (unsigned int i = 0; i <= putlen; i++)
1787 { 1803 {
@@ -1809,15 +1825,6 @@ handle_dht_p2p_put (void *cls,
1809 putlen = 0; 1825 putlen = 0;
1810 } 1826 }
1811#endif 1827#endif
1812 GNUNET_memcpy (pp,
1813 put_path,
1814 putlen * sizeof(struct GNUNET_DHT_PathElement));
1815 pp[putlen].pred = peer->id;
1816 /* zero-out signature, not valid until we actually do forward! */
1817 memset (&pp[putlen].sig,
1818 0,
1819 sizeof (pp[putlen].sig));
1820 putlen++;
1821 } 1828 }
1822 else 1829 else
1823 { 1830 {
@@ -1841,8 +1848,8 @@ handle_dht_p2p_put (void *cls,
1841 forwarded 1848 forwarded
1842 = GDS_NEIGHBOURS_handle_put (&bd, 1849 = GDS_NEIGHBOURS_handle_put (&bd,
1843 options, 1850 options,
1844 ntohl (put->desired_replication_level), 1851 ntohs (put->desired_replication_level),
1845 ntohl (put->hop_count), 1852 ntohs (put->hop_count),
1846 bf); 1853 bf);
1847 /* notify monitoring clients */ 1854 /* notify monitoring clients */
1848 GDS_CLIENTS_process_put (options 1855 GDS_CLIENTS_process_put (options
@@ -1850,8 +1857,8 @@ handle_dht_p2p_put (void *cls,
1850 ? GNUNET_DHT_RO_LAST_HOP 1857 ? GNUNET_DHT_RO_LAST_HOP
1851 : 0), 1858 : 0),
1852 &bd, 1859 &bd,
1853 ntohl (put->hop_count), 1860 ntohs (put->hop_count),
1854 ntohl (put->desired_replication_level)); 1861 ntohs (put->desired_replication_level));
1855 } 1862 }
1856 GNUNET_CONTAINER_bloomfilter_free (bf); 1863 GNUNET_CONTAINER_bloomfilter_free (bf);
1857 } 1864 }
@@ -2033,10 +2040,10 @@ handle_dht_p2p_get (void *cls,
2033 struct PeerInfo *peer = t->pi; 2040 struct PeerInfo *peer = t->pi;
2034 uint16_t msize = ntohs (get->header.size); 2041 uint16_t msize = ntohs (get->header.size);
2035 uint32_t xquery_size = ntohl (get->xquery_size); 2042 uint32_t xquery_size = ntohl (get->xquery_size);
2036 uint32_t hop_count = ntohl (get->hop_count); 2043 uint32_t hop_count = ntohs (get->hop_count);
2037 size_t reply_bf_size = msize - (sizeof(*get) + xquery_size); 2044 size_t reply_bf_size = msize - (sizeof(*get) + xquery_size);
2038 enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type); 2045 enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type);
2039 enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohl ( 2046 enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohs (
2040 get->options); 2047 get->options);
2041 enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE; 2048 enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE;
2042 const void *xquery = (const void *) &get[1]; 2049 const void *xquery = (const void *) &get[1];
@@ -2146,7 +2153,7 @@ handle_dht_p2p_get (void *cls,
2146 /* P2P forwarding */ 2153 /* P2P forwarding */
2147 { 2154 {
2148 bool forwarded = false; 2155 bool forwarded = false;
2149 uint32_t desired_replication_level = ntohl ( 2156 uint16_t desired_replication_level = ntohs (
2150 get->desired_replication_level); 2157 get->desired_replication_level);
2151 2158
2152 if (eval != GNUNET_BLOCK_REPLY_OK_LAST) 2159 if (eval != GNUNET_BLOCK_REPLY_OK_LAST)
@@ -2235,8 +2242,8 @@ static enum GNUNET_GenericReturnValue
2235check_dht_p2p_result (void *cls, 2242check_dht_p2p_result (void *cls,
2236 const struct PeerResultMessage *prm) 2243 const struct PeerResultMessage *prm)
2237{ 2244{
2238 uint32_t get_path_length = ntohl (prm->get_path_length); 2245 uint16_t get_path_length = ntohs (prm->get_path_length);
2239 uint32_t put_path_length = ntohl (prm->put_path_length); 2246 uint16_t put_path_length = ntohs (prm->put_path_length);
2240 uint16_t msize = ntohs (prm->header.size); 2247 uint16_t msize = ntohs (prm->header.size);
2241 2248
2242 (void) cls; 2249 (void) cls;
@@ -2326,11 +2333,11 @@ handle_dht_p2p_result (void *cls,
2326 struct Target *t = cls; 2333 struct Target *t = cls;
2327 struct PeerInfo *peer = t->pi; 2334 struct PeerInfo *peer = t->pi;
2328 uint16_t msize = ntohs (prm->header.size); 2335 uint16_t msize = ntohs (prm->header.size);
2329 uint32_t get_path_length = ntohl (prm->get_path_length); 2336 uint16_t get_path_length = ntohs (prm->get_path_length);
2330 struct GDS_DATACACHE_BlockData bd = { 2337 struct GDS_DATACACHE_BlockData bd = {
2331 .expiration_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time), 2338 .expiration_time = GNUNET_TIME_absolute_ntoh (prm->expiration_time),
2332 .put_path = (const struct GNUNET_DHT_PathElement *) &prm[1], 2339 .put_path = (const struct GNUNET_DHT_PathElement *) &prm[1],
2333 .put_path_length = ntohl (prm->put_path_length), 2340 .put_path_length = ntohs (prm->put_path_length),
2334 .type = ntohl (prm->type) 2341 .type = ntohl (prm->type)
2335 }; 2342 };
2336 const struct GNUNET_DHT_PathElement *get_path 2343 const struct GNUNET_DHT_PathElement *get_path
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index 5c327e019..fdaf655bd 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -63,8 +63,8 @@ GDS_NEIGHBOURS_lookup_peer (const struct GNUNET_PeerIdentity *target);
63enum GNUNET_GenericReturnValue 63enum GNUNET_GenericReturnValue
64GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd, 64GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
65 enum GNUNET_DHT_RouteOption options, 65 enum GNUNET_DHT_RouteOption options,
66 uint32_t desired_replication_level, 66 uint16_t desired_replication_level,
67 uint32_t hop_count, 67 uint16_t hop_count,
68 struct GNUNET_CONTAINER_BloomFilter *bf); 68 struct GNUNET_CONTAINER_BloomFilter *bf);
69 69
70 70
@@ -88,8 +88,8 @@ GDS_NEIGHBOURS_handle_put (const struct GDS_DATACACHE_BlockData *bd,
88enum GNUNET_GenericReturnValue 88enum GNUNET_GenericReturnValue
89GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type, 89GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
90 enum GNUNET_DHT_RouteOption options, 90 enum GNUNET_DHT_RouteOption options,
91 uint32_t desired_replication_level, 91 uint16_t desired_replication_level,
92 uint32_t hop_count, 92 uint16_t hop_count,
93 const struct GNUNET_HashCode *key, 93 const struct GNUNET_HashCode *key,
94 const void *xquery, 94 const void *xquery,
95 size_t xquery_size, 95 size_t xquery_size,