aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2021-02-23 22:30:15 +0100
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-02-23 22:30:15 +0100
commit64c18a74e38a1cb74042d14a4211622a3bde3bee (patch)
tree8cd226c21f2e40902e252139196998f00445d726 /src/transport
parentd528f6cfbe5e99a7e50e28d76b90654ecb955d9a (diff)
downloadgnunet-64c18a74e38a1cb74042d14a4211622a3bde3bee.tar.gz
gnunet-64c18a74e38a1cb74042d14a4211622a3bde3bee.zip
-flurry of bugfixes for tng service
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/Makefile.am2
-rw-r--r--src/transport/gnunet-service-tng.c97
-rw-r--r--src/transport/test_transport_api2_tcp_peer1.conf1
-rw-r--r--src/transport/test_transport_api2_tcp_peer2.conf1
-rw-r--r--src/transport/test_transport_api_tcp_peer1.conf2
-rw-r--r--src/transport/test_transport_api_tcp_peer2.conf2
-rw-r--r--src/transport/transport-testing2.c2
7 files changed, 79 insertions, 28 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 67b35365d..a1ffbdb5c 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -954,7 +954,7 @@ test_transport_api_tcp_LDADD = \
954 libgnunettransporttesting.la 954 libgnunettransporttesting.la
955 955
956test_transport_api2_tcp_SOURCES = \ 956test_transport_api2_tcp_SOURCES = \
957 test_transport_api.c 957 test_transport_api2.c
958test_transport_api2_tcp_LDADD = \ 958test_transport_api2_tcp_LDADD = \
959 libgnunettransport.la \ 959 libgnunettransport.la \
960 $(top_builddir)/src/hello/libgnunethello.la \ 960 $(top_builddir)/src/hello/libgnunethello.la \
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 9c37f15e2..7e1953663 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -2693,12 +2693,12 @@ static struct GNUNET_CONTAINER_MultiShortmap *dvlearn_map;
2693/** 2693/**
2694 * Head of a DLL sorted by launch time. 2694 * Head of a DLL sorted by launch time.
2695 */ 2695 */
2696static struct LearnLaunchEntry *lle_head; 2696static struct LearnLaunchEntry *lle_head = NULL;
2697 2697
2698/** 2698/**
2699 * Tail of a DLL sorted by launch time. 2699 * Tail of a DLL sorted by launch time.
2700 */ 2700 */
2701static struct LearnLaunchEntry *lle_tail; 2701static struct LearnLaunchEntry *lle_tail = NULL;
2702 2702
2703/** 2703/**
2704 * MIN Heap sorted by "next_challenge" to `struct ValidationState` entries 2704 * MIN Heap sorted by "next_challenge" to `struct ValidationState` entries
@@ -3497,13 +3497,17 @@ check_link_down (void *cls)
3497 3497
3498 vl->visibility_task = NULL; 3498 vl->visibility_task = NULL;
3499 dvh_timeout = GNUNET_TIME_UNIT_ZERO_ABS; 3499 dvh_timeout = GNUNET_TIME_UNIT_ZERO_ABS;
3500 for (struct DistanceVectorHop *pos = dv->dv_head; NULL != pos; 3500 if (NULL != dv)
3501 pos = pos->next_dv)
3502 dvh_timeout = GNUNET_TIME_absolute_max (dvh_timeout, pos->path_valid_until);
3503 if (0 == GNUNET_TIME_absolute_get_remaining (dvh_timeout).rel_value_us)
3504 { 3501 {
3505 vl->dv->vl = NULL; 3502 for (struct DistanceVectorHop *pos = dv->dv_head; NULL != pos;
3506 vl->dv = NULL; 3503 pos = pos->next_dv)
3504 dvh_timeout = GNUNET_TIME_absolute_max (dvh_timeout,
3505 pos->path_valid_until);
3506 if (0 == GNUNET_TIME_absolute_get_remaining (dvh_timeout).rel_value_us)
3507 {
3508 vl->dv->vl = NULL;
3509 vl->dv = NULL;
3510 }
3507 } 3511 }
3508 q_timeout = GNUNET_TIME_UNIT_ZERO_ABS; 3512 q_timeout = GNUNET_TIME_UNIT_ZERO_ABS;
3509 for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour) 3513 for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour)
@@ -4702,6 +4706,24 @@ route_control_message_without_fc (const struct GNUNET_PeerIdentity *target,
4702} 4706}
4703 4707
4704 4708
4709static void
4710consider_sending_fc (void *cls);
4711
4712/**
4713 * Something changed on the virtual link with respect to flow
4714 * control. Consider retransmitting the FC window size.
4715 *
4716 * @param cls a `struct VirtualLink` to work with
4717 */
4718static void
4719task_consider_sending_fc (void *cls)
4720{
4721 struct VirtualLink *vl = cls;
4722 vl->fc_retransmit_task = NULL;
4723 consider_sending_fc (cls);
4724}
4725
4726
4705/** 4727/**
4706 * Something changed on the virtual link with respect to flow 4728 * Something changed on the virtual link with respect to flow
4707 * control. Consider retransmitting the FC window size. 4729 * control. Consider retransmitting the FC window size.
@@ -4759,7 +4781,7 @@ consider_sending_fc (void *cls)
4759 if (NULL != vl->fc_retransmit_task) 4781 if (NULL != vl->fc_retransmit_task)
4760 GNUNET_SCHEDULER_cancel (vl->fc_retransmit_task); 4782 GNUNET_SCHEDULER_cancel (vl->fc_retransmit_task);
4761 vl->fc_retransmit_task = 4783 vl->fc_retransmit_task =
4762 GNUNET_SCHEDULER_add_delayed (rtt, &consider_sending_fc, vl); 4784 GNUNET_SCHEDULER_add_delayed (rtt, &task_consider_sending_fc, vl);
4763} 4785}
4764 4786
4765 4787
@@ -7637,7 +7659,7 @@ start_address_validation (const struct GNUNET_PeerIdentity *pid,
7637 validation_map, 7659 validation_map,
7638 &vs->pid, 7660 &vs->pid,
7639 vs, 7661 vs,
7640 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 7662 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
7641 update_next_challenge_time (vs, now); 7663 update_next_challenge_time (vs, now);
7642} 7664}
7643 7665
@@ -7674,6 +7696,8 @@ handle_hello_for_incoming (void *cls,
7674} 7696}
7675 7697
7676 7698
7699
7700
7677/** 7701/**
7678 * Communicator gave us a transport address validation challenge. Process the 7702 * Communicator gave us a transport address validation challenge. Process the
7679 * request. 7703 * request.
@@ -7730,13 +7754,23 @@ handle_validation_challenge (
7730 &tvp, 7754 &tvp,
7731 &tvr.signature); 7755 &tvr.signature);
7732 } 7756 }
7733 route_control_message_without_fc (&cmc->im.sender,
7734 &tvr.header,
7735 RMO_ANYTHING_GOES | RMO_REDUNDANT);
7736 sender = cmc->im.sender; 7757 sender = cmc->im.sender;
7737 finish_cmc_handling (cmc);
7738 vl = lookup_virtual_link (&sender); 7758 vl = lookup_virtual_link (&sender);
7739 if (NULL != vl) 7759 if (NULL != vl)
7760 {
7761 route_control_message_without_fc (&cmc->im.sender,
7762 &tvr.header,
7763 RMO_ANYTHING_GOES | RMO_REDUNDANT);
7764 } else {
7765 /* Use route via neighbour */
7766 n = lookup_neighbour (&sender);
7767 if (NULL != n)
7768 for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour)
7769 queue_send_msg (q, NULL, &tvr, sizeof(tvr));
7770 }
7771
7772 finish_cmc_handling (cmc);
7773 if (NULL != vl)
7740 return; 7774 return;
7741 7775
7742 /* For us, the link is still down, but we need bi-directional 7776 /* For us, the link is still down, but we need bi-directional
@@ -8149,41 +8183,41 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
8149 { GNUNET_MQ_hd_var_size (fragment_box, 8183 { GNUNET_MQ_hd_var_size (fragment_box,
8150 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT, 8184 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT,
8151 struct TransportFragmentBoxMessage, 8185 struct TransportFragmentBoxMessage,
8152 &cmc), 8186 cmc),
8153 GNUNET_MQ_hd_var_size (reliability_box, 8187 GNUNET_MQ_hd_var_size (reliability_box,
8154 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX, 8188 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX,
8155 struct TransportReliabilityBoxMessage, 8189 struct TransportReliabilityBoxMessage,
8156 &cmc), 8190 cmc),
8157 GNUNET_MQ_hd_var_size (reliability_ack, 8191 GNUNET_MQ_hd_var_size (reliability_ack,
8158 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK, 8192 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK,
8159 struct TransportReliabilityAckMessage, 8193 struct TransportReliabilityAckMessage,
8160 &cmc), 8194 cmc),
8161 GNUNET_MQ_hd_var_size (backchannel_encapsulation, 8195 GNUNET_MQ_hd_var_size (backchannel_encapsulation,
8162 GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION, 8196 GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION,
8163 struct TransportBackchannelEncapsulationMessage, 8197 struct TransportBackchannelEncapsulationMessage,
8164 &cmc), 8198 cmc),
8165 GNUNET_MQ_hd_var_size (dv_learn, 8199 GNUNET_MQ_hd_var_size (dv_learn,
8166 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN, 8200 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN,
8167 struct TransportDVLearnMessage, 8201 struct TransportDVLearnMessage,
8168 &cmc), 8202 cmc),
8169 GNUNET_MQ_hd_var_size (dv_box, 8203 GNUNET_MQ_hd_var_size (dv_box,
8170 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX, 8204 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX,
8171 struct TransportDVBoxMessage, 8205 struct TransportDVBoxMessage,
8172 &cmc), 8206 cmc),
8173 GNUNET_MQ_hd_fixed_size ( 8207 GNUNET_MQ_hd_fixed_size (
8174 validation_challenge, 8208 validation_challenge,
8175 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE, 8209 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE,
8176 struct TransportValidationChallengeMessage, 8210 struct TransportValidationChallengeMessage,
8177 &cmc), 8211 cmc),
8178 GNUNET_MQ_hd_fixed_size (flow_control, 8212 GNUNET_MQ_hd_fixed_size (flow_control,
8179 GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL, 8213 GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL,
8180 struct TransportFlowControlMessage, 8214 struct TransportFlowControlMessage,
8181 &cmc), 8215 cmc),
8182 GNUNET_MQ_hd_fixed_size ( 8216 GNUNET_MQ_hd_fixed_size (
8183 validation_response, 8217 validation_response,
8184 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, 8218 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE,
8185 struct TransportValidationResponseMessage, 8219 struct TransportValidationResponseMessage,
8186 &cmc), 8220 cmc),
8187 GNUNET_MQ_handler_end () }; 8221 GNUNET_MQ_handler_end () };
8188 int ret; 8222 int ret;
8189 8223
@@ -8202,7 +8236,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
8202 if (GNUNET_NO == ret) 8236 if (GNUNET_NO == ret)
8203 { 8237 {
8204 /* unencapsulated 'raw' message */ 8238 /* unencapsulated 'raw' message */
8205 handle_raw_message (&cmc, msg); 8239 handle_raw_message (cmc, msg);
8206 } 8240 }
8207} 8241}
8208 8242
@@ -8949,20 +8983,30 @@ handle_send_message_ack (void *cls,
8949 8983
8950 /* find our queue entry matching the ACK */ 8984 /* find our queue entry matching the ACK */
8951 qe = NULL; 8985 qe = NULL;
8986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8987 "Looking for queue for PID %s\n",
8988 GNUNET_i2s (&sma->receiver));
8952 for (struct Queue *queue = tc->details.communicator.queue_head; NULL != queue; 8989 for (struct Queue *queue = tc->details.communicator.queue_head; NULL != queue;
8953 queue = queue->next_client) 8990 queue = queue->next_client)
8954 { 8991 {
8955 if (0 != GNUNET_memcmp (&queue->neighbour->pid, &sma->receiver)) 8992 if (0 != GNUNET_memcmp (&queue->neighbour->pid, &sma->receiver))
8956 continue; 8993 continue;
8994 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8995 "Found PID %s\n",
8996 GNUNET_i2s (&queue->neighbour->pid));
8997
8998
8957 for (struct QueueEntry *qep = queue->queue_head; NULL != qep; 8999 for (struct QueueEntry *qep = queue->queue_head; NULL != qep;
8958 qep = qep->next) 9000 qep = qep->next)
8959 { 9001 {
9002 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9003 "QueueEntry MID: %lu, Ack MID: %lu\n",
9004 qep->mid, sma->mid);
8960 if (qep->mid != sma->mid) 9005 if (qep->mid != sma->mid)
8961 continue; 9006 continue;
8962 qe = qep; 9007 qe = qep;
8963 break; 9008 break;
8964 } 9009 }
8965 break;
8966 } 9010 }
8967 if (NULL == qe) 9011 if (NULL == qe)
8968 { 9012 {
@@ -9333,6 +9377,7 @@ start_dv_learn (void *cls)
9333 return; /* lost all connectivity, cannot do learning */ 9377 return; /* lost all connectivity, cannot do learning */
9334 qqc.quality_count = 0; 9378 qqc.quality_count = 0;
9335 qqc.num_queues = 0; 9379 qqc.num_queues = 0;
9380 qqc.k = GNUNET_CONTAINER_multipeermap_size (neighbours);
9336 GNUNET_CONTAINER_multipeermap_iterate (neighbours, 9381 GNUNET_CONTAINER_multipeermap_iterate (neighbours,
9337 &check_connection_quality, 9382 &check_connection_quality,
9338 &qqc); 9383 &qqc);
@@ -9352,7 +9397,7 @@ start_dv_learn (void *cls)
9352 return; 9397 return;
9353 } 9398 }
9354 /* remove old entries in #dvlearn_map if it has grown too big */ 9399 /* remove old entries in #dvlearn_map if it has grown too big */
9355 while (MAX_DV_LEARN_PENDING >= 9400 while (MAX_DV_LEARN_PENDING <=
9356 GNUNET_CONTAINER_multishortmap_size (dvlearn_map)) 9401 GNUNET_CONTAINER_multishortmap_size (dvlearn_map))
9357 { 9402 {
9358 lle = lle_tail; 9403 lle = lle_tail;
diff --git a/src/transport/test_transport_api2_tcp_peer1.conf b/src/transport/test_transport_api2_tcp_peer1.conf
index 5b5fcb55b..36e00c00f 100644
--- a/src/transport/test_transport_api2_tcp_peer1.conf
+++ b/src/transport/test_transport_api2_tcp_peer1.conf
@@ -5,6 +5,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
5[transport] 5[transport]
6BINARY = gnunet-service-tng 6BINARY = gnunet-service-tng
7PLUGINS = tcp 7PLUGINS = tcp
8PREFIX = valgrind --log-file=/tmp/vg_peer1-%p
8 9
9[communicator-tcp] 10[communicator-tcp]
10BINARY = gnunet-communicator-tcp 11BINARY = gnunet-communicator-tcp
diff --git a/src/transport/test_transport_api2_tcp_peer2.conf b/src/transport/test_transport_api2_tcp_peer2.conf
index 42d7c7b7e..f4de8df8b 100644
--- a/src/transport/test_transport_api2_tcp_peer2.conf
+++ b/src/transport/test_transport_api2_tcp_peer2.conf
@@ -4,6 +4,7 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
4 4
5[transport] 5[transport]
6BINARY = gnunet-service-tng 6BINARY = gnunet-service-tng
7PREFIX = valgrind --log-file=/tmp/vg_peer2-%p
7 8
8[communicator-tcp] 9[communicator-tcp]
9BINARY = gnunet-communicator-tcp 10BINARY = gnunet-communicator-tcp
diff --git a/src/transport/test_transport_api_tcp_peer1.conf b/src/transport/test_transport_api_tcp_peer1.conf
index eabd6b701..1a46cf227 100644
--- a/src/transport/test_transport_api_tcp_peer1.conf
+++ b/src/transport/test_transport_api_tcp_peer1.conf
@@ -4,6 +4,8 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/
4 4
5[transport] 5[transport]
6PLUGINS = tcp 6PLUGINS = tcp
7PREFIX = valgrind --log-file=/tmp/vg_peer1
8START_ON_DEMAND = NO
7 9
8#[transport] 10#[transport]
9#PREFIX = valgrind 11#PREFIX = valgrind
diff --git a/src/transport/test_transport_api_tcp_peer2.conf b/src/transport/test_transport_api_tcp_peer2.conf
index 58ce0777f..934fe460f 100644
--- a/src/transport/test_transport_api_tcp_peer2.conf
+++ b/src/transport/test_transport_api_tcp_peer2.conf
@@ -4,6 +4,8 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/
4 4
5[transport] 5[transport]
6PLUGINS = tcp 6PLUGINS = tcp
7PREFIX = valgrind --log-file=/tmp/vg_peer2
8START_ON_DEMAND = NO
7 9
8#[transport] 10#[transport]
9#PREFIX = valgrind 11#PREFIX = valgrind
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index d9f1d5e56..23173e763 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -536,7 +536,7 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct
536 p->ah = GNUNET_TRANSPORT_application_init (p->cfg); 536 p->ah = GNUNET_TRANSPORT_application_init (p->cfg);
537 GNUNET_assert (NULL != p->ah); 537 GNUNET_assert (NULL != p->ah);
538 // FIXME Error handleing 538 // FIXME Error handleing
539 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 539 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
540 retrieve_hello, 540 retrieve_hello,
541 p); 541 p);
542 //GNUNET_assert (NULL != p->pic); 542 //GNUNET_assert (NULL != p->pic);