# /src/rps/
/src/rps/rps.conf
/src/rps/test_rps_multipeer
+/src/rps/test_rps_malicious*
/src/rps/Makefile.in
/src/rps/Makefile
/src/rps/.deps
/**
* If type is 2 this is the attacked peer
*/
-struct struct GNUNET_PeerIdentity attacked_peer;
+static struct GNUNET_PeerIdentity attacked_peer;
#endif /* ENABLE_MALICIOUS */
msg = (struct GNUNET_RPS_CS_RequestMessage *) message;
num_peers = ntohl (msg->num_peers);
- size_needed = sizeof (struct GNUNET_RPS_CS_ReplyMessage) +
+ size_needed = sizeof (struct GNUNET_RPS_CS_RequestMessage) +
num_peers * sizeof (struct GNUNET_PeerIdentity);
if (GNUNET_SERVER_MAX_MESSAGE_SIZE < size_needed)
|| NULL != peer_ctx->recv_channel)
{
if (GNUNET_NO == in_arr (pull_list, pull_list_size, &peers[i])
- && GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peers[i]))
+ && 0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peers[i]))
GNUNET_array_append (pull_list, pull_list_size, peers[i]);
}
else if (GNUNET_NO == insert_in_pull_list_scheduled (peer_ctx))
void **channel_ctx,
const struct GNUNET_MessageHeader *msg)
{
+ struct GNUNET_RPS_CS_ActMaliciousMessage *in_msg;
+ struct GNUNET_PeerIdentity *sender;
+ struct PeerContext *sender_ctx;
struct GNUNET_PeerIdentity *peers;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "PULL REPLY received\n");
-
/* Check for protocol violation */
- if (sizeof (struct GNUNET_RPS_P2P_PullReplyMessage) > ntohs (msg->size))
+ if (sizeof (struct GNUNET_RPS_CS_ActMaliciousMessage) > ntohs (msg->size))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
return GNUNET_OK;
}
+
/* Do actual logic */
peers = (struct GNUNET_PeerIdentity *) &msg[1];
- num_peers = ntohl (in_msg->num_peers);
+ num_mal_peers = ntohl (in_msg->num_peers);
mal_type = ntohl (in_msg->type);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Now acting malicious type %" PRIX32 "\n",
+ mal_type);
+
if (1 == mal_type)
{ /* Try to maximise representation */
num_mal_peers = ntohl (in_msg->num_peers);
memcpy (mal_peers, peers, num_mal_peers);
attacked_peer = peers[num_mal_peers];
}
+
+ return GNUNET_OK;
}
#endif /* ENABLE_MALICIOUS */
*/
#include "gnunet_rps_service.h"
+//#define ENABLE_MALICIOUS 1
/**
* Mesh port used by RPS.
*/
struct GNUNET_MessageHeader header;
- /**
- * Number of random peer requested
- */
- uint32_t num_peers GNUNET_PACKED;
-
/**
* Identifyer of the message.
*/
uint64_t n GNUNET_PACKED;
+ /**
+ * Number of random peer requested
+ */
+ uint32_t num_peers GNUNET_PACKED;
};
/**
/**
* Number of random peer replied
*/
- uint64_t num_peers GNUNET_PACKED;
+ uint32_t num_peers GNUNET_PACKED;
/* Followed by num_peers * GNUNET_PeerIdentity */
};
/**
* Number of peers
*/
- uint64_t num_peers GNUNET_PACKED;
+ uint32_t num_peers GNUNET_PACKED;
/* Followed by num_peers * GNUNET_PeerIdentity */
};
/**
* Number of peers
*/
- uint64_t num_peers GNUNET_PACKED;
+ uint32_t num_peers GNUNET_PACKED;
/* Followed by num_peers * GNUNET_PeerIdentity */
};
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_RPS_CS_ReplyMessage *msg;
- //struct cb_cls_pack *pack;
- //struct GNUNET_RPS_Handle *h;
struct GNUNET_PeerIdentity *peers;
struct GNUNET_RPS_Request_Handle *rh;
/* Give the peers back */
msg = (struct GNUNET_RPS_CS_ReplyMessage *) message;
- //pack = (struct cb_cls_pack *) cls;
- //h = (struct GNUNET_RPS_Handle *) cls;
peers = (struct GNUNET_PeerIdentity *) &msg[1];
rh = &req_handlers[msg->n];
- rh->ready_cb((rh)->ready_cb_cls, msg->num_peers, peers);
+ rh->ready_cb((rh)->ready_cb_cls, msg->num_peers, peers); // FIXME? ntohl ()
/* Disconnect */
//GNUNET_CLIENT_disconnect(pack->service_conn);
{
ev = GNUNET_MQ_msg_extra (msg, num_peers_max * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_RPS_CS_SEED);
- msg->num_peers = ntohl (num_peers_max);
+ msg->num_peers = htonl (num_peers_max);
memcpy (&msg[1], tmp_peer_pointer, num_peers_max * sizeof (struct GNUNET_PeerIdentity));
GNUNET_MQ_send (h->mq, ev);
OPERATION_TIMEOUT = 60 s
MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 1
-OVERLAY_TOPOLOGY = CLIQUE
+#OVERLAY_TOPOLOGY = CLIQUE
+OVERLAY_TOPOLOGY = SMALL_WORLD
SCALE_FREE_TOPOLOGY_CAP =
OVERLAY_RANDOM_LINKS = 5
h = GNUNET_RPS_connect (cfg);
#if ENABLE_MALICIOUS
+ GNUNET_assert (1 >= portion
+ && 0 < portion);
+
num_mal_peers = round (portion * NUM_PEERS);
- GNUNET_RPS_act_malicious (h, htonl (1), htonl (num_mal_peers), rps_peer_ids);
+ GNUNET_RPS_act_malicious (h, htonl (1), num_mal_peers, rps_peer_ids);
#endif /* ENABLE_MALICIOUS */
return h;