aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-11-09 17:38:47 +0100
committert3sserakt <t3ss@posteo.de>2021-11-09 17:43:25 +0100
commit8cd4dadfb9ebd4db232fda79d5c4353eacb15690 (patch)
treea063e52d71d1b6611371f6c129c6ae1b0215cf99 /src/transport/gnunet-service-tng.c
parent6fb788ca2ec44837ea10a36be7fd0030fb08955b (diff)
downloadgnunet-8cd4dadfb9ebd4db232fda79d5c4353eacb15690.tar.gz
gnunet-8cd4dadfb9ebd4db232fda79d5c4353eacb15690.zip
- moved global netjail methods to its own header file.dev/t3ss/tng
- added configuration by string in test skript instead of config file. - moved netjail scripts to contrib/netjail and install them into the share/gnunet directory.
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c80
1 files changed, 71 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index a90bef3b5..84199a75f 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -4738,15 +4738,17 @@ send_dv_to_neighbour (void *cls,
4738 * @return expected RTT for transmission, #GNUNET_TIME_UNIT_FOREVER_REL if sending failed 4738 * @return expected RTT for transmission, #GNUNET_TIME_UNIT_FOREVER_REL if sending failed
4739 */ 4739 */
4740static struct GNUNET_TIME_Relative 4740static struct GNUNET_TIME_Relative
4741route_control_message_without_fc (const struct GNUNET_PeerIdentity *target, 4741route_control_message_without_fc (struct VirtualLink *vl,
4742// route_control_message_without_fc (const struct GNUNET_PeerIdentity *target,
4742 const struct GNUNET_MessageHeader *hdr, 4743 const struct GNUNET_MessageHeader *hdr,
4743 enum RouteMessageOptions options) 4744 enum RouteMessageOptions options)
4744{ 4745{
4745 struct VirtualLink *vl; 4746 // struct VirtualLink *vl;
4746 struct Neighbour *n; 4747 struct Neighbour *n;
4747 struct DistanceVector *dv; 4748 struct DistanceVector *dv;
4748 struct GNUNET_TIME_Relative rtt1; 4749 struct GNUNET_TIME_Relative rtt1;
4749 struct GNUNET_TIME_Relative rtt2; 4750 struct GNUNET_TIME_Relative rtt2;
4751 const struct GNUNET_PeerIdentity *target = &vl->target;
4750 4752
4751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4753 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4752 "Trying to route message of type %u to %s without fc\n", 4754 "Trying to route message of type %u to %s without fc\n",
@@ -4754,7 +4756,7 @@ route_control_message_without_fc (const struct GNUNET_PeerIdentity *target,
4754 GNUNET_i2s (target)); 4756 GNUNET_i2s (target));
4755 4757
4756 // TODO Do this elsewhere. vl should be given as parameter to method. 4758 // TODO Do this elsewhere. vl should be given as parameter to method.
4757 vl = lookup_virtual_link (target); 4759 // vl = lookup_virtual_link (target);
4758 GNUNET_assert (NULL != vl); 4760 GNUNET_assert (NULL != vl);
4759 if (NULL == vl) 4761 if (NULL == vl)
4760 return GNUNET_TIME_UNIT_FOREVER_REL; 4762 return GNUNET_TIME_UNIT_FOREVER_REL;
@@ -4892,7 +4894,7 @@ consider_sending_fc (void *cls)
4892 fc.outbound_sent = GNUNET_htonll (vl->outbound_fc_window_size_used); 4894 fc.outbound_sent = GNUNET_htonll (vl->outbound_fc_window_size_used);
4893 fc.outbound_window_size = GNUNET_htonll (vl->outbound_fc_window_size); 4895 fc.outbound_window_size = GNUNET_htonll (vl->outbound_fc_window_size);
4894 fc.sender_time = GNUNET_TIME_absolute_hton (monotime); 4896 fc.sender_time = GNUNET_TIME_absolute_hton (monotime);
4895 rtt = route_control_message_without_fc (&vl->target, &fc.header, RMO_NONE); 4897 rtt = route_control_message_without_fc (vl, &fc.header, RMO_NONE);
4896 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == rtt.rel_value_us) 4898 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == rtt.rel_value_us)
4897 { 4899 {
4898 rtt = GNUNET_TIME_UNIT_SECONDS; 4900 rtt = GNUNET_TIME_UNIT_SECONDS;
@@ -5086,6 +5088,8 @@ handle_communicator_backchannel (
5086 void *cls, 5088 void *cls,
5087 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb) 5089 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
5088{ 5090{
5091 struct Neighbour *n;
5092 struct VirtualLink *vl;
5089 struct TransportClient *tc = cls; 5093 struct TransportClient *tc = cls;
5090 const struct GNUNET_MessageHeader *inbox = 5094 const struct GNUNET_MessageHeader *inbox =
5091 (const struct GNUNET_MessageHeader *) &cb[1]; 5095 (const struct GNUNET_MessageHeader *) &cb[1];
@@ -5116,7 +5120,22 @@ handle_communicator_backchannel (
5116 + isize], 5120 + isize],
5117 is, 5121 is,
5118 strlen (is) + 1); 5122 strlen (is) + 1);
5119 route_control_message_without_fc (&cb->pid, &be->header, RMO_DV_ALLOWED); 5123 // route_control_message_without_fc (&cb->pid, &be->header, RMO_DV_ALLOWED);
5124 vl = lookup_virtual_link (&cb->pid);
5125 if (NULL != vl)
5126 {
5127 route_control_message_without_fc (vl, &be->header, RMO_DV_ALLOWED);
5128 }
5129 else
5130 {
5131 /* Use route via neighbour */
5132 n = lookup_neighbour (&cb->pid);
5133 if (NULL != n)
5134 route_via_neighbour (
5135 n,
5136 &be->header,
5137 RMO_NONE);
5138 }
5120 GNUNET_SERVICE_client_continue (tc->client); 5139 GNUNET_SERVICE_client_continue (tc->client);
5121} 5140}
5122 5141
@@ -5540,6 +5559,8 @@ destroy_ack_cummulator (void *cls)
5540static void 5559static void
5541transmit_cummulative_ack_cb (void *cls) 5560transmit_cummulative_ack_cb (void *cls)
5542{ 5561{
5562 struct Neighbour *n;
5563 struct VirtualLink *vl;
5543 struct AcknowledgementCummulator *ac = cls; 5564 struct AcknowledgementCummulator *ac = cls;
5544 char buf[sizeof(struct TransportReliabilityAckMessage) 5565 char buf[sizeof(struct TransportReliabilityAckMessage)
5545 + ac->ack_counter 5566 + ac->ack_counter
@@ -5566,7 +5587,28 @@ transmit_cummulative_ack_cb (void *cls)
5566 ap[i].ack_delay = GNUNET_TIME_relative_hton ( 5587 ap[i].ack_delay = GNUNET_TIME_relative_hton (
5567 GNUNET_TIME_absolute_get_duration (ac->ack_uuids[i].receive_time)); 5588 GNUNET_TIME_absolute_get_duration (ac->ack_uuids[i].receive_time));
5568 } 5589 }
5569 route_control_message_without_fc (&ac->target, &ack->header, RMO_DV_ALLOWED); 5590 /*route_control_message_without_fc (
5591 &ac->target,
5592 &ack->header,
5593 RMO_DV_ALLOWED);*/
5594 vl = lookup_virtual_link (&ac->target);
5595 if (NULL != vl)
5596 {
5597 route_control_message_without_fc (
5598 vl,
5599 &ack->header,
5600 RMO_DV_ALLOWED);
5601 }
5602 else
5603 {
5604 /* Use route via neighbour */
5605 n = lookup_neighbour (&ac->target);
5606 if (NULL != n)
5607 route_via_neighbour (
5608 n,
5609 &ack->header,
5610 RMO_NONE);
5611 }
5570 ac->num_acks = 0; 5612 ac->num_acks = 0;
5571 ac->task = GNUNET_SCHEDULER_add_delayed (ACK_CUMMULATOR_TIMEOUT, 5613 ac->task = GNUNET_SCHEDULER_add_delayed (ACK_CUMMULATOR_TIMEOUT,
5572 &destroy_ack_cummulator, 5614 &destroy_ack_cummulator,
@@ -6558,6 +6600,8 @@ forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
6558 const struct DVPathEntryP *hops, 6600 const struct DVPathEntryP *hops,
6559 struct GNUNET_TIME_Absolute in_time) 6601 struct GNUNET_TIME_Absolute in_time)
6560{ 6602{
6603 struct Neighbour *n;
6604 struct VirtualLink *vl;
6561 struct DVPathEntryP *dhops; 6605 struct DVPathEntryP *dhops;
6562 char buf[sizeof(struct TransportDVLearnMessage) 6606 char buf[sizeof(struct TransportDVLearnMessage)
6563 + (nhops + 1) * sizeof(struct DVPathEntryP)] GNUNET_ALIGN; 6607 + (nhops + 1) * sizeof(struct DVPathEntryP)] GNUNET_ALIGN;
@@ -6598,9 +6642,26 @@ forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
6598 &dhp, 6642 &dhp,
6599 &dhops[nhops].hop_sig); 6643 &dhops[nhops].hop_sig);
6600 } 6644 }
6601 route_control_message_without_fc (next_hop, 6645 /*route_control_message_without_fc (next_hop,
6602 &fwd->header, 6646 &fwd->header,
6603 RMO_UNCONFIRMED_ALLOWED); 6647 RMO_UNCONFIRMED_ALLOWED);*/
6648 vl = lookup_virtual_link (next_hop);
6649 if (NULL != vl)
6650 {
6651 route_control_message_without_fc (vl,
6652 &fwd->header,
6653 RMO_UNCONFIRMED_ALLOWED);
6654 }
6655 else
6656 {
6657 /* Use route via neighbour */
6658 n = lookup_neighbour (next_hop);
6659 if (NULL != n)
6660 route_via_neighbour (
6661 n,
6662 &fwd->header,
6663 RMO_UNCONFIRMED_ALLOWED);
6664 }
6604} 6665}
6605 6666
6606 6667
@@ -7937,7 +7998,8 @@ handle_validation_challenge (
7937 vl = lookup_virtual_link (&sender); 7998 vl = lookup_virtual_link (&sender);
7938 if (NULL != vl) 7999 if (NULL != vl)
7939 { 8000 {
7940 route_control_message_without_fc (&cmc->im.sender, 8001 // route_control_message_without_fc (&cmc->im.sender,
8002 route_control_message_without_fc (vl,
7941 &tvr.header, 8003 &tvr.header,
7942 RMO_ANYTHING_GOES | RMO_REDUNDANT); 8004 RMO_ANYTHING_GOES | RMO_REDUNDANT);
7943 } 8005 }