aboutsummaryrefslogtreecommitdiff
path: root/src/set/gnunet-service-set_union.c
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-12-12 01:19:33 +0000
committerFlorian Dold <florian.dold@gmail.com>2015-12-12 01:19:33 +0000
commit0f90ccc7e083596607a0cee58173d9578642447f (patch)
tree4f78de5c5c25460652c8eaf1598e2e3a7d211614 /src/set/gnunet-service-set_union.c
parent6735421b5aa576407844e37ce40da0e6583a7ab4 (diff)
downloadgnunet-0f90ccc7e083596607a0cee58173d9578642447f.tar.gz
gnunet-0f90ccc7e083596607a0cee58173d9578642447f.zip
Handle larger IBFs correctly.
Diffstat (limited to 'src/set/gnunet-service-set_union.c')
-rw-r--r--src/set/gnunet-service-set_union.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index af1aaeb81..0a8826fb4 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -61,7 +61,7 @@
61 * Choose this value so that computing the IBF is still cheaper 61 * Choose this value so that computing the IBF is still cheaper
62 * than transmitting all values. 62 * than transmitting all values.
63 */ 63 */
64#define MAX_IBF_ORDER (18) 64#define MAX_IBF_ORDER (20)
65 65
66/** 66/**
67 * Number of buckets used in the ibf per estimated 67 * Number of buckets used in the ibf per estimated
@@ -614,9 +614,10 @@ send_ibf (struct Operation *op,
614 ev = GNUNET_MQ_msg_extra (msg, 614 ev = GNUNET_MQ_msg_extra (msg,
615 buckets_in_message * IBF_BUCKET_SIZE, 615 buckets_in_message * IBF_BUCKET_SIZE,
616 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF); 616 GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF);
617 msg->reserved = 0; 617 msg->reserved1 = 0;
618 msg->reserved2 = 0;
618 msg->order = ibf_order; 619 msg->order = ibf_order;
619 msg->offset = htons (buckets_sent); 620 msg->offset = htonl (buckets_sent);
620 msg->salt = htonl (op->state->salt_send); 621 msg->salt = htonl (op->state->salt_send);
621 ibf_write_slice (ibf, buckets_sent, 622 ibf_write_slice (ibf, buckets_sent,
622 buckets_in_message, &msg[1]); 623 buckets_in_message, &msg[1]);
@@ -855,6 +856,7 @@ decode_and_send (struct Operation *op)
855 if (GNUNET_OK != 856 if (GNUNET_OK !=
856 prepare_ibf (op, op->state->remote_ibf->size)) 857 prepare_ibf (op, op->state->remote_ibf->size))
857 { 858 {
859 GNUNET_break (0);
858 /* allocation failed */ 860 /* allocation failed */
859 return GNUNET_SYSERR; 861 return GNUNET_SYSERR;
860 } 862 }
@@ -1023,6 +1025,7 @@ handle_p2p_ibf (void *cls,
1023 1 << msg->order); 1025 1 << msg->order);
1024 op->state->remote_ibf = ibf_create (1<<msg->order, SE_IBF_HASH_NUM); 1026 op->state->remote_ibf = ibf_create (1<<msg->order, SE_IBF_HASH_NUM);
1025 op->state->salt_receive = ntohl (msg->salt); 1027 op->state->salt_receive = ntohl (msg->salt);
1028 LOG (GNUNET_ERROR_TYPE_INFO, "Receiving new IBF with salt %u\n", op->state->salt_receive);
1026 if (NULL == op->state->remote_ibf) 1029 if (NULL == op->state->remote_ibf)
1027 { 1030 {
1028 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1031 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1031,7 +1034,7 @@ handle_p2p_ibf (void *cls,
1031 return GNUNET_SYSERR; 1034 return GNUNET_SYSERR;
1032 } 1035 }
1033 op->state->ibf_buckets_received = 0; 1036 op->state->ibf_buckets_received = 0;
1034 if (0 != ntohs (msg->offset)) 1037 if (0 != ntohl (msg->offset))
1035 { 1038 {
1036 GNUNET_break_op (0); 1039 GNUNET_break_op (0);
1037 fail_union_operation (op); 1040 fail_union_operation (op);
@@ -1040,9 +1043,19 @@ handle_p2p_ibf (void *cls,
1040 } 1043 }
1041 else if (op->state->phase == PHASE_EXPECT_IBF_CONT) 1044 else if (op->state->phase == PHASE_EXPECT_IBF_CONT)
1042 { 1045 {
1043 if ( (ntohs (msg->offset) != op->state->ibf_buckets_received) || 1046 if (ntohl (msg->offset) != op->state->ibf_buckets_received)
1044 (1<<msg->order != op->state->remote_ibf->size) || 1047 {
1045 (ntohl (msg->salt) != op->state->salt_receive)) 1048 GNUNET_break_op (0);
1049 fail_union_operation (op);
1050 return GNUNET_SYSERR;
1051 }
1052 if (1<<msg->order != op->state->remote_ibf->size)
1053 {
1054 GNUNET_break_op (0);
1055 fail_union_operation (op);
1056 return GNUNET_SYSERR;
1057 }
1058 if (ntohl (msg->salt) != op->state->salt_receive)
1046 { 1059 {
1047 GNUNET_break_op (0); 1060 GNUNET_break_op (0);
1048 fail_union_operation (op); 1061 fail_union_operation (op);