From d3d994d338667d4bc263c8a6832cb592d678422f Mon Sep 17 00:00:00 2001 From: t3sserakt Date: Fri, 27 Jan 2023 13:13:18 +0100 Subject: TNG: Added tcp icmp nat hole punching test case script, and fixed bugs occuring during shutdown. --- .../testing_api_cmd_netjail_start_cmds_helper.c | 4 +++- src/transport/Makefile.am | 2 ++ src/transport/transport_api2_communication.c | 21 +++++++-------------- src/transport/transport_api_cmd_start_peer.c | 6 ++++-- src/util/mq.c | 4 ---- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c index 545b89b33..619392119 100644 --- a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c +++ b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c @@ -489,6 +489,7 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message) } else if (ns->number_of_local_tests_finished == total_number) { GNUNET_SCHEDULER_cancel (ns->timeout_task); + ns->timeout_task = NULL; GNUNET_TESTING_async_finish (&ns->ac); } break; @@ -525,7 +526,8 @@ exp_cb (void *cls) struct NetJailState *ns = cls; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n"); - GNUNET_SCHEDULER_cancel (ns->timeout_task); + if (NULL != ns->timeout_task) + GNUNET_SCHEDULER_cancel (ns->timeout_task); GNUNET_TESTING_async_fail (&(ns->ac)); } diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 0059861c2..5acba3a4e 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am @@ -760,6 +760,7 @@ endif # Only test TNG if we run experimental if HAVE_EXPERIMENTAL check_SCRIPTS= \ +test_transport_nat_icmp_tcp.sh \ test_transport_nat_upnp.sh \ test_transport_simple_send_string.sh \ test_transport_simple_send.sh \ @@ -1509,6 +1510,7 @@ test_transport_api_slow_ats_LDADD = \ EXTRA_DIST = \ +test_transport_nat_icmp_tcp.sh \ test_transport_nat_upnp.sh \ test_transport_simple_send_string.sh \ test_transport_simple_send.sh \ diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index b79f0d8bf..079982ca5 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c @@ -1048,21 +1048,10 @@ GNUNET_TRANSPORT_communicator_address_remove ( struct GNUNET_TRANSPORT_CommunicatorHandle *ch = ai->ch; send_del_address (ai); - if (NULL == ai->prev) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "prev null\n"); - if (ch->ai_head == ai) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "equals head\n"); - if (NULL == ai->next) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "next null\n"); - if (ch->ai_tail == ai) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "equals tail\n"); GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai); GNUNET_free (ai->address); GNUNET_free (ai); + ai = NULL; } /** @@ -1074,9 +1063,13 @@ void GNUNET_TRANSPORT_communicator_address_remove_all ( struct GNUNET_TRANSPORT_CommunicatorHandle *ch) { - for (struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head; NULL != ai; - ai = ai->next) + struct GNUNET_TRANSPORT_AddressIdentifier *ai = ch->ai_head; + while (NULL != ai) + { + struct GNUNET_TRANSPORT_AddressIdentifier *ai_next = ai->next; GNUNET_TRANSPORT_communicator_address_remove (ai); + ai = ai_next; + } } diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index 516f8d0aa..1f8ef2f8f 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c @@ -244,6 +244,7 @@ start_peer_run (void *cls, "UNIXPATH", udp_communicator_unix_path); + system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, sps->system_label); GNUNET_TESTING_get_trait_test_system (system_cmd, @@ -384,11 +385,12 @@ start_peer_cleanup (void *cls) GNUNET_free (sps->handlers); sps->handlers = NULL; } - if (NULL != sps->cfg) + //TODO Investigate why this caused problems during shutdown. + /*if (NULL != sps->cfg) { GNUNET_CONFIGURATION_destroy (sps->cfg); sps->cfg = NULL; - } + }*/ GNUNET_free (sps->cfgname); GNUNET_free (sps->node_ip); GNUNET_free (sps->system_label); diff --git a/src/util/mq.c b/src/util/mq.c index 788b9b636..de0cff0c2 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -304,10 +304,6 @@ void GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev) { - if (NULL == mq) - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "mq is NUll when sending message of type %u\n", - (unsigned int) ntohs (ev->mh->type)); GNUNET_assert (NULL != mq); GNUNET_assert (NULL == ev->parent_queue); -- cgit v1.2.3