diff options
author | Julius Bünger <buenger@mytum.de> | 2015-03-25 22:01:26 +0000 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2015-03-25 22:01:26 +0000 |
commit | c7ed5f29afe7a4e4294657239238170bfd9bc934 (patch) | |
tree | fbc8b3716a96d8052e720feb9075e4554760da3d /src | |
parent | 21892bd440255898e5f9d74a765e37e979e50b68 (diff) | |
download | gnunet-c7ed5f29afe7a4e4294657239238170bfd9bc934.tar.gz gnunet-c7ed5f29afe7a4e4294657239238170bfd9bc934.zip |
-malicious push handling
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 06c98ab64..e4f7b3c4d 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -391,7 +391,7 @@ struct AttackedPeer | |||
391 | /** | 391 | /** |
392 | * PeerID | 392 | * PeerID |
393 | */ | 393 | */ |
394 | struct GNUNET_PeerIdentity *peer_id; | 394 | struct GNUNET_PeerIdentity peer_id; |
395 | }; | 395 | }; |
396 | 396 | ||
397 | /** | 397 | /** |
@@ -1247,6 +1247,26 @@ handle_peer_push (void *cls, | |||
1247 | // FIXME wait for cadet to change this function | 1247 | // FIXME wait for cadet to change this function |
1248 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PUSH received (%s)\n", GNUNET_i2s (peer)); | 1248 | LOG (GNUNET_ERROR_TYPE_DEBUG, "PUSH received (%s)\n", GNUNET_i2s (peer)); |
1249 | 1249 | ||
1250 | #ifdef ENABLE_MALICIOUS | ||
1251 | struct AttackedPeer *tmp_att_peer; | ||
1252 | |||
1253 | tmp_att_peer = GNUNET_new (struct AttackedPeer); | ||
1254 | memcpy (&tmp_att_peer->peer_id, peer, sizeof (struct GNUNET_PeerIdentity)); | ||
1255 | if (1 == mal_type) | ||
1256 | { /* Try to maximise representation */ | ||
1257 | // TODO Check whether we already have that peer | ||
1258 | GNUNET_CONTAINER_DLL_insert (att_peers_head, att_peers_tail, tmp_att_peer); | ||
1259 | return GNUNET_OK; | ||
1260 | } | ||
1261 | |||
1262 | |||
1263 | else if (2 == mal_type) | ||
1264 | { /* We attack one single well-known peer - simply ignore */ | ||
1265 | return GNUNET_OK; | ||
1266 | } | ||
1267 | |||
1268 | #endif /* ENABLE_MALICIOUS */ | ||
1269 | |||
1250 | /* Add the sending peer to the push_list */ | 1270 | /* Add the sending peer to the push_list */ |
1251 | if (GNUNET_NO == in_arr (push_list, push_list_size, peer)) | 1271 | if (GNUNET_NO == in_arr (push_list, push_list_size, peer)) |
1252 | GNUNET_array_append (push_list, push_list_size, *peer); | 1272 | GNUNET_array_append (push_list, push_list_size, *peer); |
@@ -1254,6 +1274,7 @@ handle_peer_push (void *cls, | |||
1254 | return GNUNET_OK; | 1274 | return GNUNET_OK; |
1255 | } | 1275 | } |
1256 | 1276 | ||
1277 | |||
1257 | /** | 1278 | /** |
1258 | * Handle PULL REQUEST request message from another peer. | 1279 | * Handle PULL REQUEST request message from another peer. |
1259 | * | 1280 | * |
@@ -1653,7 +1674,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1653 | else | 1674 | else |
1654 | att_peer_index = att_peer_index->next; | 1675 | att_peer_index = att_peer_index->next; |
1655 | 1676 | ||
1656 | send_push (att_peer_index->peer_id); | 1677 | send_push (&att_peer_index->peer_id); |
1657 | } | 1678 | } |
1658 | 1679 | ||
1659 | 1680 | ||
@@ -1677,7 +1698,7 @@ do_mal_round (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1677 | else | 1698 | else |
1678 | att_peer_index = tmp_att_peer->next; | 1699 | att_peer_index = tmp_att_peer->next; |
1679 | 1700 | ||
1680 | send_pull_request (tmp_att_peer->peer_id); | 1701 | send_pull_request (&tmp_att_peer->peer_id); |
1681 | } | 1702 | } |
1682 | } | 1703 | } |
1683 | 1704 | ||