From 92c7a1c4e25d8e367e6a3f16890d3af8076fa4b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20B=C3=BCnger?= Date: Wed, 25 Mar 2015 21:08:11 +0000 Subject: [PATCH] -mal peer type 1 pulls --- src/rps/gnunet-service-rps.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 67e79daf7..96f2d6faa 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -409,7 +409,7 @@ static struct AttackedPeer *att_peer_index = NULL; /** * Number of attacked peers */ -//static uint32_t num_attacked_peers = 0; +static uint32_t num_attacked_peers = 0; /** @@ -1619,25 +1619,40 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) uint32_t num_pushes; uint32_t i; struct GNUNET_TIME_Relative time_next_round; + struct AttackedPeer *tmp_att_peer; LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously.\n"); /* Do malicious actions */ if (1 == mal_type) { /* Try to maximise representation */ - num_pushes = min (min (push_limit, /* FIXME: attacked peer */ num_mal_peers), GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE); + num_pushes = min (min (push_limit, + num_attacked_peers), + GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE); + + /* Send PUSHes to attacked peers */ for (i = 0 ; i < num_pushes ; i++) - { /* Send PUSHes to attacked peers */ + { if (att_peers_tail == att_peer_index) att_peer_index = att_peers_head; else att_peer_index = att_peer_index->next; send_push (att_peer_index->peer_id); + } - // TODO send pulls - // send_pull_request + /* Send PULLs to some peers to learn about additional peers to attack */ + tmp_att_peer = att_peer_index; + for (i = 0 ; i < num_pushes * alpha ; i++) + { + if (att_peers_tail == tmp_att_peer) + tmp_att_peer = att_peers_head; + else + att_peer_index = tmp_att_peer->next; + + send_pull_request (tmp_att_peer->peer_id); } + } else if (2 == mal_type) { /** -- 2.25.1