diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-20 13:23:45 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-20 13:23:45 +0100 |
commit | 311f47494f931aefd9dc1e247831d88a3bcebdb4 (patch) | |
tree | d673be28629296ab33ed7f43ae7140e88967fc09 /src/rps | |
parent | 1173f89823cd4cb1ff6c8afdbc33ea9397bbeee2 (diff) | |
download | gnunet-311f47494f931aefd9dc1e247831d88a3bcebdb4.tar.gz gnunet-311f47494f931aefd9dc1e247831d88a3bcebdb4.zip |
fix enable_malicous check
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 4 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps.c | 24 | ||||
-rw-r--r-- | src/rps/rps.h | 2 | ||||
-rw-r--r-- | src/rps/rps_api.c | 2 | ||||
-rw-r--r-- | src/rps/test_rps.c | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 36a167203..937a4363b 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -1574,7 +1574,7 @@ static void mal_init_peer (struct RPSPeer *rps_peer) | |||
1574 | static void | 1574 | static void |
1575 | mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) | 1575 | mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) |
1576 | { | 1576 | { |
1577 | #ifdef ENABLE_MALICIOUS | 1577 | #if ENABLE_MALICIOUS |
1578 | uint32_t num_mal_peers; | 1578 | uint32_t num_mal_peers; |
1579 | 1579 | ||
1580 | GNUNET_assert ( (1 >= portion) && | 1580 | GNUNET_assert ( (1 >= portion) && |
@@ -1605,7 +1605,7 @@ mal_cb (struct RPSPeer *rps_peer) | |||
1605 | return; | 1605 | return; |
1606 | } | 1606 | } |
1607 | 1607 | ||
1608 | #ifdef ENABLE_MALICIOUS | 1608 | #if ENABLE_MALICIOUS |
1609 | GNUNET_assert ( (1 >= portion) && | 1609 | GNUNET_assert ( (1 >= portion) && |
1610 | (0 < portion) ); | 1610 | (0 < portion) ); |
1611 | num_mal_peers = round (portion * num_peers); | 1611 | num_mal_peers = round (portion * num_peers); |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 9dba04316..e3e25342e 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -261,7 +261,7 @@ struct ChannelCtx | |||
261 | }; | 261 | }; |
262 | 262 | ||
263 | 263 | ||
264 | #ifdef ENABLE_MALICIOUS | 264 | #if ENABLE_MALICIOUS |
265 | 265 | ||
266 | /** | 266 | /** |
267 | * If type is 2 This struct is used to store the attacked peers in a DLL | 267 | * If type is 2 This struct is used to store the attacked peers in a DLL |
@@ -492,7 +492,7 @@ static struct GNUNET_PEERINFO_Handle *peerinfo_handle; | |||
492 | static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify_handle; | 492 | static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify_handle; |
493 | 493 | ||
494 | 494 | ||
495 | #ifdef ENABLE_MALICIOUS | 495 | #if ENABLE_MALICIOUS |
496 | /** | 496 | /** |
497 | * Type of malicious peer | 497 | * Type of malicious peer |
498 | * | 498 | * |
@@ -2701,7 +2701,7 @@ clean_peer (struct Sub *sub, | |||
2701 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2701 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2702 | "Going to remove send channel to peer %s\n", | 2702 | "Going to remove send channel to peer %s\n", |
2703 | GNUNET_i2s (peer)); | 2703 | GNUNET_i2s (peer)); |
2704 | #ifdef ENABLE_MALICIOUS | 2704 | #if ENABLE_MALICIOUS |
2705 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (&attacked_peer, peer)) | 2705 | if (0 != GNUNET_CRYPTO_cmp_peer_identity (&attacked_peer, peer)) |
2706 | (void) destroy_sending_channel (get_peer_ctx (sub->peer_map, peer)); | 2706 | (void) destroy_sending_channel (get_peer_ctx (sub->peer_map, peer)); |
2707 | #else /* ENABLE_MALICIOUS */ | 2707 | #else /* ENABLE_MALICIOUS */ |
@@ -3436,7 +3436,7 @@ handle_peer_push (void *cls, | |||
3436 | GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO); | 3436 | GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO); |
3437 | } | 3437 | } |
3438 | 3438 | ||
3439 | #ifdef ENABLE_MALICIOUS | 3439 | #if ENABLE_MALICIOUS |
3440 | struct AttackedPeer *tmp_att_peer; | 3440 | struct AttackedPeer *tmp_att_peer; |
3441 | 3441 | ||
3442 | if ( (1 == mal_type) || | 3442 | if ( (1 == mal_type) || |
@@ -3512,7 +3512,7 @@ handle_peer_pull_request (void *cls, | |||
3512 | } | 3512 | } |
3513 | } | 3513 | } |
3514 | 3514 | ||
3515 | #ifdef ENABLE_MALICIOUS | 3515 | #if ENABLE_MALICIOUS |
3516 | if (1 == mal_type | 3516 | if (1 == mal_type |
3517 | || 3 == mal_type) | 3517 | || 3 == mal_type) |
3518 | { /* Try to maximise representation */ | 3518 | { /* Try to maximise representation */ |
@@ -3606,7 +3606,7 @@ handle_peer_pull_reply (void *cls, | |||
3606 | const struct GNUNET_PeerIdentity *peers; | 3606 | const struct GNUNET_PeerIdentity *peers; |
3607 | struct Sub *sub = channel_ctx->peer_ctx->sub; | 3607 | struct Sub *sub = channel_ctx->peer_ctx->sub; |
3608 | uint32_t i; | 3608 | uint32_t i; |
3609 | #ifdef ENABLE_MALICIOUS | 3609 | #if ENABLE_MALICIOUS |
3610 | struct AttackedPeer *tmp_att_peer; | 3610 | struct AttackedPeer *tmp_att_peer; |
3611 | #endif /* ENABLE_MALICIOUS */ | 3611 | #endif /* ENABLE_MALICIOUS */ |
3612 | 3612 | ||
@@ -3628,7 +3628,7 @@ handle_peer_pull_reply (void *cls, | |||
3628 | } | 3628 | } |
3629 | } | 3629 | } |
3630 | 3630 | ||
3631 | #ifdef ENABLE_MALICIOUS | 3631 | #if ENABLE_MALICIOUS |
3632 | // We shouldn't even receive pull replies as we're not sending | 3632 | // We shouldn't even receive pull replies as we're not sending |
3633 | if (2 == mal_type) | 3633 | if (2 == mal_type) |
3634 | { | 3634 | { |
@@ -3649,7 +3649,7 @@ handle_peer_pull_reply (void *cls, | |||
3649 | i, | 3649 | i, |
3650 | GNUNET_i2s (&peers[i])); | 3650 | GNUNET_i2s (&peers[i])); |
3651 | 3651 | ||
3652 | #ifdef ENABLE_MALICIOUS | 3652 | #if ENABLE_MALICIOUS |
3653 | if ((NULL != att_peer_set) && | 3653 | if ((NULL != att_peer_set) && |
3654 | (1 == mal_type || 3 == mal_type)) | 3654 | (1 == mal_type || 3 == mal_type)) |
3655 | { /* Add attacked peer to local list */ | 3655 | { /* Add attacked peer to local list */ |
@@ -3812,7 +3812,7 @@ send_push (struct PeerContext *peer_ctx) | |||
3812 | } | 3812 | } |
3813 | 3813 | ||
3814 | 3814 | ||
3815 | #ifdef ENABLE_MALICIOUS | 3815 | #if ENABLE_MALICIOUS |
3816 | 3816 | ||
3817 | 3817 | ||
3818 | /** | 3818 | /** |
@@ -4534,7 +4534,7 @@ shutdown_task (void *cls) | |||
4534 | } | 4534 | } |
4535 | GNUNET_CADET_disconnect (cadet_handle); | 4535 | GNUNET_CADET_disconnect (cadet_handle); |
4536 | cadet_handle = NULL; | 4536 | cadet_handle = NULL; |
4537 | #ifdef ENABLE_MALICIOUS | 4537 | #if ENABLE_MALICIOUS |
4538 | struct AttackedPeer *tmp_att_peer; | 4538 | struct AttackedPeer *tmp_att_peer; |
4539 | GNUNET_array_grow (mal_peers, | 4539 | GNUNET_array_grow (mal_peers, |
4540 | num_mal_peers, | 4540 | num_mal_peers, |
@@ -4647,7 +4647,7 @@ run (void *cls, | |||
4647 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 4647 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
4648 | "STARTING SERVICE (rps) for peer [%s]\n", | 4648 | "STARTING SERVICE (rps) for peer [%s]\n", |
4649 | GNUNET_i2s (&own_identity)); | 4649 | GNUNET_i2s (&own_identity)); |
4650 | #ifdef ENABLE_MALICIOUS | 4650 | #if ENABLE_MALICIOUS |
4651 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 4651 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
4652 | "Malicious execution compiled in.\n"); | 4652 | "Malicious execution compiled in.\n"); |
4653 | #endif /* ENABLE_MALICIOUS */ | 4653 | #endif /* ENABLE_MALICIOUS */ |
@@ -4740,7 +4740,7 @@ GNUNET_SERVICE_MAIN | |||
4740 | GNUNET_MESSAGE_TYPE_RPS_CS_SEED, | 4740 | GNUNET_MESSAGE_TYPE_RPS_CS_SEED, |
4741 | struct GNUNET_RPS_CS_SeedMessage, | 4741 | struct GNUNET_RPS_CS_SeedMessage, |
4742 | NULL), | 4742 | NULL), |
4743 | #ifdef ENABLE_MALICIOUS | 4743 | #if ENABLE_MALICIOUS |
4744 | GNUNET_MQ_hd_var_size (client_act_malicious, | 4744 | GNUNET_MQ_hd_var_size (client_act_malicious, |
4745 | GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS, | 4745 | GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS, |
4746 | struct GNUNET_RPS_CS_ActMaliciousMessage, | 4746 | struct GNUNET_RPS_CS_ActMaliciousMessage, |
diff --git a/src/rps/rps.h b/src/rps/rps.h index ef968ffbb..5bfef93b0 100644 --- a/src/rps/rps.h +++ b/src/rps/rps.h | |||
@@ -79,7 +79,7 @@ struct GNUNET_RPS_CS_SeedMessage | |||
79 | /* Followed by num_peers * GNUNET_PeerIdentity */ | 79 | /* Followed by num_peers * GNUNET_PeerIdentity */ |
80 | }; | 80 | }; |
81 | 81 | ||
82 | #ifdef ENABLE_MALICIOUS | 82 | #if ENABLE_MALICIOUS |
83 | /** | 83 | /** |
84 | * Message from client to service to turn service malicious. | 84 | * Message from client to service to turn service malicious. |
85 | */ | 85 | */ |
diff --git a/src/rps/rps_api.c b/src/rps/rps_api.c index 6fac4cf6f..d0b241a2b 100644 --- a/src/rps/rps_api.c +++ b/src/rps/rps_api.c | |||
@@ -806,7 +806,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, | |||
806 | } | 806 | } |
807 | 807 | ||
808 | 808 | ||
809 | #ifdef ENABLE_MALICIOUS | 809 | #if ENABLE_MALICIOUS |
810 | /** | 810 | /** |
811 | * Turn RPS service to act malicious. | 811 | * Turn RPS service to act malicious. |
812 | * | 812 | * |
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 126cc5dec..26066bf10 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -1357,7 +1357,7 @@ static void mal_init_peer (struct RPSPeer *rps_peer) | |||
1357 | static void | 1357 | static void |
1358 | mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) | 1358 | mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) |
1359 | { | 1359 | { |
1360 | #ifdef ENABLE_MALICIOUS | 1360 | #if ENABLE_MALICIOUS |
1361 | uint32_t num_mal_peers; | 1361 | uint32_t num_mal_peers; |
1362 | 1362 | ||
1363 | GNUNET_assert ( (1 >= portion) && | 1363 | GNUNET_assert ( (1 >= portion) && |
@@ -1388,7 +1388,7 @@ mal_cb (struct RPSPeer *rps_peer) | |||
1388 | return; | 1388 | return; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | #ifdef ENABLE_MALICIOUS | 1391 | #if ENABLE_MALICIOUS |
1392 | GNUNET_assert ( (1 >= portion) && | 1392 | GNUNET_assert ( (1 >= portion) && |
1393 | (0 < portion) ); | 1393 | (0 < portion) ); |
1394 | num_mal_peers = round (portion * num_peers); | 1394 | num_mal_peers = round (portion * num_peers); |