From 311f47494f931aefd9dc1e247831d88a3bcebdb4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 20 Feb 2019 13:23:45 +0100 Subject: [PATCH] fix enable_malicous check --- src/include/gnunet_protocols.h | 2 +- src/include/gnunet_rps_service.h | 2 +- src/rps/gnunet-rps-profiler.c | 4 ++-- src/rps/gnunet-service-rps.c | 24 ++++++++++++------------ src/rps/rps.h | 2 +- src/rps/rps_api.c | 2 +- src/rps/test_rps.c | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 29db8372f..46620b829 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h @@ -2633,7 +2633,7 @@ extern "C" */ #define GNUNET_MESSAGE_TYPE_RPS_CS_SEED 954 -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * Turn RPS service malicious */ diff --git a/src/include/gnunet_rps_service.h b/src/include/gnunet_rps_service.h index 8ae9f1e93..b1dd1b5af 100644 --- a/src/include/gnunet_rps_service.h +++ b/src/include/gnunet_rps_service.h @@ -137,7 +137,7 @@ GNUNET_RPS_seed_ids (struct GNUNET_RPS_Handle *h, uint32_t n, GNUNET_RPS_request_cancel (struct GNUNET_RPS_Request_Handle *rh); -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * Turn RPS service to act malicious. * 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) static void mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) { - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS uint32_t num_mal_peers; GNUNET_assert ( (1 >= portion) && @@ -1605,7 +1605,7 @@ mal_cb (struct RPSPeer *rps_peer) return; } - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS GNUNET_assert ( (1 >= portion) && (0 < portion) ); 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 }; -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * 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; static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify_handle; -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * Type of malicious peer * @@ -2701,7 +2701,7 @@ clean_peer (struct Sub *sub, LOG (GNUNET_ERROR_TYPE_DEBUG, "Going to remove send channel to peer %s\n", GNUNET_i2s (peer)); - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS if (0 != GNUNET_CRYPTO_cmp_peer_identity (&attacked_peer, peer)) (void) destroy_sending_channel (get_peer_ctx (sub->peer_map, peer)); #else /* ENABLE_MALICIOUS */ @@ -3436,7 +3436,7 @@ handle_peer_push (void *cls, GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO); } - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS struct AttackedPeer *tmp_att_peer; if ( (1 == mal_type) || @@ -3512,7 +3512,7 @@ handle_peer_pull_request (void *cls, } } - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS if (1 == mal_type || 3 == mal_type) { /* Try to maximise representation */ @@ -3606,7 +3606,7 @@ handle_peer_pull_reply (void *cls, const struct GNUNET_PeerIdentity *peers; struct Sub *sub = channel_ctx->peer_ctx->sub; uint32_t i; -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS struct AttackedPeer *tmp_att_peer; #endif /* ENABLE_MALICIOUS */ @@ -3628,7 +3628,7 @@ handle_peer_pull_reply (void *cls, } } - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS // We shouldn't even receive pull replies as we're not sending if (2 == mal_type) { @@ -3649,7 +3649,7 @@ handle_peer_pull_reply (void *cls, i, GNUNET_i2s (&peers[i])); - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS if ((NULL != att_peer_set) && (1 == mal_type || 3 == mal_type)) { /* Add attacked peer to local list */ @@ -3812,7 +3812,7 @@ send_push (struct PeerContext *peer_ctx) } -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** @@ -4534,7 +4534,7 @@ shutdown_task (void *cls) } GNUNET_CADET_disconnect (cadet_handle); cadet_handle = NULL; -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS struct AttackedPeer *tmp_att_peer; GNUNET_array_grow (mal_peers, num_mal_peers, @@ -4647,7 +4647,7 @@ run (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "STARTING SERVICE (rps) for peer [%s]\n", GNUNET_i2s (&own_identity)); -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Malicious execution compiled in.\n"); #endif /* ENABLE_MALICIOUS */ @@ -4740,7 +4740,7 @@ GNUNET_SERVICE_MAIN GNUNET_MESSAGE_TYPE_RPS_CS_SEED, struct GNUNET_RPS_CS_SeedMessage, NULL), -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS GNUNET_MQ_hd_var_size (client_act_malicious, GNUNET_MESSAGE_TYPE_RPS_ACT_MALICIOUS, 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 /* Followed by num_peers * GNUNET_PeerIdentity */ }; -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * Message from client to service to turn service malicious. */ 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, } -#ifdef ENABLE_MALICIOUS +#if ENABLE_MALICIOUS /** * Turn RPS service to act malicious. * 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) static void mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) { - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS uint32_t num_mal_peers; GNUNET_assert ( (1 >= portion) && @@ -1388,7 +1388,7 @@ mal_cb (struct RPSPeer *rps_peer) return; } - #ifdef ENABLE_MALICIOUS + #if ENABLE_MALICIOUS GNUNET_assert ( (1 >= portion) && (0 < portion) ); num_mal_peers = round (portion * num_peers); -- 2.25.1