aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2015-03-25 21:08:11 +0000
committerJulius Bünger <buenger@mytum.de>2015-03-25 21:08:11 +0000
commit92c7a1c4e25d8e367e6a3f16890d3af8076fa4b1 (patch)
tree5dba8e5b3ba36795c6ece23b61893668662e85af /src
parentb25eb3c3774f491c303fe4f68dd7c225246afdfe (diff)
downloadgnunet-92c7a1c4e25d8e367e6a3f16890d3af8076fa4b1.tar.gz
gnunet-92c7a1c4e25d8e367e6a3f16890d3af8076fa4b1.zip
-mal peer type 1 pulls
Diffstat (limited to 'src')
-rw-r--r--src/rps/gnunet-service-rps.c25
1 files 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;
409/** 409/**
410 * Number of attacked peers 410 * Number of attacked peers
411 */ 411 */
412//static uint32_t num_attacked_peers = 0; 412static uint32_t num_attacked_peers = 0;
413 413
414 414
415/** 415/**
@@ -1619,25 +1619,40 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1619 uint32_t num_pushes; 1619 uint32_t num_pushes;
1620 uint32_t i; 1620 uint32_t i;
1621 struct GNUNET_TIME_Relative time_next_round; 1621 struct GNUNET_TIME_Relative time_next_round;
1622 struct AttackedPeer *tmp_att_peer;
1622 1623
1623 LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously.\n"); 1624 LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to execute next round maliciously.\n");
1624 1625
1625 /* Do malicious actions */ 1626 /* Do malicious actions */
1626 if (1 == mal_type) 1627 if (1 == mal_type)
1627 { /* Try to maximise representation */ 1628 { /* Try to maximise representation */
1628 num_pushes = min (min (push_limit, /* FIXME: attacked peer */ num_mal_peers), GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE); 1629 num_pushes = min (min (push_limit,
1630 num_attacked_peers),
1631 GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE);
1632
1633 /* Send PUSHes to attacked peers */
1629 for (i = 0 ; i < num_pushes ; i++) 1634 for (i = 0 ; i < num_pushes ; i++)
1630 { /* Send PUSHes to attacked peers */ 1635 {
1631 if (att_peers_tail == att_peer_index) 1636 if (att_peers_tail == att_peer_index)
1632 att_peer_index = att_peers_head; 1637 att_peer_index = att_peers_head;
1633 else 1638 else
1634 att_peer_index = att_peer_index->next; 1639 att_peer_index = att_peer_index->next;
1635 1640
1636 send_push (att_peer_index->peer_id); 1641 send_push (att_peer_index->peer_id);
1642 }
1637 1643
1638 // TODO send pulls 1644 /* Send PULLs to some peers to learn about additional peers to attack */
1639 // send_pull_request 1645 tmp_att_peer = att_peer_index;
1646 for (i = 0 ; i < num_pushes * alpha ; i++)
1647 {
1648 if (att_peers_tail == tmp_att_peer)
1649 tmp_att_peer = att_peers_head;
1650 else
1651 att_peer_index = tmp_att_peer->next;
1652
1653 send_pull_request (tmp_att_peer->peer_id);
1640 } 1654 }
1655
1641 } 1656 }
1642 else if (2 == mal_type) 1657 else if (2 == mal_type)
1643 { /** 1658 { /**