diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-11 11:19:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-11 11:19:37 +0000 |
commit | 27dc0bfe8529724621ad29c07ca9f17e6be03918 (patch) | |
tree | 60104839a0c5fe141e0bf5dce04d16a09b5c9a6e /src/core | |
parent | 618488e70f1d726cd6fc40c86ca627a4d7610d3a (diff) | |
download | gnunet-27dc0bfe8529724621ad29c07ca9f17e6be03918.tar.gz gnunet-27dc0bfe8529724621ad29c07ca9f17e6be03918.zip |
fix
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/gnunet-service-core_clients.c | 31 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 49 | ||||
-rw-r--r-- | src/core/gnunet-service-core_sessions.c | 2 |
3 files changed, 76 insertions, 6 deletions
diff --git a/src/core/gnunet-service-core_clients.c b/src/core/gnunet-service-core_clients.c index 2b1c5fe59..838fa42db 100644 --- a/src/core/gnunet-service-core_clients.c +++ b/src/core/gnunet-service-core_clients.c | |||
@@ -220,10 +220,10 @@ send_to_all_clients (const struct GNUNET_MessageHeader *msg, | |||
220 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && | 220 | ( (0 != (options & GNUNET_CORE_OPTION_SEND_FULL_INBOUND)) && |
221 | (GNUNET_YES == type_match (type, c)) ) ) ) | 221 | (GNUNET_YES == type_match (type, c)) ) ) ) |
222 | continue; /* skip */ | 222 | continue; /* skip */ |
223 | #if DEBUG_CORE > 1 | 223 | #if DEBUG_CORE |
224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 224 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
225 | "Sending message of type %u to client.\n", | 225 | "Sending message to all clients interested in messages of type %u.\n", |
226 | (unsigned int) ntohs (msg->type)); | 226 | (unsigned int) type); |
227 | #endif | 227 | #endif |
228 | send_to_client (c, msg, can_drop); | 228 | send_to_client (c, msg, can_drop); |
229 | } | 229 | } |
@@ -323,6 +323,11 @@ handle_client_send_request (void *cls, struct GNUNET_SERVER_Client *client, | |||
323 | } | 323 | } |
324 | if (c->requests == NULL) | 324 | if (c->requests == NULL) |
325 | c->requests = GNUNET_CONTAINER_multihashmap_create (16); | 325 | c->requests = GNUNET_CONTAINER_multihashmap_create (16); |
326 | #if DEBUG_CORE | ||
327 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
328 | "Client asked for transmission to `%s'\n", | ||
329 | GNUNET_i2s (&req->peer)); | ||
330 | #endif | ||
326 | car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey); | 331 | car = GNUNET_CONTAINER_multihashmap_get (c->requests, &req->peer.hashPubKey); |
327 | if (car == NULL) | 332 | if (car == NULL) |
328 | { | 333 | { |
@@ -417,6 +422,13 @@ handle_client_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
417 | &sm->peer.hashPubKey, | 422 | &sm->peer.hashPubKey, |
418 | tc.car)); | 423 | tc.car)); |
419 | tc.cork = ntohl (sm->cork); | 424 | tc.cork = ntohl (sm->cork); |
425 | #if DEBUG_CORE | ||
426 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
427 | "Client asked for transmission of %u bytes to `%s' %s\n", | ||
428 | msize, | ||
429 | GNUNET_i2s (&sm->peer), | ||
430 | tc.cork ? "now" : ""); | ||
431 | #endif | ||
420 | GNUNET_SERVER_mst_receive (client_mst, | 432 | GNUNET_SERVER_mst_receive (client_mst, |
421 | &tc, | 433 | &tc, |
422 | (const char*) &sm[1], msize, | 434 | (const char*) &sm[1], msize, |
@@ -450,6 +462,11 @@ client_tokenizer_callback (void *cls, void *client, | |||
450 | if (0 == | 462 | if (0 == |
451 | memcmp (&car->target, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity))) | 463 | memcmp (&car->target, &GSC_my_identity, sizeof (struct GNUNET_PeerIdentity))) |
452 | { | 464 | { |
465 | #if DEBUG_CORE | ||
466 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
467 | "Delivering message of type %u to myself\n", | ||
468 | ntohs (message->type)); | ||
469 | #endif | ||
453 | GSC_CLIENTS_deliver_message (&GSC_my_identity, | 470 | GSC_CLIENTS_deliver_message (&GSC_my_identity, |
454 | NULL, 0, | 471 | NULL, 0, |
455 | message, | 472 | message, |
@@ -462,7 +479,15 @@ client_tokenizer_callback (void *cls, void *client, | |||
462 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); | 479 | GNUNET_CORE_OPTION_SEND_HDR_INBOUND | GNUNET_CORE_OPTION_SEND_HDR_OUTBOUND); |
463 | } | 480 | } |
464 | else | 481 | else |
482 | { | ||
483 | #if DEBUG_CORE | ||
484 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
485 | "Delivering message of type %u to %s\n", | ||
486 | ntohs (message->type), | ||
487 | GNUNET_i2s (&car->target)); | ||
488 | #endif | ||
465 | GSC_SESSIONS_transmit (car, message, tc->cork); | 489 | GSC_SESSIONS_transmit (car, message, tc->cork); |
490 | } | ||
466 | } | 491 | } |
467 | 492 | ||
468 | 493 | ||
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 19b692ab9..4b9a9498b 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -654,6 +654,11 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid) | |||
654 | { | 654 | { |
655 | struct GSC_KeyExchangeInfo *kx; | 655 | struct GSC_KeyExchangeInfo *kx; |
656 | 656 | ||
657 | #if DEBUG_CORE | ||
658 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
659 | "Initiating key exchange with `%s'\n", | ||
660 | GNUNET_i2s (pid)); | ||
661 | #endif | ||
657 | kx = GNUNET_malloc (sizeof (struct GSC_KeyExchangeInfo)); | 662 | kx = GNUNET_malloc (sizeof (struct GSC_KeyExchangeInfo)); |
658 | kx->peer = *pid; | 663 | kx->peer = *pid; |
659 | kx->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; | 664 | kx->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY; |
@@ -782,6 +787,11 @@ GSC_KX_handle_set_key (struct GSC_KeyExchangeInfo *kx, | |||
782 | GNUNET_STATISTICS_update (GSC_stats, | 787 | GNUNET_STATISTICS_update (GSC_stats, |
783 | gettext_noop ("# SET_KEY messages decrypted"), 1, | 788 | gettext_noop ("# SET_KEY messages decrypted"), 1, |
784 | GNUNET_NO); | 789 | GNUNET_NO); |
790 | #if DEBUG_CORE | ||
791 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
792 | "Received SET_KEY from `%s'\n", | ||
793 | GNUNET_i2s (&kx->peer)); | ||
794 | #endif | ||
785 | kx->decrypt_key = k; | 795 | kx->decrypt_key = k; |
786 | if (kx->decrypt_key_created.abs_value != t.abs_value) | 796 | if (kx->decrypt_key_created.abs_value != t.abs_value) |
787 | { | 797 | { |
@@ -895,6 +905,11 @@ GSC_KX_handle_ping (struct GSC_KeyExchangeInfo *kx, | |||
895 | GNUNET_break_op (0); | 905 | GNUNET_break_op (0); |
896 | return; | 906 | return; |
897 | } | 907 | } |
908 | #if DEBUG_CORE | ||
909 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
910 | "Received PING from `%s'\n", | ||
911 | GNUNET_i2s (&kx->peer)); | ||
912 | #endif | ||
898 | /* construct PONG */ | 913 | /* construct PONG */ |
899 | tx.reserved = GNUNET_BANDWIDTH_VALUE_MAX; | 914 | tx.reserved = GNUNET_BANDWIDTH_VALUE_MAX; |
900 | tx.challenge = t.challenge; | 915 | tx.challenge = t.challenge; |
@@ -999,6 +1014,11 @@ send_keep_alive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
999 | kx->status = KX_STATE_DOWN; | 1014 | kx->status = KX_STATE_DOWN; |
1000 | return; | 1015 | return; |
1001 | } | 1016 | } |
1017 | #if DEBUG_CORE | ||
1018 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1019 | "Sending KEEPALIVE to `%s'\n", | ||
1020 | GNUNET_i2s (&kx->peer)); | ||
1021 | #endif | ||
1002 | setup_fresh_ping (kx); | 1022 | setup_fresh_ping (kx); |
1003 | GSC_NEIGHBOURS_transmit (&kx->peer, | 1023 | GSC_NEIGHBOURS_transmit (&kx->peer, |
1004 | &kx->ping.header, | 1024 | &kx->ping.header, |
@@ -1053,7 +1073,6 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH | |||
1053 | } | 1073 | } |
1054 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# PONG messages received"), | 1074 | GNUNET_STATISTICS_update (GSC_stats, gettext_noop ("# PONG messages received"), |
1055 | 1, GNUNET_NO); | 1075 | 1, GNUNET_NO); |
1056 | |||
1057 | if ( (kx->status != KX_STATE_KEY_RECEIVED) && | 1076 | if ( (kx->status != KX_STATE_KEY_RECEIVED) && |
1058 | (kx->status != KX_STATE_UP) ) | 1077 | (kx->status != KX_STATE_UP) ) |
1059 | { | 1078 | { |
@@ -1099,6 +1118,11 @@ GSC_KX_handle_pong (struct GSC_KeyExchangeInfo *kx, const struct GNUNET_MessageH | |||
1099 | #endif | 1118 | #endif |
1100 | return; | 1119 | return; |
1101 | } | 1120 | } |
1121 | #if DEBUG_CORE | ||
1122 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1123 | "Received PONG from `%s'\n", | ||
1124 | GNUNET_i2s (&kx->peer)); | ||
1125 | #endif | ||
1102 | switch (kx->status) | 1126 | switch (kx->status) |
1103 | { | 1127 | { |
1104 | case KX_STATE_DOWN: | 1128 | case KX_STATE_DOWN: |
@@ -1144,6 +1168,11 @@ send_key (struct GSC_KeyExchangeInfo *kx) | |||
1144 | if (kx->public_key == NULL) | 1168 | if (kx->public_key == NULL) |
1145 | { | 1169 | { |
1146 | /* lookup public key, then try again */ | 1170 | /* lookup public key, then try again */ |
1171 | #if DEBUG_CORE | ||
1172 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1173 | "Trying to obtain public key for `%s'\n", | ||
1174 | GNUNET_i2s (&kx->peer)); | ||
1175 | #endif | ||
1147 | kx->pitr = | 1176 | kx->pitr = |
1148 | GNUNET_PEERINFO_iterate (peerinfo, &kx->peer, | 1177 | GNUNET_PEERINFO_iterate (peerinfo, &kx->peer, |
1149 | GNUNET_TIME_UNIT_FOREVER_REL /* timeout? */, | 1178 | GNUNET_TIME_UNIT_FOREVER_REL /* timeout? */, |
@@ -1178,7 +1207,11 @@ send_key (struct GSC_KeyExchangeInfo *kx) | |||
1178 | 1207 | ||
1179 | /* always update sender status in SET KEY message */ | 1208 | /* always update sender status in SET KEY message */ |
1180 | kx->skm.sender_status = htonl ((int32_t) kx->status); | 1209 | kx->skm.sender_status = htonl ((int32_t) kx->status); |
1181 | 1210 | #if DEBUG_CORE | |
1211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1212 | "Sending SET_KEY and PING to `%s'\n", | ||
1213 | GNUNET_i2s (&kx->peer)); | ||
1214 | #endif | ||
1182 | GSC_NEIGHBOURS_transmit (&kx->peer, | 1215 | GSC_NEIGHBOURS_transmit (&kx->peer, |
1183 | &kx->skm.header, | 1216 | &kx->skm.header, |
1184 | kx->set_key_retry_frequency); | 1217 | kx->set_key_retry_frequency); |
@@ -1228,6 +1261,12 @@ GSC_KX_encrypt_and_transmit (struct GSC_KeyExchangeInfo *kx, | |||
1228 | GNUNET_assert (GNUNET_OK == | 1261 | GNUNET_assert (GNUNET_OK == |
1229 | do_encrypt (kx, &iv, &ph->sequence_number, &em->sequence_number, | 1262 | do_encrypt (kx, &iv, &ph->sequence_number, &em->sequence_number, |
1230 | used - ENCRYPTED_HEADER_SIZE)); | 1263 | used - ENCRYPTED_HEADER_SIZE)); |
1264 | #if DEBUG_CORE | ||
1265 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1266 | "Encrypted %u bytes for %s\n", | ||
1267 | used - ENCRYPTED_HEADER_SIZE, | ||
1268 | GNUNET_i2s (&kx->peer)); | ||
1269 | #endif | ||
1231 | derive_auth_key (&auth_key, &kx->encrypt_key, ph->iv_seed, | 1270 | derive_auth_key (&auth_key, &kx->encrypt_key, ph->iv_seed, |
1232 | kx->encrypt_key_created); | 1271 | kx->encrypt_key_created); |
1233 | GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number, | 1272 | GNUNET_CRYPTO_hmac (&auth_key, &em->sequence_number, |
@@ -1320,6 +1359,12 @@ GSC_KX_handle_encrypted_message (struct GSC_KeyExchangeInfo *kx, | |||
1320 | do_decrypt (kx, &iv, &m->sequence_number, &buf[ENCRYPTED_HEADER_SIZE], | 1359 | do_decrypt (kx, &iv, &m->sequence_number, &buf[ENCRYPTED_HEADER_SIZE], |
1321 | size - ENCRYPTED_HEADER_SIZE)) | 1360 | size - ENCRYPTED_HEADER_SIZE)) |
1322 | return; | 1361 | return; |
1362 | #if DEBUG_CORE | ||
1363 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1364 | "Decrypted %u bytes from %s\n", | ||
1365 | size - ENCRYPTED_HEADER_SIZE, | ||
1366 | GNUNET_i2s (&kx->peer)); | ||
1367 | #endif | ||
1323 | pt = (struct EncryptedMessage *) buf; | 1368 | pt = (struct EncryptedMessage *) buf; |
1324 | 1369 | ||
1325 | /* validate sequence number */ | 1370 | /* validate sequence number */ |
diff --git a/src/core/gnunet-service-core_sessions.c b/src/core/gnunet-service-core_sessions.c index 480857642..360b558e4 100644 --- a/src/core/gnunet-service-core_sessions.c +++ b/src/core/gnunet-service-core_sessions.c | |||
@@ -421,7 +421,7 @@ static void | |||
421 | pop_cork_task (void *cls, | 421 | pop_cork_task (void *cls, |
422 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 422 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
423 | { | 423 | { |
424 | struct Session *session = session; | 424 | struct Session *session = cls; |
425 | 425 | ||
426 | session->cork_task = GNUNET_SCHEDULER_NO_TASK; | 426 | session->cork_task = GNUNET_SCHEDULER_NO_TASK; |
427 | try_transmission (session); | 427 | try_transmission (session); |