[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: protocol change: swap xquery and result
From: |
gnunet |
Subject: |
[gnunet] branch master updated: protocol change: swap xquery and result filter, integrate mutator with result filter |
Date: |
Tue, 31 May 2022 23:43:09 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new edddc9384 protocol change: swap xquery and result filter, integrate
mutator with result filter
edddc9384 is described below
commit edddc9384e9bc4331d57291de7318bbe401e49b0
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue May 31 23:43:05 2022 +0200
protocol change: swap xquery and result filter, integrate mutator with
result filter
---
src/block/bg_bf.c | 34 ++++++---
src/block/block.c | 6 +-
src/block/plugin_block_template.c | 25 +++----
src/block/plugin_block_test.c | 3 -
src/dht/gnunet-service-dht_clients.c | 3 -
src/dht/gnunet-service-dht_neighbours.c | 96 +++++++++++--------------
src/dht/plugin_block_dht.c | 3 -
src/dns/plugin_block_dns.c | 37 +++++-----
src/fs/gnunet-service-fs.c | 2 +-
src/fs/gnunet-service-fs.h | 8 +--
src/fs/gnunet-service-fs_cp.c | 1 -
src/fs/gnunet-service-fs_pr.c | 10 +--
src/fs/gnunet-service-fs_pr.h | 2 -
src/fs/plugin_block_fs.c | 11 +--
src/gns/plugin_block_gns.c | 4 --
src/include/gnunet_block_group_lib.h | 2 -
src/include/gnunet_block_lib.h | 3 -
src/include/gnunet_block_plugin.h | 21 +++---
src/regex/plugin_block_regex.c | 121 ++++++++++++++++----------------
19 files changed, 172 insertions(+), 220 deletions(-)
diff --git a/src/block/bg_bf.c b/src/block/bg_bf.c
index 601f605a2..520d750aa 100644
--- a/src/block/bg_bf.c
+++ b/src/block/bg_bf.c
@@ -55,7 +55,6 @@ struct BfGroupInternals
* Serialize state of a block group.
*
* @param bg group to serialize
- * @param[out] nonce set to the nonce of the @a bg
* @param[out] raw_data set to the serialized state
* @param[out] raw_data_size set to the number of bytes in @a raw_data
* @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -63,24 +62,25 @@ struct BfGroupInternals
*/
static enum GNUNET_GenericReturnValue
bf_group_serialize_cb (struct GNUNET_BLOCK_Group *bg,
- uint32_t *nonce,
void **raw_data,
size_t *raw_data_size)
{
struct BfGroupInternals *gi = bg->internal_cls;
- char *raw;
+ void *raw;
- raw = GNUNET_malloc (gi->bf_size);
+ raw = GNUNET_malloc (gi->bf_size + sizeof (uint32_t));
if (GNUNET_OK !=
GNUNET_CONTAINER_bloomfilter_get_raw_data (gi->bf,
- raw,
+ raw + sizeof (uint32_t),
gi->bf_size))
{
GNUNET_free (raw);
GNUNET_break (0);
return GNUNET_SYSERR;
}
- *nonce = gi->bf_mutator;
+ memcpy (raw,
+ &gi->bf_mutator,
+ sizeof (uint32_t));
*raw_data = raw;
*raw_data_size = gi->bf_size;
return GNUNET_OK;
@@ -164,7 +164,6 @@ bf_group_destroy_cb (struct GNUNET_BLOCK_Group *bg)
* @param bf_size size of the Bloom filter
* @param bf_k K-value for the Bloom filter
* @param type block type
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @return block group handle, NULL if block groups are not supported
@@ -175,13 +174,32 @@ GNUNET_BLOCK_GROUP_bf_create (void *cls,
size_t bf_size,
unsigned int bf_k,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size)
{
struct BfGroupInternals *gi;
struct GNUNET_BLOCK_Group *bg;
+ uint32_t nonce;
+ if ( (NULL != raw_data) &&
+ (raw_data_size < sizeof (nonce)) )
+ {
+ GNUNET_break_op (0);
+ return NULL;
+ }
+ if (NULL != raw_data)
+ {
+ memcpy (&nonce,
+ raw_data,
+ sizeof (nonce));
+ raw_data += sizeof (nonce);
+ raw_data_size -= sizeof (nonce);
+ }
+ else
+ {
+ nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
+ UINT32_MAX);
+ }
gi = GNUNET_new (struct BfGroupInternals);
gi->bf = GNUNET_CONTAINER_bloomfilter_init ((bf_size != raw_data_size) ?
NULL : raw_data,
diff --git a/src/block/block.c b/src/block/block.c
index 98095b51c..4b2d8a960 100644
--- a/src/block/block.c
+++ b/src/block/block.c
@@ -91,6 +91,7 @@ struct MinglePacker
GNUNET_NETWORK_STRUCT_END
+
void
GNUNET_BLOCK_mingle_hash (const struct GNUNET_HashCode *in,
uint32_t mingle_number,
@@ -172,11 +173,9 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context
*ctx)
enum GNUNET_GenericReturnValue
GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
- uint32_t *nonce,
void **raw_data,
size_t *raw_data_size)
{
- *nonce = 0;
*raw_data = NULL;
*raw_data_size = 0;
if (NULL == bg)
@@ -184,7 +183,6 @@ GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
if (NULL == bg->serialize_cb)
return GNUNET_NO;
return bg->serialize_cb (bg,
- nonce,
raw_data,
raw_data_size);
}
@@ -248,7 +246,6 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx,
struct GNUNET_BLOCK_Group *
GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
...)
@@ -267,7 +264,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
raw_data_size);
bg = plugin->create_group (plugin->cls,
type,
- nonce,
raw_data,
raw_data_size,
ap);
diff --git a/src/block/plugin_block_template.c
b/src/block/plugin_block_template.c
index dcaf1afaa..46a370924 100644
--- a/src/block/plugin_block_template.c
+++ b/src/block/plugin_block_template.c
@@ -48,7 +48,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -58,7 +57,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_template_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -85,7 +83,6 @@ block_plugin_template_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
@@ -124,9 +121,9 @@ block_plugin_template_check_query (void *cls,
*/
static enum GNUNET_GenericReturnValue
block_plugin_template_check_block (void *cls,
- enum GNUNET_BLOCK_Type type,
- const void *block,
- size_t block_size)
+ enum GNUNET_BLOCK_Type type,
+ const void *block,
+ size_t block_size)
{
return GNUNET_SYSERR;
}
@@ -150,14 +147,14 @@ block_plugin_template_check_block (void *cls,
*/
static enum GNUNET_BLOCK_ReplyEvaluationResult
block_plugin_template_check_reply (
- void *cls,
- enum GNUNET_BLOCK_Type type,
- struct GNUNET_BLOCK_Group *group,
- const struct GNUNET_HashCode *query,
- const void *xquery,
- size_t xquery_size,
- const void *reply_block,
- size_t reply_block_size)
+ void *cls,
+ enum GNUNET_BLOCK_Type type,
+ struct GNUNET_BLOCK_Group *group,
+ const struct GNUNET_HashCode *query,
+ const void *xquery,
+ size_t xquery_size,
+ const void *reply_block,
+ size_t reply_block_size)
{
return GNUNET_BLOCK_REPLY_TYPE_NOT_SUPPORTED;
}
diff --git a/src/block/plugin_block_test.c b/src/block/plugin_block_test.c
index 05d379387..2e404bbc2 100644
--- a/src/block/plugin_block_test.c
+++ b/src/block/plugin_block_test.c
@@ -46,7 +46,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_test_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -83,7 +81,6 @@ block_plugin_test_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
diff --git a/src/dht/gnunet-service-dht_clients.c
b/src/dht/gnunet-service-dht_clients.c
index 6a4f58d1f..fd65102b3 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -381,9 +381,6 @@ transmit_request (struct ClientQueryRecord *cqr)
GNUNET_NO);
bg = GNUNET_BLOCK_group_create (GDS_block_context,
cqr->type,
- GNUNET_CRYPTO_random_u32 (
- GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX),
NULL, /* raw data */
0, /* raw data size */
"seen-set-size",
diff --git a/src/dht/gnunet-service-dht_neighbours.c
b/src/dht/gnunet-service-dht_neighbours.c
index 2f9cbab84..9a3abc376 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -39,15 +39,15 @@
__VA_ARGS__)
/**
- * Enable slow sanity checks to debug issues.
- *
+ * Enable slow sanity checks to debug issues.
+ *
* TODO: might want to eventually implement probabilistic
* load-based path verification, but for now it is all or nothing
* based on this define.
*
* 0: do not check -- if signatures become performance critical
* 1: check all external inputs -- normal production for now
- * 2: check internal computations as well -- for debugging
+ * 2: check internal computations as well -- for debugging
*/
#define SANITY_CHECKS 2
@@ -235,9 +235,9 @@ struct PeerGetMessage
uint16_t desired_replication_level GNUNET_PACKED;
/**
- * Size of the extended query.
+ * Size of the result filter.
*/
- uint16_t xquery_size;
+ uint16_t result_filter_size GNUNET_PACKED;
/**
* Bloomfilter (for peer identities) to stop circular routes
@@ -249,14 +249,10 @@ struct PeerGetMessage
*/
struct GNUNET_HashCode key;
- /**
- * Bloomfilter mutator.
- */
- uint32_t bf_mutator;
+ /* result bloomfilter */
/* xquery */
- /* result bloomfilter */
};
GNUNET_NETWORK_STRUCT_END
@@ -654,9 +650,6 @@ send_find_peer_message (void *cls)
bg = GNUNET_BLOCK_group_create (GDS_block_context,
GNUNET_BLOCK_TYPE_DHT_URL_HELLO,
- GNUNET_CRYPTO_random_u32 (
- GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX),
NULL,
0,
"filter-size",
@@ -1287,9 +1280,9 @@ get_target_peers (const struct GNUNET_HashCode *key,
/**
- * If we got a HELLO, consider it for our own routing table
+ * If we got a HELLO, consider it for our own routing table
*
- * @param bd block data we got
+ * @param bd block data we got
*/
static void
hello_check (const struct GDS_DATACACHE_BlockData *bd)
@@ -1345,7 +1338,7 @@ GDS_NEIGHBOURS_handle_put (const struct
GDS_DATACACHE_BlockData *bd,
GNUNET_h2s (&bd->key),
(options & GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE) ? "x" : "-",
(options & GNUNET_DHT_RO_RECORD_ROUTE) ? "R" : "-");
-
+
/* if we got a HELLO, consider it for our own routing table */
hello_check (bd);
GNUNET_CONTAINER_bloomfilter_add (bf,
@@ -1464,10 +1457,9 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
unsigned int target_count;
struct PeerInfo **targets;
size_t msize;
- size_t reply_bf_size;
- void *reply_bf;
+ size_t result_filter_size;
+ void *result_filter;
unsigned int skip_count;
- uint32_t bf_nonce;
GNUNET_assert (NULL != peer_bf);
GNUNET_STATISTICS_update (GDS_stats,
@@ -1499,20 +1491,17 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
}
if (GNUNET_OK !=
GNUNET_BLOCK_group_serialize (bg,
- &bf_nonce,
- &reply_bf,
- &reply_bf_size))
+ &result_filter,
+ &result_filter_size))
{
- reply_bf = NULL;
- reply_bf_size = 0;
- bf_nonce = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX);
+ result_filter = NULL;
+ result_filter_size = 0;
}
- msize = xquery_size + reply_bf_size;
+ msize = xquery_size + result_filter_size;
if (msize + sizeof(struct PeerGetMessage) >= GNUNET_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
- GNUNET_free (reply_bf);
+ GNUNET_free (result_filter);
GNUNET_free (targets);
return GNUNET_NO;
}
@@ -1523,7 +1512,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
struct PeerInfo *target = targets[i];
struct PeerGetMessage *pgm;
char buf[sizeof (*pgm) + msize] GNUNET_ALIGN;
- char *xq;
+ char *rf;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Routing GET for %s after %u hops to %s\n",
@@ -1537,8 +1526,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
pgm->options = htons (options);
pgm->hop_count = htons (hop_count + 1);
pgm->desired_replication_level = htons (desired_replication_level);
- pgm->xquery_size = htonl (xquery_size);
- pgm->bf_mutator = bf_nonce;
+ pgm->result_filter_size = htonl (result_filter_size);
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_bloomfilter_test (peer_bf,
&target->phash));
@@ -1547,13 +1535,13 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
pgm->bloomfilter,
DHT_BLOOM_SIZE));
pgm->key = *key;
- xq = (char *) &pgm[1];
- GNUNET_memcpy (xq,
+ rf = (char *) &pgm[1];
+ GNUNET_memcpy (rf,
+ result_filter,
+ result_filter_size);
+ GNUNET_memcpy (&rf[result_filter_size],
xquery,
xquery_size);
- GNUNET_memcpy (&xq[xquery_size],
- reply_bf,
- reply_bf_size);
do_send (target,
&pgm->header);
}
@@ -1562,7 +1550,7 @@ GDS_NEIGHBOURS_handle_get (enum GNUNET_BLOCK_Type type,
target_count - skip_count,
GNUNET_NO);
GNUNET_free (targets);
- GNUNET_free (reply_bf);
+ GNUNET_free (result_filter);
return (skip_count < target_count) ? GNUNET_OK : GNUNET_NO;
}
@@ -1852,7 +1840,7 @@ handle_dht_p2p_put (void *cls,
if (0 != (options & GNUNET_DHT_RO_RECORD_ROUTE))
{
unsigned int failure_offset;
-
+
GNUNET_memcpy (pp,
put_path,
putlen * sizeof(struct GNUNET_DHT_PathElement));
@@ -1861,10 +1849,10 @@ handle_dht_p2p_put (void *cls,
memset (&pp[putlen].sig,
0,
sizeof (pp[putlen].sig));
-#if SANITY_CHECKS
- /* TODO: might want to eventually implement probabilistic
- load-based path verification, but for now it is all or nothing */
- failure_offset
+#if SANITY_CHECKS
+ /* TODO: might want to eventually implement probabilistic
+ load-based path verification, but for now it is all or nothing */
+ failure_offset
= GNUNET_DHT_verify_path (bd.data,
bd.data_size,
bd.expiration_time,
@@ -1883,7 +1871,7 @@ handle_dht_p2p_put (void *cls,
GNUNET_assert (failure_offset <= putlen);
bd.put_path = &pp[failure_offset];
bd.put_path_length = putlen - failure_offset;
- }
+ }
}
else
{
@@ -2073,10 +2061,10 @@ check_dht_p2p_get (void *cls,
const struct PeerGetMessage *get)
{
uint16_t msize = ntohs (get->header.size);
- uint32_t xquery_size = ntohl (get->xquery_size);
+ uint32_t result_filter_size = ntohl (get->result_filter_size);
(void) cls;
- if (msize < sizeof(*get) + xquery_size)
+ if (msize < sizeof(*get) + result_filter_size)
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -2098,14 +2086,15 @@ handle_dht_p2p_get (void *cls,
struct Target *t = cls;
struct PeerInfo *peer = t->pi;
uint16_t msize = ntohs (get->header.size);
- uint32_t xquery_size = ntohl (get->xquery_size);
+ uint32_t result_filter_size = ntohl (get->result_filter_size);
uint32_t hop_count = ntohs (get->hop_count);
- size_t reply_bf_size = msize - (sizeof(*get) + xquery_size);
enum GNUNET_BLOCK_Type type = (enum GNUNET_BLOCK_Type) ntohl (get->type);
enum GNUNET_DHT_RouteOption options = (enum GNUNET_DHT_RouteOption) ntohs (
get->options);
enum GNUNET_BLOCK_ReplyEvaluationResult eval = GNUNET_BLOCK_REPLY_OK_MORE;
- const void *xquery = (const void *) &get[1];
+ const void *result_filter = (const void *) &get[1];
+ const void *xquery = result_filter + result_filter_size;
+ size_t xquery_size = msize - sizeof (*get) - result_filter_size;
/* parse and validate message */
GNUNET_STATISTICS_update (GDS_stats,
@@ -2140,11 +2129,10 @@ handle_dht_p2p_get (void *cls,
&peer->phash));
bg = GNUNET_BLOCK_group_create (GDS_block_context,
type,
- get->bf_mutator,
- xquery + xquery_size,
- reply_bf_size,
+ result_filter,
+ result_filter_size,
"filter-size",
- reply_bf_size,
+ result_filter_size,
NULL);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"GET for %s at %s after %u hops\n",
@@ -2353,7 +2341,7 @@ handle_dht_p2p_result (void *cls,
};
const struct GNUNET_DHT_PathElement *get_path
= &bd.put_path[bd.put_path_length];
-
+
/* parse and validate message */
if (GNUNET_TIME_absolute_is_past (bd.expiration_time))
{
@@ -2416,7 +2404,7 @@ handle_dht_p2p_result (void *cls,
#if SANITY_CHECKS
/* TODO: might want to eventually implement probabilistic
load-based path verification, but for now it is all or nothing */
- failure_offset
+ failure_offset
= GNUNET_DHT_verify_path (bd.data,
bd.data_size,
bd.expiration_time,
diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c
index 3dd3dd792..bee16736c 100644
--- a/src/dht/plugin_block_dht.c
+++ b/src/dht/plugin_block_dht.c
@@ -46,7 +46,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_dht_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -83,7 +81,6 @@ block_plugin_dht_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c
index a596beb28..0531a8a5f 100644
--- a/src/dns/plugin_block_dns.c
+++ b/src/dns/plugin_block_dns.c
@@ -46,7 +46,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -56,7 +55,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_dns_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -83,7 +81,6 @@ block_plugin_dns_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
@@ -102,19 +99,19 @@ block_plugin_dns_create_group (void *cls,
*/
static enum GNUNET_GenericReturnValue
block_plugin_dns_check_query (void *cls,
- enum GNUNET_BLOCK_Type type,
- const struct GNUNET_HashCode *query,
- const void *xquery,
- size_t xquery_size)
+ enum GNUNET_BLOCK_Type type,
+ const struct GNUNET_HashCode *query,
+ const void *xquery,
+ size_t xquery_size)
{
switch (type)
{
case GNUNET_BLOCK_TYPE_DNS:
if (0 != xquery_size)
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
+ {
+ GNUNET_break_op (0);
+ return GNUNET_NO;
+ }
return GNUNET_OK;
default:
GNUNET_break (0);
@@ -158,7 +155,7 @@ block_plugin_dns_check_block (void *cls,
return GNUNET_NO;
}
if (GNUNET_TIME_absolute_is_past (
- GNUNET_TIME_absolute_ntoh (ad->expiration_time)))
+ GNUNET_TIME_absolute_ntoh (ad->expiration_time)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"DNS advertisement has expired\n");
@@ -199,14 +196,14 @@ block_plugin_dns_check_block (void *cls,
*/
static enum GNUNET_BLOCK_ReplyEvaluationResult
block_plugin_dns_check_reply (
- void *cls,
- enum GNUNET_BLOCK_Type type,
- struct GNUNET_BLOCK_Group *group,
- const struct GNUNET_HashCode *query,
- const void *xquery,
- size_t xquery_size,
- const void *reply_block,
- size_t reply_block_size)
+ void *cls,
+ enum GNUNET_BLOCK_Type type,
+ struct GNUNET_BLOCK_Group *group,
+ const struct GNUNET_HashCode *query,
+ const void *xquery,
+ size_t xquery_size,
+ const void *reply_block,
+ size_t reply_block_size)
{
struct GNUNET_HashCode phash;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 8c6c39885..05c7e2192 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -893,7 +893,7 @@ handle_client_start_search (void *cls,
&all_zeros,
sizeof(struct
GNUNET_PeerIdentity)))
- ? &sm->target : NULL, NULL, 0,
+ ? &sm->target : NULL, NULL,
0 /* bf */,
ntohl (sm->anonymity_level),
0 /* priority */,
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h
index a6b73db09..56d102673 100644
--- a/src/fs/gnunet-service-fs.h
+++ b/src/fs/gnunet-service-fs.h
@@ -103,13 +103,9 @@ struct GetMessage
int32_t ttl GNUNET_PACKED;
/**
- * The content hash should be mutated using this value
- * before checking against the bloomfilter (used to
- * get many different filters for the same hash codes).
- * The number should be in big-endian format when used
- * for mingling.
+ * These days not used.
*/
- uint32_t filter_mutator GNUNET_PACKED;
+ uint32_t reserved GNUNET_PACKED;
/**
* Which of the optional hash codes are present at the end of the
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 5476aa2be..30b895752 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -1317,7 +1317,6 @@ handle_p2p_get (void *cls,
? (const char *) &opt[bits]
: NULL,
bfsize,
- ntohl (gm->filter_mutator),
1 /* anonymity */,
(uint32_t) tec.priority,
tec.ttl,
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 154c454ca..f05194907 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -260,9 +260,6 @@ refresh_bloomfilter (enum GNUNET_BLOCK_Type type,
pr->bg =
GNUNET_BLOCK_group_create (GSF_block_ctx,
type,
- GNUNET_CRYPTO_random_u32 (
- GNUNET_CRYPTO_QUALITY_WEAK,
- UINT32_MAX),
NULL,
0,
"seen-set-size",
@@ -286,7 +283,6 @@ refresh_bloomfilter (enum GNUNET_BLOCK_Type type,
* @param target preferred target for the request, NULL for none
* @param bf_data raw data for bloom filter for known replies, can be NULL
* @param bf_size number of bytes in @a bf_data
- * @param mingle mingle value for bf
* @param anonymity_level desired anonymity level
* @param priority maximum outgoing cumulative request priority to use
* @param ttl current time-to-live for the request
@@ -305,7 +301,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions
options,
const struct GNUNET_PeerIdentity *target,
const char *bf_data,
size_t bf_size,
- uint32_t mingle,
uint32_t anonymity_level,
uint32_t priority,
int32_t ttl,
@@ -376,7 +371,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions
options,
{
pr->bg = GNUNET_BLOCK_group_create (GSF_block_ctx,
pr->public_data.type,
- mingle,
bf_data,
bf_size,
"seen-set-size",
@@ -533,7 +527,6 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest
*pr)
int64_t ttl;
int do_route;
void *bf_data;
- uint32_t bf_nonce;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Building request message for `%s' of type %d\n",
@@ -559,7 +552,6 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest
*pr)
}
if (GNUNET_OK !=
GNUNET_BLOCK_group_serialize (pr->bg,
- &bf_nonce,
&bf_data,
&bf_size))
{
@@ -582,7 +574,7 @@ GSF_pending_request_get_message_ (struct GSF_PendingRequest
*pr)
now = GNUNET_TIME_absolute_get ();
ttl = (int64_t) (pr->public_data.ttl.abs_value_us - now.abs_value_us);
gm->ttl = htonl (ttl / 1000LL / 1000LL);
- gm->filter_mutator = htonl (bf_nonce);
+ gm->reserved = htonl (0);
gm->hash_bitmap = htonl (bm);
gm->query = pr->public_data.query;
ext = (struct GNUNET_PeerIdentity *) &gm[1];
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h
index a10fb9b4c..339e409c5 100644
--- a/src/fs/gnunet-service-fs_pr.h
+++ b/src/fs/gnunet-service-fs_pr.h
@@ -206,7 +206,6 @@ typedef void
* @param target preferred target for the request, NULL for none
* @param bf_data raw data for bloom filter for known replies, can be NULL
* @param bf_size number of bytes in bf_data
- * @param mingle mingle value for bf
* @param anonymity_level desired anonymity level
* @param priority maximum outgoing cumulative request priority to use
* @param ttl current time-to-live for the request
@@ -226,7 +225,6 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions
options,
const struct GNUNET_PeerIdentity *target,
const char *bf_data,
size_t bf_size,
- uint32_t mingle,
uint32_t anonymity_level,
uint32_t priority,
int32_t ttl,
diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c
index 029f95bc5..18aa289ef 100644
--- a/src/fs/plugin_block_fs.c
+++ b/src/fs/plugin_block_fs.c
@@ -43,7 +43,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -53,7 +52,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_fs_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -66,11 +64,9 @@ block_plugin_fs_create_group (void *cls,
case GNUNET_BLOCK_TYPE_FS_DBLOCK:
GNUNET_break (NULL == va_arg (va, const char *));
return NULL;
-
case GNUNET_BLOCK_TYPE_FS_IBLOCK:
GNUNET_break (NULL == va_arg (va, const char *));
return NULL;
-
case GNUNET_BLOCK_TYPE_FS_UBLOCK:
guard = va_arg (va, const char *);
if (0 == strcmp (guard,
@@ -98,7 +94,6 @@ block_plugin_fs_create_group (void *cls,
size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
@@ -218,7 +213,7 @@ block_plugin_fs_check_block (void *cls,
case GNUNET_BLOCK_TYPE_FS_UBLOCK:
{
const struct UBlock *ub;
-
+
if (block_size < sizeof(struct UBlock))
{
GNUNET_break_op (0);
@@ -226,8 +221,8 @@ block_plugin_fs_check_block (void *cls,
}
ub = block;
if (block_size !=
- ntohl (ub->purpose.size) +
- sizeof (struct GNUNET_CRYPTO_EcdsaSignature))
+ ntohl (ub->purpose.size)
+ + sizeof (struct GNUNET_CRYPTO_EcdsaSignature))
{
GNUNET_break_op (0);
return GNUNET_NO;
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index ffca16b6f..a683ecacc 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -48,7 +48,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -58,7 +57,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_gns_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -85,7 +83,6 @@ block_plugin_gns_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
@@ -132,7 +129,6 @@ block_plugin_gns_get_key (void *cls,
}
-
/**
* Function called to validate a query.
*
diff --git a/src/include/gnunet_block_group_lib.h
b/src/include/gnunet_block_group_lib.h
index b03e913c6..d242ceefb 100644
--- a/src/include/gnunet_block_group_lib.h
+++ b/src/include/gnunet_block_group_lib.h
@@ -68,7 +68,6 @@ GNUNET_BLOCK_GROUP_compute_bloomfilter_size (unsigned int
entry_count,
* @param bf_size size of the Bloom filter
* @param bf_k K-value for the Bloom filter
* @param type block type
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @return block group handle, NULL if block groups are not supported
@@ -79,7 +78,6 @@ GNUNET_BLOCK_GROUP_bf_create (void *cls,
size_t bf_size,
unsigned int bf_k,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size);
diff --git a/src/include/gnunet_block_lib.h b/src/include/gnunet_block_lib.h
index fb417412f..af61dcfb0 100644
--- a/src/include/gnunet_block_lib.h
+++ b/src/include/gnunet_block_lib.h
@@ -138,7 +138,6 @@ struct GNUNET_BLOCK_Group;
struct GNUNET_BLOCK_Group *
GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
...);
@@ -148,7 +147,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
* Serialize state of a block group.
*
* @param bg group to serialize
- * @param[out] nonce set to the nonce of the @a bg
* @param[out] raw_data set to the serialized state
* @param[out] raw_data_size set to the number of bytes in @a raw_data
* @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -156,7 +154,6 @@ GNUNET_BLOCK_group_create (struct GNUNET_BLOCK_Context *ctx,
*/
enum GNUNET_GenericReturnValue
GNUNET_BLOCK_group_serialize (struct GNUNET_BLOCK_Group *bg,
- uint32_t *nonce,
void **raw_data,
size_t *raw_data_size);
diff --git a/src/include/gnunet_block_plugin.h
b/src/include/gnunet_block_plugin.h
index 1fa7ccf8b..6f9e8e9dc 100644
--- a/src/include/gnunet_block_plugin.h
+++ b/src/include/gnunet_block_plugin.h
@@ -49,9 +49,9 @@
*/
typedef void
(*GNUNET_BLOCK_GroupMarkSeenFunction)(
- struct GNUNET_BLOCK_Group *bg,
- const struct GNUNET_HashCode
*seen_results,
- unsigned int seen_results_count);
+ struct GNUNET_BLOCK_Group *bg,
+ const struct GNUNET_HashCode *seen_results,
+ unsigned int seen_results_count);
/**
@@ -72,7 +72,6 @@ typedef enum GNUNET_GenericReturnValue
* Serialize state of a block group.
*
* @param bg group to serialize
- * @param[out] nonce set to the nonce of the @a bg
* @param[out] raw_data set to the serialized state
* @param[out] raw_data_size set to the number of bytes in @a raw_data
* @return #GNUNET_OK on success, #GNUNET_NO if serialization is not
@@ -80,7 +79,6 @@ typedef enum GNUNET_GenericReturnValue
*/
typedef enum GNUNET_GenericReturnValue
(*GNUNET_BLOCK_GroupSerializeFunction)(struct GNUNET_BLOCK_Group *bg,
- uint32_t *nonce,
void **raw_data,
size_t *raw_data_size);
@@ -156,7 +154,6 @@ struct GNUNET_BLOCK_Group
typedef struct GNUNET_BLOCK_Group *
(*GNUNET_BLOCK_GroupCreateFunction)(void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va);
@@ -238,11 +235,11 @@ typedef enum GNUNET_BLOCK_ReplyEvaluationResult
* #GNUNET_SYSERR if @a type not supported
*/
typedef enum GNUNET_GenericReturnValue
-(*GNUNET_BLOCK_GetKeyFunction) (void *cls,
- enum GNUNET_BLOCK_Type type,
- const void *block,
- size_t block_size,
- struct GNUNET_HashCode *key);
+(*GNUNET_BLOCK_GetKeyFunction)(void *cls,
+ enum GNUNET_BLOCK_Type type,
+ const void *block,
+ size_t block_size,
+ struct GNUNET_HashCode *key);
/**
@@ -285,7 +282,7 @@ struct GNUNET_BLOCK_PluginFunctions
/**
* Check that a reply block matches a query.
*/
- GNUNET_BLOCK_ReplyEvaluationFunction check_reply;
+ GNUNET_BLOCK_ReplyEvaluationFunction check_reply;
};
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 61442ac10..5f23a32df 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -49,7 +49,6 @@
*
* @param ctx block context in which the block group is created
* @param type type of the block for which we are creating the group
- * @param nonce random value used to seed the group creation
* @param raw_data optional serialized prior state of the group, NULL if
unavailable/fresh
* @param raw_data_size number of bytes in @a raw_data, 0 if unavailable/fresh
* @param va variable arguments specific to @a type
@@ -59,7 +58,6 @@
static struct GNUNET_BLOCK_Group *
block_plugin_regex_create_group (void *cls,
enum GNUNET_BLOCK_Type type,
- uint32_t nonce,
const void *raw_data,
size_t raw_data_size,
va_list va)
@@ -86,7 +84,6 @@ block_plugin_regex_create_group (void *cls,
bf_size,
BLOOMFILTER_K,
type,
- nonce,
raw_data,
raw_data_size);
}
@@ -150,9 +147,9 @@ block_plugin_regex_check_query (void *cls,
*/
static enum GNUNET_GenericReturnValue
block_plugin_regex_check_block (void *cls,
- enum GNUNET_BLOCK_Type type,
- const void *block,
- size_t block_size)
+ enum GNUNET_BLOCK_Type type,
+ const void *block,
+ size_t block_size)
{
switch (type)
{
@@ -166,37 +163,37 @@ block_plugin_regex_check_block (void *cls,
return GNUNET_OK;
case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
{
- const struct RegexAcceptBlock *rba;
-
- if (sizeof(struct RegexAcceptBlock) != block_size)
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
- rba = block;
- if (ntohl (rba->purpose.size) !=
- sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
- + sizeof(struct GNUNET_TIME_AbsoluteNBO)
- + sizeof(struct GNUNET_HashCode))
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
- if (GNUNET_TIME_absolute_is_past (GNUNET_TIME_absolute_ntoh (
-
rba->expiration_time)))
- {
- return GNUNET_NO;
- }
- if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
- &rba->purpose,
- &rba->signature,
- &rba->peer.public_key))
- {
- GNUNET_break_op (0);
- return GNUNET_NO;
- }
- return GNUNET_OK;
+ const struct RegexAcceptBlock *rba;
+
+ if (sizeof(struct RegexAcceptBlock) != block_size)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_NO;
+ }
+ rba = block;
+ if (ntohl (rba->purpose.size) !=
+ sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
+ + sizeof(struct GNUNET_TIME_AbsoluteNBO)
+ + sizeof(struct GNUNET_HashCode))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_NO;
+ }
+ if (GNUNET_TIME_absolute_is_past (GNUNET_TIME_absolute_ntoh (
+ rba->expiration_time)))
+ {
+ return GNUNET_NO;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CRYPTO_eddsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT,
+ &rba->purpose,
+ &rba->signature,
+ &rba->peer.public_key))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_NO;
+ }
+ return GNUNET_OK;
}
default:
GNUNET_break (0);
@@ -223,14 +220,14 @@ block_plugin_regex_check_block (void *cls,
*/
static enum GNUNET_BLOCK_ReplyEvaluationResult
block_plugin_regex_check_reply (
- void *cls,
- enum GNUNET_BLOCK_Type type,
- struct GNUNET_BLOCK_Group *group,
- const struct GNUNET_HashCode *query,
- const void *xquery,
- size_t xquery_size,
- const void *reply_block,
- size_t reply_block_size)
+ void *cls,
+ enum GNUNET_BLOCK_Type type,
+ struct GNUNET_BLOCK_Group *group,
+ const struct GNUNET_HashCode *query,
+ const void *xquery,
+ size_t xquery_size,
+ const void *reply_block,
+ size_t reply_block_size)
{
struct GNUNET_HashCode chash;
@@ -240,7 +237,7 @@ block_plugin_regex_check_reply (
if (0 != xquery_size)
{
const char *s;
-
+
s = (const char *) xquery;
GNUNET_assert ('\0' == s[xquery_size - 1]);
}
@@ -267,22 +264,22 @@ block_plugin_regex_check_reply (
return GNUNET_BLOCK_REPLY_OK_MORE;
case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
{
- const struct RegexAcceptBlock *rba;
-
- GNUNET_assert (sizeof(struct RegexAcceptBlock) == reply_block_size);
- rba = reply_block;
- GNUNET_assert (ntohl (rba->purpose.size) ==
- sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
- + sizeof(struct GNUNET_TIME_AbsoluteNBO)
- + sizeof(struct GNUNET_HashCode));
- GNUNET_CRYPTO_hash (reply_block,
- reply_block_size,
- &chash);
- if (GNUNET_YES ==
- GNUNET_BLOCK_GROUP_bf_test_and_set (group,
- &chash))
- return GNUNET_BLOCK_REPLY_OK_DUPLICATE;
- return GNUNET_BLOCK_REPLY_OK_MORE;
+ const struct RegexAcceptBlock *rba;
+
+ GNUNET_assert (sizeof(struct RegexAcceptBlock) == reply_block_size);
+ rba = reply_block;
+ GNUNET_assert (ntohl (rba->purpose.size) ==
+ sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose)
+ + sizeof(struct GNUNET_TIME_AbsoluteNBO)
+ + sizeof(struct GNUNET_HashCode));
+ GNUNET_CRYPTO_hash (reply_block,
+ reply_block_size,
+ &chash);
+ if (GNUNET_YES ==
+ GNUNET_BLOCK_GROUP_bf_test_and_set (group,
+ &chash))
+ return GNUNET_BLOCK_REPLY_OK_DUPLICATE;
+ return GNUNET_BLOCK_REPLY_OK_MORE;
}
default:
GNUNET_break (0);
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: protocol change: swap xquery and result filter, integrate mutator with result filter,
gnunet <=