aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-07-17 14:26:45 +0200
committert3sserakt <t3ss@posteo.de>2020-07-17 14:26:45 +0200
commit0c9911d73744da31776f98019ff1460032f2c82b (patch)
tree6746a66f0467b5115d7c23547b563aab3e119163 /src/transport/transport-testing2.c
parent686a873aed44e0dff36f0d52c465af2e5efb5ab2 (diff)
downloadgnunet-0c9911d73744da31776f98019ff1460032f2c82b.tar.gz
gnunet-0c9911d73744da31776f98019ff1460032f2c82b.zip
TNG: Implemented 5530: add replay protection to TCP communicator. Added monotime value checks
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 0dc1bb331..974dc56c1 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -114,6 +114,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
114 struct GNUNET_OS_Process *resolver_proc; 114 struct GNUNET_OS_Process *resolver_proc;
115 115
116 /** 116 /**
117 * peerstore service process
118 */
119 struct GNUNET_OS_Process *ps_proc;
120
121 /**
117 * @brief Task that will be run on shutdown to stop and clean communicator 122 * @brief Task that will be run on shutdown to stop and clean communicator
118 */ 123 */
119 struct GNUNET_SCHEDULER_Task *c_shutdown_task; 124 struct GNUNET_SCHEDULER_Task *c_shutdown_task;
@@ -671,8 +676,8 @@ handle_update_queue_message (void *cls,
671 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; 676 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue;
672 677
673 LOG (GNUNET_ERROR_TYPE_DEBUG, 678 LOG (GNUNET_ERROR_TYPE_DEBUG,
674 "Received queue update message for %u with q_len %"PRIu64"\n", 679 "Received queue update message for %u with q_len %" PRIu64 "\n",
675 msg->qid, GNUNET_ntohll(msg->q_len)); 680 msg->qid, GNUNET_ntohll (msg->q_len));
676 tc_queue = tc_h->queue_head; 681 tc_queue = tc_h->queue_head;
677 if (NULL != tc_queue) 682 if (NULL != tc_queue)
678 { 683 {
@@ -892,6 +897,12 @@ shutdown_process (struct GNUNET_OS_Process *proc)
892 GNUNET_OS_process_destroy (proc); 897 GNUNET_OS_process_destroy (proc);
893} 898}
894 899
900static void
901shutdown_peerstore (void *cls)
902{
903 struct GNUNET_OS_Process *proc = cls;
904 shutdown_process (proc);
905}
895 906
896static void 907static void
897shutdown_communicator (void *cls) 908shutdown_communicator (void *cls)
@@ -987,6 +998,38 @@ resolver_start (struct
987 998
988} 999}
989 1000
1001
1002/**
1003 * @brief Start Peerstore
1004 *
1005 */
1006static void
1007peerstore_start (
1008 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
1009{
1010 char *binary;
1011
1012 LOG (GNUNET_ERROR_TYPE_DEBUG, "peerstore_start\n");
1013 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore");
1014 tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_YES,
1015 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1016 NULL,
1017 NULL,
1018 NULL,
1019 binary,
1020 "gnunet-service-peerstore",
1021 "-c",
1022 tc_h->cfg_filename,
1023 NULL);
1024 if (NULL == tc_h->ps_proc)
1025 {
1026 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start Peerstore!");
1027 return;
1028 }
1029 LOG (GNUNET_ERROR_TYPE_INFO, "started Peerstore\n");
1030 GNUNET_free (binary);
1031}
1032
990/** 1033/**
991 * @brief Start NAT 1034 * @brief Start NAT
992 * 1035 *
@@ -1018,7 +1061,6 @@ nat_start (
1018 GNUNET_free (binary); 1061 GNUNET_free (binary);
1019} 1062}
1020 1063
1021
1022/** 1064/**
1023 * @brief Start communicator part of transport service and communicator 1065 * @brief Start communicator part of transport service and communicator
1024 * 1066 *
@@ -1083,6 +1125,8 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
1083 nat_start (tc_h); 1125 nat_start (tc_h);
1084 /* Start resolver service */ 1126 /* Start resolver service */
1085 resolver_start (tc_h); 1127 resolver_start (tc_h);
1128 /* Start peerstore service */
1129 peerstore_start (tc_h);
1086 /* Schedule start communicator */ 1130 /* Schedule start communicator */
1087 communicator_start (tc_h, 1131 communicator_start (tc_h,
1088 binary_name); 1132 binary_name);
@@ -1098,6 +1142,7 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
1098 shutdown_service (tc_h->sh); 1142 shutdown_service (tc_h->sh);
1099 shutdown_nat (tc_h->nat_proc); 1143 shutdown_nat (tc_h->nat_proc);
1100 shutdown_resolver (tc_h->resolver_proc); 1144 shutdown_resolver (tc_h->resolver_proc);
1145 shutdown_peerstore (tc_h->ps_proc);
1101 GNUNET_CONFIGURATION_destroy (tc_h->cfg); 1146 GNUNET_CONFIGURATION_destroy (tc_h->cfg);
1102 GNUNET_free (tc_h); 1147 GNUNET_free (tc_h);
1103} 1148}