From: Nathan S. Evans Date: Mon, 29 Nov 2010 13:06:01 +0000 (+0000) Subject: more efficient malicious behavior (discard messages earlier) X-Git-Tag: initial-import-from-subversion-38251~19607 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=99cbab79fbe2b05956c78888d2b2092e0b0b6631;p=oweals%2Fgnunet.git more efficient malicious behavior (discard messages earlier) --- diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index 061d93a86..90690809d 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c @@ -3088,7 +3088,7 @@ run (void *cls, trial_info.gets = num_gets; trial_info.concurrent = max_outstanding_gets; trial_info.settle_time = settle_time; - trial_info.num_rounds = 1; + trial_info.num_rounds = total_rounds; trial_info.malicious_getters = malicious_getters; trial_info.malicious_putters = malicious_putters; trial_info.malicious_droppers = malicious_droppers; diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index fff683a7d..2746d75b8 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c @@ -4143,6 +4143,12 @@ handle_dht_local_route_request (void *cls, struct GNUNET_SERVER_Client *client, if (dhtlog_handle != NULL) dhtlog_handle->insert_dhtkey (NULL, &dht_msg->key); #endif + + if (GNUNET_YES == malicious_dropper) + { + GNUNET_SERVER_receive_done (client, GNUNET_OK); + return; + } memset(&msg_ctx, 0, sizeof(struct DHT_MessageContext)); msg_ctx.client = find_active_client (client); memcpy(&msg_ctx.key, &dht_msg->key, sizeof(GNUNET_HashCode)); @@ -4222,7 +4228,7 @@ handle_dht_control_message (void *cls, struct GNUNET_SERVER_Client *client, dhtlog_handle->set_malicious(&my_identity); #endif malicious_dropper = GNUNET_YES; - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s:%s Initiating malicious DROP behavior\n", my_short_id, "DHT"); break; #endif @@ -4313,6 +4319,21 @@ handle_dht_p2p_route_request (void *cls, return GNUNET_YES; } + if (malicious_dropper == GNUNET_YES) + { +#if DEBUG_DHT_ROUTING + if ((debug_routes_extended) && (dhtlog_handle != NULL)) + { + /** Log routes that die due to high load! */ + dhtlog_handle->insert_route (NULL, GNUNET_ntohll(incoming->unique_id), DHTLOG_ROUTE, + ntohl(incoming->hop_count), GNUNET_SYSERR, + &my_identity, &incoming->key, peer, + NULL); + } +#endif + return GNUNET_YES; + } + if (get_max_send_delay().rel_value > MAX_REQUEST_TIME.rel_value) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending of previous replies took too long, backing off!\n"); @@ -4376,6 +4397,21 @@ handle_dht_p2p_route_result (void *cls, return GNUNET_YES; } + if (malicious_dropper == GNUNET_YES) + { +#if DEBUG_DHT_ROUTING + if ((debug_routes_extended) && (dhtlog_handle != NULL)) + { + /** Log routes that die due to high load! */ + dhtlog_handle->insert_route (NULL, GNUNET_ntohll(incoming->unique_id), DHTLOG_ROUTE, + ntohl(incoming->hop_count), GNUNET_SYSERR, + &my_identity, &incoming->key, peer, + NULL); + } +#endif + return GNUNET_YES; + } + memset(&msg_ctx, 0, sizeof(struct DHT_MessageContext)); // FIXME: call GNUNET_BLOCK_evaluate (...) -- instead of doing your own bloomfilter! msg_ctx.bloom = GNUNET_CONTAINER_bloomfilter_init(incoming->bloomfilter, DHT_BLOOM_SIZE, DHT_BLOOM_K);