aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-11-27 12:28:49 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-11-27 12:28:49 +0000
commit7f2fbbdb0027a16e8de322e40d346cb70809af8f (patch)
treed0c9b491017897f4290bfe4474009f5c62330289
parent800ac5056afa9fb4b5add0e503ecd150e594151d (diff)
downloadgnunet-7f2fbbdb0027a16e8de322e40d346cb70809af8f.tar.gz
gnunet-7f2fbbdb0027a16e8de322e40d346cb70809af8f.zip
minor corrections to revocation service
revocation testtest now passes
-rw-r--r--src/revocation/Makefile.am1
-rw-r--r--src/revocation/gnunet-service-revocation.c19
-rw-r--r--src/revocation/test_revocation.c76
-rw-r--r--src/revocation/test_revocation.conf11
4 files changed, 99 insertions, 8 deletions
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index 5845474f3..94fda5fca 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -61,6 +61,7 @@ test_revocation_SOURCES = \
61test_revocation_LDADD = \ 61test_revocation_LDADD = \
62 $(top_builddir)/src/identity/libgnunetidentity.la \ 62 $(top_builddir)/src/identity/libgnunetidentity.la \
63 $(top_builddir)/src/revocation/libgnunetrevocation.la \ 63 $(top_builddir)/src/revocation/libgnunetrevocation.la \
64 $(top_builddir)/src//core/libgnunetcore.la \
64 $(top_builddir)/src/util/libgnunetutil.la \ 65 $(top_builddir)/src/util/libgnunetutil.la \
65 $(top_builddir)/src/testbed/libgnunettestbed.la 66 $(top_builddir)/src/testbed/libgnunettestbed.la
66 67
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 11f3fab77..f0b33a459 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -239,6 +239,7 @@ do_flood (void *cls,
239 239
240 e = GNUNET_MQ_msg (cp, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); 240 e = GNUNET_MQ_msg (cp, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE);
241 *cp = *rm; 241 *cp = *rm;
242 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Flooding revocation to `%s'\n", GNUNET_i2s (target));
242 GNUNET_MQ_send (pe->mq, e); 243 GNUNET_MQ_send (pe->mq, e);
243 return GNUNET_OK; 244 return GNUNET_OK;
244} 245}
@@ -313,6 +314,11 @@ publicize_rm (const struct RevokeMessage *rm)
313 GNUNET_break (0); 314 GNUNET_break (0);
314 return GNUNET_OK; 315 return GNUNET_OK;
315 } 316 }
317 else
318 {
319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
320 "Added revocation info to SET\n");
321 }
316 /* flood to neighbours */ 322 /* flood to neighbours */
317 GNUNET_CONTAINER_multipeermap_iterate (peers, 323 GNUNET_CONTAINER_multipeermap_iterate (peers,
318 &do_flood, 324 &do_flood,
@@ -459,6 +465,10 @@ transmit_task_cb (void *cls,
459 struct PeerEntry *peer_entry = cls; 465 struct PeerEntry *peer_entry = cls;
460 uint16_t salt; 466 uint16_t salt;
461 467
468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
469 "Starting set exchange with peer `%s'\n",
470 GNUNET_i2s (&peer_entry->id));
471
462 salt = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 472 salt = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
463 UINT16_MAX); 473 UINT16_MAX);
464 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK; 474 peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
@@ -495,6 +505,9 @@ handle_core_connect (void *cls,
495 struct GNUNET_HashCode my_hash; 505 struct GNUNET_HashCode my_hash;
496 struct GNUNET_HashCode peer_hash; 506 struct GNUNET_HashCode peer_hash;
497 507
508 if (0 == memcmp(peer, &my_identity, sizeof (my_identity)))
509 return;
510
498 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
499 "Peer `%s' connected to us\n", 512 "Peer `%s' connected to us\n",
500 GNUNET_i2s (peer)); 513 GNUNET_i2s (peer));
@@ -519,6 +532,9 @@ handle_core_connect (void *cls,
519 if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash, 532 if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash,
520 &peer_hash)) 533 &peer_hash))
521 { 534 {
535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
536 "Starting SET operation with peer `%s'\n",
537 GNUNET_i2s (peer));
522 peer_entry->transmit_task = 538 peer_entry->transmit_task =
523 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 539 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
524 &transmit_task_cb, 540 &transmit_task_cb,
@@ -541,6 +557,9 @@ handle_core_disconnect (void *cls,
541{ 557{
542 struct PeerEntry *pos; 558 struct PeerEntry *pos;
543 559
560 if (0 == memcmp(peer, &my_identity, sizeof (my_identity)))
561 return;
562
544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
545 "Peer `%s' disconnected from us\n", 564 "Peer `%s' disconnected from us\n",
546 GNUNET_i2s (peer)); 565 GNUNET_i2s (peer));
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c
index a04e1ecd5..c1278c650 100644
--- a/src/revocation/test_revocation.c
+++ b/src/revocation/test_revocation.c
@@ -18,8 +18,8 @@
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20/** 20/**
21 * @file dv/test_transport_dv.c 21 * @file revocation/test_revocation.c
22 * @brief base testcase for testing distance vector transport 22 * @brief base testcase for revocation exchange
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_core_service.h" 25#include "gnunet_core_service.h"
@@ -33,6 +33,7 @@ struct TestPeer
33{ 33{
34 struct GNUNET_TESTBED_Peer *p; 34 struct GNUNET_TESTBED_Peer *p;
35 struct GNUNET_TESTBED_Operation *identity_op; 35 struct GNUNET_TESTBED_Operation *identity_op;
36 struct GNUNET_TESTBED_Operation *core_op;
36 struct GNUNET_IDENTITY_Handle *idh; 37 struct GNUNET_IDENTITY_Handle *idh;
37 const struct GNUNET_CONFIGURATION_Handle *cfg; 38 const struct GNUNET_CONFIGURATION_Handle *cfg;
38 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 39 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
@@ -41,6 +42,7 @@ struct TestPeer
41 struct GNUNET_IDENTITY_Operation *create_id_op; 42 struct GNUNET_IDENTITY_Operation *create_id_op;
42 struct GNUNET_IDENTITY_EgoLookup *ego_lookup; 43 struct GNUNET_IDENTITY_EgoLookup *ego_lookup;
43 struct GNUNET_REVOCATION_Handle *revok_handle; 44 struct GNUNET_REVOCATION_Handle *revok_handle;
45 struct GNUNET_CORE_Handle *ch;
44 uint64_t pow; 46 uint64_t pow;
45}; 47};
46 48
@@ -87,6 +89,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
87 GNUNET_TESTBED_operation_done (testpeers[c].identity_op); 89 GNUNET_TESTBED_operation_done (testpeers[c].identity_op);
88 testpeers[c].identity_op = NULL; 90 testpeers[c].identity_op = NULL;
89 } 91 }
92 if (NULL != testpeers[c].core_op)
93 {
94 GNUNET_TESTBED_operation_done (testpeers[c].core_op);
95 testpeers[c].core_op = NULL;
96 }
90 } 97 }
91 GNUNET_SCHEDULER_shutdown (); 98 GNUNET_SCHEDULER_shutdown ();
92 ok = 0; 99 ok = 0;
@@ -101,6 +108,7 @@ do_shutdown_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
101 ok = 1; 108 ok = 1;
102} 109}
103 110
111
104static void * 112static void *
105identity_connect_adapter (void *cls, 113identity_connect_adapter (void *cls,
106 const struct GNUNET_CONFIGURATION_Handle *cfg) 114 const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -249,6 +257,61 @@ identity_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
249 } 257 }
250} 258}
251 259
260void static connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer)
261{
262 static int connects = 0;
263 connects++;
264 if (4 == connects)
265 {
266 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "All peers connected ...\n");
267
268 /* Connect to identity service */
269 testpeers[0].identity_op = GNUNET_TESTBED_service_connect (NULL,
270 testpeers[0].p, "identity", identity_completion_cb, NULL,
271 &identity_connect_adapter, &identity_disconnect_adapter,
272 &testpeers[0]);
273 testpeers[1].identity_op = GNUNET_TESTBED_service_connect (NULL,
274 testpeers[1].p, "identity", identity_completion_cb, NULL,
275 &identity_connect_adapter, &identity_disconnect_adapter,
276 &testpeers[1]);
277 }
278}
279
280
281static void
282core_completion_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
283 void *ca_result, const char *emsg)
284{
285 static int completed = 0;
286 completed++;
287 if (NUM_TEST_PEERS == completed)
288 {
289 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Connected to CORE\n");
290 }
291}
292
293
294static void *
295core_connect_adapter (void *cls,
296 const struct GNUNET_CONFIGURATION_Handle *cfg)
297{
298 struct TestPeer *me = cls;
299 me->cfg = cfg;
300 me->ch = GNUNET_CORE_connect (cfg, me, NULL, &connect_cb, NULL, NULL, GNUNET_NO, NULL, GNUNET_NO, NULL);
301 if (NULL == me->ch)
302 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Failed to create CORE handle \n");
303 return me->ch;
304}
305
306
307static void
308core_disconnect_adapter (void *cls, void *op_result)
309{
310 struct TestPeer *me = cls;
311 GNUNET_CORE_disconnect (me->ch);
312 me->ch = NULL;
313}
314
252static void 315static void
253test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h, 316test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h,
254 unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, 317 unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
@@ -271,10 +334,9 @@ test_connection (void *cls, struct GNUNET_TESTBED_RunHandle *h,
271 { 334 {
272 testpeers[c].p = peers[c]; 335 testpeers[c].p = peers[c];
273 336
274 /* Connect to identity service */ 337 testpeers[c].core_op = GNUNET_TESTBED_service_connect (NULL,
275 testpeers[c].identity_op = GNUNET_TESTBED_service_connect (NULL, 338 testpeers[c].p, "core", &core_completion_cb, NULL,
276 testpeers[c].p, "identity", identity_completion_cb, NULL, 339 &core_connect_adapter, &core_disconnect_adapter,
277 &identity_connect_adapter, &identity_disconnect_adapter,
278 &testpeers[c]); 340 &testpeers[c]);
279 } 341 }
280 } 342 }
@@ -290,4 +352,4 @@ main (int argc, char *argv[])
290 return ok; 352 return ok;
291} 353}
292 354
293/* end of test_transport_dv.c */ 355/* end of test_revocation.c */
diff --git a/src/revocation/test_revocation.conf b/src/revocation/test_revocation.conf
index 0b6beb0a3..3ef2537b7 100644
--- a/src/revocation/test_revocation.conf
+++ b/src/revocation/test_revocation.conf
@@ -5,6 +5,9 @@ SERVICEHOME=/tmp/test-revocation-service
5[revocation] 5[revocation]
6WORKBITS = 5 6WORKBITS = 5
7 7
8[arm]
9DEFAULTSERVICES = core identity revocation
10
8[identity] 11[identity]
9# Directory where we store information about our egos 12# Directory where we store information about our egos
10EGODIR = $GNUNET_HOME/identity/egos/ 13EGODIR = $GNUNET_HOME/identity/egos/
@@ -18,4 +21,10 @@ SERVERS = dummy
18BROADCAST = NO 21BROADCAST = NO
19 22
20[peerinfo] 23[peerinfo]
21USE_INCLUDED_HELLOS = NO \ No newline at end of file 24USE_INCLUDED_HELLOS = NO
25
26[testbed]
27OVERLAY_TOPOLOGY = CLIQUE
28SETUP_TIMEOUT = 1 m
29OPERATION_TIMEOUT = 5 s
30CACHE_SIZE = 0