diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-10-27 11:33:59 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-10-27 11:34:39 +0200 |
commit | 2b86b51b1cb535f75882ca70ee884adca8e6949c (patch) | |
tree | a370a1b09d0647f09653c74d46915e85013d8f02 /src | |
parent | 616a9f9c000e9e80f2de059cce1caf6d0997329f (diff) | |
download | gnunet-2b86b51b1cb535f75882ca70ee884adca8e6949c.tar.gz gnunet-2b86b51b1cb535f75882ca70ee884adca8e6949c.zip |
disallow ANY for block type in PUTs; do return HELLOs for ANY in GET requests (see recent clarifications to R5N specification)
Diffstat (limited to 'src')
-rw-r--r-- | src/dht/gnunet-service-dht_neighbours.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 9d1dff8a6..61d0398ff 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c | |||
@@ -111,7 +111,7 @@ struct PeerPutMessage | |||
111 | struct GNUNET_MessageHeader header; | 111 | struct GNUNET_MessageHeader header; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Content type. | 114 | * Content type, must not be zero. |
115 | */ | 115 | */ |
116 | uint32_t type GNUNET_PACKED; | 116 | uint32_t type GNUNET_PACKED; |
117 | 117 | ||
@@ -1924,6 +1924,11 @@ check_dht_p2p_put (void *cls, | |||
1924 | GNUNET_break_op (0); | 1924 | GNUNET_break_op (0); |
1925 | return GNUNET_SYSERR; | 1925 | return GNUNET_SYSERR; |
1926 | } | 1926 | } |
1927 | if (GNUNET_BLOCK_TYPE_ANY == htonl (put->type)) | ||
1928 | { | ||
1929 | GNUNET_break_op (0); | ||
1930 | return GNUNET_SYSERR; | ||
1931 | } | ||
1927 | return GNUNET_OK; | 1932 | return GNUNET_OK; |
1928 | } | 1933 | } |
1929 | 1934 | ||
@@ -2357,7 +2362,8 @@ handle_dht_p2p_get (void *cls, | |||
2357 | (GDS_am_closest_peer (&get->key, | 2362 | (GDS_am_closest_peer (&get->key, |
2358 | peer_bf)) ) | 2363 | peer_bf)) ) |
2359 | { | 2364 | { |
2360 | if (GNUNET_BLOCK_TYPE_DHT_URL_HELLO == type) | 2365 | if ( (GNUNET_BLOCK_TYPE_DHT_URL_HELLO == type) || |
2366 | (GNUNET_BLOCK_TYPE_ANY == type) ) | ||
2361 | { | 2367 | { |
2362 | GNUNET_STATISTICS_update (GDS_stats, | 2368 | GNUNET_STATISTICS_update (GDS_stats, |
2363 | "# P2P HELLO lookup requests processed", | 2369 | "# P2P HELLO lookup requests processed", |
@@ -2481,7 +2487,8 @@ process_reply_with_path (const struct GNUNET_DATACACHE_Block *bd, | |||
2481 | if (NULL != bd->put_path) | 2487 | if (NULL != bd->put_path) |
2482 | GNUNET_memcpy (xput_path, | 2488 | GNUNET_memcpy (xput_path, |
2483 | bd->put_path, | 2489 | bd->put_path, |
2484 | bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); | 2490 | bd->put_path_length * sizeof(struct |
2491 | GNUNET_DHT_PathElement)); | ||
2485 | GNUNET_memcpy (&xput_path[bd->put_path_length], | 2492 | GNUNET_memcpy (&xput_path[bd->put_path_length], |
2486 | get_path, | 2493 | get_path, |
2487 | get_path_length * sizeof(struct GNUNET_DHT_PathElement)); | 2494 | get_path_length * sizeof(struct GNUNET_DHT_PathElement)); |