aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-10 14:22:35 +0100
committerChristian Grothoff <christian@grothoff.org>2022-01-10 14:22:35 +0100
commit8ee3c5121e87d8f25193ae6044d5818f4629fa1e (patch)
treeeb0dd0250f11fb5f9bc788cef8ba55da90160698 /src/testbed
parentd4641d36b885ba764945d6353ed71b7bc485c6ac (diff)
downloadgnunet-8ee3c5121e87d8f25193ae6044d5818f4629fa1e.tar.gz
gnunet-8ee3c5121e87d8f25193ae6044d5818f4629fa1e.zip
-DHT: add path signature verification logic; tests pass, but logic remains dead
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed_connectionpool.c33
-rw-r--r--src/testbed/gnunet-service-testbed_oc.c44
-rw-r--r--src/testbed/testbed_api_topology.c2
3 files changed, 55 insertions, 24 deletions
diff --git a/src/testbed/gnunet-service-testbed_connectionpool.c b/src/testbed/gnunet-service-testbed_connectionpool.c
index 7318971b3..59780e6c1 100644
--- a/src/testbed/gnunet-service-testbed_connectionpool.c
+++ b/src/testbed/gnunet-service-testbed_connectionpool.c
@@ -445,10 +445,13 @@ connection_ready (void *cls)
445 gh_next = NULL; 445 gh_next = NULL;
446 if (NULL != gh->next) 446 if (NULL != gh->next)
447 gh_next = search_waiting (entry, gh->next); 447 gh_next = search_waiting (entry, gh->next);
448 GNUNET_CONTAINER_DLL_remove (entry->head_waiting, entry->tail_waiting, gh); 448 GNUNET_CONTAINER_DLL_remove (entry->head_waiting,
449 entry->tail_waiting,
450 gh);
449 gh->connection_ready_called = 1; 451 gh->connection_ready_called = 1;
450 if (NULL != gh_next) 452 if (NULL != gh_next)
451 entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready, entry); 453 entry->notify_task = GNUNET_SCHEDULER_add_now (&connection_ready,
454 entry);
452 if ((NULL != gh->target) && (NULL != gh->connect_notify_cb)) 455 if ((NULL != gh->target) && (NULL != gh->connect_notify_cb))
453 { 456 {
454 GNUNET_CONTAINER_DLL_insert_tail (entry->head_notify, 457 GNUNET_CONTAINER_DLL_insert_tail (entry->head_notify,
@@ -456,7 +459,9 @@ connection_ready (void *cls)
456 gh); 459 gh);
457 gh->notify_waiting = 1; 460 gh->notify_waiting = 1;
458 } 461 }
459 LOG_DEBUG ("Connection ready for handle type %u\n", gh->service); 462 LOG_DEBUG ("Connection ready to %u for handle type %u\n",
463 (unsigned int) entry->index,
464 gh->service);
460 gh->cb (gh->cb_cls, 465 gh->cb (gh->cb_cls,
461 entry->handle_core, 466 entry->handle_core,
462 entry->handle_transport, 467 entry->handle_transport,
@@ -625,7 +630,8 @@ core_peer_connect_cb (void *cls,
625 * @param my_identity ID of this peer, NULL if we failed 630 * @param my_identity ID of this peer, NULL if we failed
626 */ 631 */
627static void 632static void
628core_startup_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity) 633core_startup_cb (void *cls,
634 const struct GNUNET_PeerIdentity *my_identity)
629{ 635{
630 struct PooledConnection *entry = cls; 636 struct PooledConnection *entry = cls;
631 637
@@ -637,6 +643,10 @@ core_startup_cb (void *cls, const struct GNUNET_PeerIdentity *my_identity)
637 GNUNET_assert (NULL == entry->peer_identity); 643 GNUNET_assert (NULL == entry->peer_identity);
638 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity); 644 entry->peer_identity = GNUNET_new (struct GNUNET_PeerIdentity);
639 *entry->peer_identity = *my_identity; 645 *entry->peer_identity = *my_identity;
646 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
647 "Established CORE connection for peer %s (%u)\n",
648 GNUNET_i2s (my_identity),
649 (unsigned int) entry->index);
640 if (0 == entry->demand) 650 if (0 == entry->demand)
641 return; 651 return;
642 if (NULL != entry->notify_task) 652 if (NULL != entry->notify_task)
@@ -857,19 +867,20 @@ GST_connection_pool_get_handle (
857 case GST_CONNECTIONPOOL_SERVICE_TRANSPORT: 867 case GST_CONNECTIONPOOL_SERVICE_TRANSPORT:
858 handle = entry->handle_transport; 868 handle = entry->handle_transport;
859 if (NULL != handle) 869 if (NULL != handle)
860 LOG_DEBUG ("Found TRANSPORT handle for peer %u\n", entry->index); 870 LOG_DEBUG ("Found TRANSPORT handle for peer %u\n",
871 entry->index);
861 break; 872 break;
862
863 case GST_CONNECTIONPOOL_SERVICE_CORE: 873 case GST_CONNECTIONPOOL_SERVICE_CORE:
864 handle = entry->handle_core; 874 handle = entry->handle_core;
865 if (NULL != handle) 875 if (NULL != handle)
866 LOG_DEBUG ("Found CORE handle for peer %u\n", entry->index); 876 LOG_DEBUG ("Found CORE handle for peer %u\n",
877 entry->index);
867 break; 878 break;
868
869 case GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY: 879 case GST_CONNECTIONPOOL_SERVICE_ATS_CONNECTIVITY:
870 handle = entry->handle_ats_connectivity; 880 handle = entry->handle_ats_connectivity;
871 if (NULL != handle) 881 if (NULL != handle)
872 LOG_DEBUG ("Found ATS CONNECTIVITY handle for peer %u\n", entry->index); 882 LOG_DEBUG ("Found ATS CONNECTIVITY handle for peer %u\n",
883 entry->index);
873 break; 884 break;
874 } 885 }
875 } 886 }
@@ -905,7 +916,9 @@ GST_connection_pool_get_handle (
905 gh->connect_notify_cb = connect_notify_cb; 916 gh->connect_notify_cb = connect_notify_cb;
906 gh->connect_notify_cb_cls = connect_notify_cb_cls; 917 gh->connect_notify_cb_cls = connect_notify_cb_cls;
907 gh->service = service; 918 gh->service = service;
908 GNUNET_CONTAINER_DLL_insert (entry->head_waiting, entry->tail_waiting, gh); 919 GNUNET_CONTAINER_DLL_insert (entry->head_waiting,
920 entry->tail_waiting,
921 gh);
909 if (NULL != handle) 922 if (NULL != handle)
910 { 923 {
911 if (NULL == entry->notify_task) 924 if (NULL == entry->notify_task)
diff --git a/src/testbed/gnunet-service-testbed_oc.c b/src/testbed/gnunet-service-testbed_oc.c
index 4fe7c20b3..b13a3b7e0 100644
--- a/src/testbed/gnunet-service-testbed_oc.c
+++ b/src/testbed/gnunet-service-testbed_oc.c
@@ -685,15 +685,14 @@ overlay_connect_notify (void *cls,
685 685
686 LOG_DEBUG ("Overlay connect notify\n"); 686 LOG_DEBUG ("Overlay connect notify\n");
687 if (0 == 687 if (0 ==
688 memcmp (new_peer, &occ->peer_identity, 688 GNUNET_memcmp (new_peer,
689 sizeof(struct GNUNET_PeerIdentity))) 689 &occ->peer_identity))
690 return; 690 return;
691 new_peer_str = GNUNET_strdup (GNUNET_i2s (new_peer)); 691 new_peer_str = GNUNET_strdup (GNUNET_i2s (new_peer));
692 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity)); 692 other_peer_str = GNUNET_strdup (GNUNET_i2s (&occ->other_peer_identity));
693 if (0 != 693 if (0 !=
694 memcmp (new_peer, 694 GNUNET_memcmp (new_peer,
695 &occ->other_peer_identity, 695 &occ->other_peer_identity))
696 sizeof(struct GNUNET_PeerIdentity)))
697 { 696 {
698 LOG_DEBUG ("Unexpected peer %s connected when expecting peer %s\n", 697 LOG_DEBUG ("Unexpected peer %s connected when expecting peer %s\n",
699 new_peer_str, 698 new_peer_str,
@@ -1180,19 +1179,23 @@ occ_cache_get_handle_core_cb (void *cls,
1180 return; 1179 return;
1181 } 1180 }
1182 occ->emsg = NULL; 1181 occ->emsg = NULL;
1182 occ->peer_identity = *my_identity;
1183 if (NULL != 1183 if (NULL !=
1184 GNUNET_CORE_get_mq (ch, 1184 GNUNET_CORE_get_mq (ch,
1185 &occ->other_peer_identity)) 1185 &occ->other_peer_identity))
1186 { 1186 {
1187 LOG_DEBUG ("0x%llx: Target peer already connected\n", 1187 LOG_DEBUG ("0x%llx: Target peer %s already connected\n",
1188 (unsigned long long) occ->op_id); 1188 (unsigned long long) occ->op_id,
1189 GNUNET_i2s (&occ->other_peer_identity));
1190 LOG_DEBUG ("0x%llx: Target peer %s connected\n",
1191 (unsigned long long) occ->op_id,
1192 GNUNET_i2s (&occ->peer_identity));
1189 GNUNET_SCHEDULER_cancel (occ->timeout_task); 1193 GNUNET_SCHEDULER_cancel (occ->timeout_task);
1190 occ->timeout_task = NULL; 1194 occ->timeout_task = NULL;
1191 send_overlay_connect_success_msg (occ); 1195 send_overlay_connect_success_msg (occ);
1192 occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ); 1196 occ->cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup_occ, occ);
1193 return; 1197 return;
1194 } 1198 }
1195 occ->peer_identity = *my_identity;
1196 LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n", 1199 LOG_DEBUG ("0x%llx: Acquiring HELLO of peer %s\n",
1197 (unsigned long long) occ->op_id, 1200 (unsigned long long) occ->op_id,
1198 GNUNET_i2s (&occ->peer_identity)); 1201 GNUNET_i2s (&occ->peer_identity));
@@ -1259,12 +1262,11 @@ overlay_connect_get_config (void *cls,
1259 GST_connection_pool_get_handle (occ->peer->id, 1262 GST_connection_pool_get_handle (occ->peer->id,
1260 occ->peer->details.local.cfg, 1263 occ->peer->details.local.cfg,
1261 GST_CONNECTIONPOOL_SERVICE_CORE, 1264 GST_CONNECTIONPOOL_SERVICE_CORE,
1262 occ_cache_get_handle_core_cb, 1265 &occ_cache_get_handle_core_cb,
1263 occ, 1266 occ,
1264 &occ->other_peer_identity, 1267 &occ->other_peer_identity,
1265 &overlay_connect_notify, 1268 &overlay_connect_notify,
1266 occ); 1269 occ);
1267 return;
1268} 1270}
1269 1271
1270 1272
@@ -1540,6 +1542,12 @@ handle_overlay_connect (void *cls,
1540 1542
1541 p1 = ntohl (msg->peer1); 1543 p1 = ntohl (msg->peer1);
1542 p2 = ntohl (msg->peer2); 1544 p2 = ntohl (msg->peer2);
1545 if (p1 == p2)
1546 {
1547 GNUNET_break (0);
1548 GNUNET_SERVICE_client_drop (client);
1549 return;
1550 }
1543 if (! VALID_PEER_ID (p1)) 1551 if (! VALID_PEER_ID (p1))
1544 { 1552 {
1545 GNUNET_break (0); 1553 GNUNET_break (0);
@@ -1620,12 +1628,10 @@ handle_overlay_connect (void *cls,
1620 &p2_controller_connect_cb, 1628 &p2_controller_connect_cb,
1621 occ); 1629 occ);
1622 break; 1630 break;
1623
1624 case OCC_TYPE_REMOTE_SLAVE: 1631 case OCC_TYPE_REMOTE_SLAVE:
1625 p2_controller_connect_cb (occ, 1632 p2_controller_connect_cb (occ,
1626 occ->p2ctx.remote.p2c); 1633 occ->p2ctx.remote.p2c);
1627 break; 1634 break;
1628
1629 case OCC_TYPE_LOCAL: 1635 case OCC_TYPE_LOCAL:
1630 peer2 = GST_peer_list[occ->other_peer_id]; 1636 peer2 = GST_peer_list[occ->other_peer_id];
1631 peer2->reference_cnt++; 1637 peer2->reference_cnt++;
@@ -1636,11 +1642,23 @@ handle_overlay_connect (void *cls,
1636 "id: %u", 1642 "id: %u",
1637 (unsigned long long) occ->op_id, 1643 (unsigned long long) occ->op_id,
1638 occ->peer->id); 1644 occ->peer->id);
1645 LOG_DEBUG ("Peer %u has PID %s\n",
1646 occ->other_peer_id,
1647 GNUNET_i2s (&occ->other_peer_identity));
1648 {
1649 struct GNUNET_PeerIdentity lpid;
1650
1651 GNUNET_TESTING_peer_get_identity (peer->details.local.peer,
1652 &lpid);
1653 LOG_DEBUG ("Peer %u has PID %s\n",
1654 p1,
1655 GNUNET_i2s (&lpid));
1656 }
1639 occ->cgh_ch = 1657 occ->cgh_ch =
1640 GST_connection_pool_get_handle (occ->peer->id, 1658 GST_connection_pool_get_handle (occ->peer->id,
1641 occ->peer->details.local.cfg, 1659 occ->peer->details.local.cfg,
1642 GST_CONNECTIONPOOL_SERVICE_CORE, 1660 GST_CONNECTIONPOOL_SERVICE_CORE,
1643 occ_cache_get_handle_core_cb, occ, 1661 &occ_cache_get_handle_core_cb, occ,
1644 &occ->other_peer_identity, 1662 &occ->other_peer_identity,
1645 &overlay_connect_notify, occ); 1663 &overlay_connect_notify, occ);
1646 break; 1664 break;
diff --git a/src/testbed/testbed_api_topology.c b/src/testbed/testbed_api_topology.c
index 0f7c0b15c..e68e449ad 100644
--- a/src/testbed/testbed_api_topology.c
+++ b/src/testbed/testbed_api_topology.c
@@ -1441,7 +1441,7 @@ GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1441 (c->opq_parallel_topology_config_operations, op); 1441 (c->opq_parallel_topology_config_operations, op);
1442 GNUNET_TESTBED_operation_begin_wait_ (op); 1442 GNUNET_TESTBED_operation_begin_wait_ (op);
1443 LOG (GNUNET_ERROR_TYPE_DEBUG, 1443 LOG (GNUNET_ERROR_TYPE_DEBUG,
1444 "Generated %u connections\n", 1444 "Generated topology with %u connections\n",
1445 tc->link_array_size); 1445 tc->link_array_size);
1446 if (NULL != max_connections) 1446 if (NULL != max_connections)
1447 *max_connections = tc->link_array_size; 1447 *max_connections = tc->link_array_size;