81 #include "gnunet_signatures.h"
87 #define RING_BUFFER_SIZE 16
92 #define MAX_FC_RETRANSMIT_COUNT 1000
98 #define MAX_CUMMULATIVE_ACKS 64
112 #define FC_NO_CHANGE_REPLY_PROBABILITY 8
118 #define IN_PACKET_SIZE_WITHOUT_MTU 128
124 #define GOODPUT_AGING_SLOTS 4
130 #define DEFAULT_WINDOW_SIZE (128 * 1024)
140 #define MAX_INCOMING_REQUEST 16
146 #define MAX_DV_DISCOVERY_SELECTION 16
156 #define RECV_WINDOW_SIZE 4
165 #define MIN_DV_PATH_LENGTH_FOR_INITIATOR 3
170 #define MAX_DV_HOPS_ALLOWED 16
176 #define MAX_DV_LEARN_PENDING 64
181 #define MAX_DV_PATHS_TO_TARGET 3
188 #define DELAY_WARN_THRESHOLD \
189 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
195 #define DV_FORWARD_TIMEOUT \
196 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
201 #define DEFAULT_ACK_WAIT_DURATION \
202 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
209 #define DV_QUALITY_RTT_THRESHOLD \
210 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
216 #define DV_PATH_VALIDITY_TIMEOUT \
217 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
223 #define BACKCHANNEL_INACTIVITY_TIMEOUT \
224 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
230 #define DV_PATH_DISCOVERY_FREQUENCY \
231 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4)
236 #define EPHEMERAL_VALIDITY \
237 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
242 #define REASSEMBLY_EXPIRATION \
243 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4)
249 #define FAST_VALIDATION_CHALLENGE_FREQ \
250 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
255 #define MAX_VALIDATION_CHALLENGE_FREQ \
256 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_DAYS, 1)
263 #define ACK_CUMMULATOR_TIMEOUT \
264 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
270 #define DV_LEARN_BASE_FREQUENCY GNUNET_TIME_UNIT_MINUTES
276 #define DV_LEARN_QUALITY_THRESHOLD 100
281 #define MAX_ADDRESS_VALID_UNTIL \
282 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MONTHS, 1)
287 #define ADDRESS_VALIDATION_LIFETIME \
288 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
296 #define MIN_DELAY_ADDRESS_VALIDATION GNUNET_TIME_UNIT_MILLISECONDS
304 #define VALIDATION_RTT_BUFFER_FACTOR 3
312 #define COMMUNICATOR_TOTAL_QUEUE_LIMIT 512
319 #define QUEUE_LENGTH_LIMIT 32
1183 struct GNUNET_TRANSPORT_IncomingMessage
im;
2629 uint32_t last_window_consum_limit;
2925 "free_pending_acknowledgement\n");
2934 "remove pa from message\n");
2936 "remove pa from message %llu\n",
2939 "remove pa from message %u\n",
2942 "remove pa from message %s\n",
2973 while (NULL != (frag = root->
head_frag))
2978 while (NULL != (pa = frag->
pa_head))
2984 if (NULL != frag->
qe)
2987 frag->
qe->
pm = NULL;
2993 "Removing QueueEntry MID %lu from queue\n",
3025 tc->details.core.pending_msg_head,
3026 tc->details.core.pending_msg_tail,
3029 if ((NULL != vl) && (NULL ==
pm->frag_parent))
3032 "Removing pm %llu\n",
3039 while (NULL != (pa =
pm->pa_head))
3043 "free pending pa null\n");
3044 if (NULL ==
pm->pa_tail)
3046 "free pending pa_tail null\n");
3049 "free pending pa prev null\n");
3052 "free pending pa next null\n");
3063 pm->qe->queue->queue_tail,
3065 pm->qe->queue->queue_length--;
3067 "Removing QueueEntry MID %lu from queue\n",
3071 "QueueEntry MID freed\n");
3073 if (NULL !=
pm->bpm)
3081 "Freeing pm done\n");
3166 "free virtual link %p\n",
3340 "Informing CORE clients about disconnect from %s\n",
3376 if (NULL != (vl =
dv->
vl))
3424 struct GNUNET_TRANSPORT_MonitorData *md;
3425 size_t addr_len = strlen (
address) + 1;
3430 md->nt = htonl ((uint32_t)
nt);
3436 md->cs = htonl ((uint32_t)
me->cs);
3437 md->num_msg_pending = htonl (
me->num_msg_pending);
3438 md->num_bytes_pending = htonl (
me->num_bytes_pending);
3439 memcpy (&md[1],
address, addr_len);
3463 if (
tc->details.monitor.one_shot)
3495 "Client %p of type %u connected\n",
3519 "Freeing neighbour\n");
3520 while (NULL != (dvh = neighbour->
dv_head))
3528 if (NULL != neighbour->
get)
3531 neighbour->
get = NULL;
3533 if (NULL != neighbour->
sc)
3538 neighbour->
sc = NULL;
3540 if (NULL != (
vl = neighbour->
vl))
3554 neighbour->
vl = NULL;
3589 "Informing CORE clients about connection to %s\n",
3620 if (s->tc->details.communicator.address_prefix !=
3621 queue->tc->details.communicator.address_prefix)
3624 "queue address %s qid %u compare with queue: address %s qid %u\n",
3629 if ((s->priority >
queue->priority) && (0 < s->q_capacity) &&
3653 queue->tc->details.communicator.
3657 if (
queue->tc->details.communicator.total_queue_length >=
3661 "Transmission throttled due to communicator queue limit\n");
3664 "# Transmission throttled due to communicator queue limit",
3673 "Transmission throttled due to communicator queue length limit\n");
3675 "# Transmission throttled due to queue queue limit",
3681 if (0 ==
queue->q_capacity)
3684 "Transmission throttled due to communicator message queue qid %u has capacity %lu.\n",
3688 "# Transmission throttled due to message queue capacity",
3695 if (NULL !=
queue->transmit_task)
3697 queue->transmit_task =
3701 "Considering transmission on queue `%s' QID %llu to %s\n",
3703 (
unsigned long long)
queue->qid,
3724 "Checking if link is down\n");
3732 pos->path_valid_until);
3747 if ((NULL == vl->
n) && (NULL == vl->
dv))
3778 "Cleaning up queue %u\n",
queue->qid);
3779 if (NULL !=
queue->transmit_task)
3782 queue->transmit_task = NULL;
3784 while (NULL != (pa =
queue->pa_head))
3795 tc->details.communicator.queue_head,
3796 tc->details.communicator.queue_tail,
3799 tc->details.communicator.
3800 total_queue_length);
3802 "Cleaning up queue with length %u\n",
3803 queue->queue_length);
3804 while (NULL != (
qe =
queue->queue_head))
3807 queue->queue_length--;
3808 tc->details.communicator.total_queue_length--;
3817 "Cleaning up queue with length %u\n",
3818 queue->queue_length);
3821 tc->details.communicator.total_queue_length))
3826 "# Transmission throttled due to communicator queue limit",
3829 for (
struct Queue *s =
tc->details.communicator.queue_head; NULL != s;
3839 if ((NULL != vl) && (neighbour == vl->
n))
3862 tc->details.communicator.addr_tail,
3864 if (NULL != ale->
sc)
3871 if (NULL != ale->
st)
3934 "Unknown Client %p disconnected, cleaning up.\n",
3940 "CORE Client %p disconnected, cleaning up.\n",
3945 while (NULL != (
pm =
tc->details.core.pending_msg_head))
3948 tc->details.core.pending_msg_head,
3949 tc->details.core.pending_msg_tail,
3958 "MONITOR Client %p disconnected, cleaning up.\n",
3965 "COMMUNICATOR Client %p disconnected, cleaning up.\n",
3971 while (NULL != (
q =
tc->details.communicator.queue_head))
3973 while (NULL != (ale =
tc->details.communicator.addr_head))
3981 "APPLICATION Client %p disconnected, cleaning up.\n",
3994 "Our last client disconnected\n");
4018 "Telling new CORE client about existing connection to %s\n",
4056 "New CORE client with PID %s registered\n",
4113 "client send response\n");
4122 "Confirming transmission of <%llu> to %s\n",
4144 unsigned int hops_array_length)
4146 uint64_t
choices[hops_array_length];
4148 unsigned int dv_count;
4166 if (dv_count <= hops_array_length)
4171 hops_array[dv_count++] = pos;
4174 for (
unsigned int i = 0; i < hops_array_length; i++)
4182 for (
unsigned int j = 0; j < i; j++)
4201 for (
unsigned int i = 0; i < hops_array_length; i++)
4203 hops_array[dv_count++] = pos;
4219 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4230 size = ntohs (cam->header.size) -
sizeof(*cam);
4246 int continue_client)
4248 if (0 != ntohl (cmc->
im.fc_on))
4252 struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
4255 "Acknowledge message with flow control id %lu\n",
4258 ack->reserved = htonl (0);
4259 ack->fc_id = cmc->
im.fc_id;
4260 ack->sender = cmc->
im.neighbour_sender;
4306 "# RECV_OK dropped: virtual link unknown",
4315 "CORE ack receiving message, increased CORE recv window to %u\n",
4320 while (NULL != (cmc = vl->
cmc_tail))
4338 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4343 size = ntohs (cam->header.size) -
sizeof(*cam);
4347 "Receive-only communicator connected\n");
4350 tc->details.communicator.address_prefix =
4352 tc->details.communicator.cc =
4355 "Communicator with prefix `%s' connected\n",
4356 tc->details.communicator.address_prefix);
4371 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
4379 msize = ntohs (cb->header.size) -
sizeof(*cb);
4381 isize = ntohs (inbox->
size);
4387 is = (
const char *) inbox;
4391 if (
'\0' !=
is[msize - 1])
4443 size_t payload_size)
4446 struct GNUNET_TRANSPORT_SendMessageTo *smt;
4451 "Queueing %u bytes of payload for transmission <%llu> on queue %llu to %s\n",
4452 (
unsigned int) payload_size,
4453 (NULL ==
pm) ? 0 :
pm->logging_uuid,
4454 (
unsigned long long)
queue->qid,
4459 smt->qid =
queue->qid;
4460 smt->mid =
queue->mid_gen;
4461 smt->receiver = n->
pid;
4462 memcpy (&smt[1],
payload, payload_size);
4478 "Retransmitting message <%llu> remove pm from qe with MID: %llu \n",
4480 (
unsigned long long)
pm->qe->mid);
4487 queue->queue_length++;
4488 queue->tc->details.communicator.total_queue_length++;
4491 if (0 ==
queue->q_capacity)
4497 queue->q_capacity--;
4499 "Queue %s with qid %u has capacity %lu\n",
4504 queue->tc->details.communicator.total_queue_length)
4508 if (0 ==
queue->q_capacity)
4511 "Sending message MID %lu of type %u (%u) and size %lu with MQ %p\n",
4514 ntohs (smt->header.size),
4538 unsigned int candidates;
4550 for (
struct Queue *pos = n->queue_head; NULL != pos;
4551 pos = pos->next_neighbour)
4554 (pos->validated_until.abs_value_us > now.abs_value_us))
4557 if (0 == candidates)
4562 "Could not route message of type %u to %s: no valid queue\n",
4566 "# route selection failed (all no valid queue)",
4579 for (
struct Queue *pos = n->queue_head; NULL != pos;
4580 pos = pos->next_neighbour)
4583 (pos->validated_until.abs_value_us > now.abs_value_us))
4585 if ((sel1 == candidates) || (sel2 == candidates))
4588 "Routing message of type %u to %s using %s (#%u)\n",
4592 (sel1 == candidates) ? 1 : 2);
4652 sizeof(
key->material),
4653 "transport-backchannel-key",
4654 strlen (
"transport-backchannel-key"),
4661 "Deriving backchannel key based on KM %s and IV %s\n",
4665 GCRY_CIPHER_AES256 ,
4666 GCRY_CIPHER_MODE_CTR,
4669 &
key->material.aes_key,
4670 sizeof(
key->material.aes_key)));
4671 gcry_cipher_setctr (
key->cipher,
4672 &
key->material.aes_ctr,
4673 sizeof(
key->material.aes_ctr));
4765 gcry_cipher_encrypt (
key->cipher, dst, in_size, in, in_size));
4786 gcry_cipher_decrypt (
key->cipher,
4800 gcry_cipher_close (
key->cipher);
4836 unsigned int num_dvhs,
4846 uint16_t enc_body_size = ntohs (hdr->
size);
4862 sizeof(box_hdr.
iv));
4880 for (
unsigned int i = 0; i < num_dvhs; i++)
4883 unsigned int num_hops = dvh->
distance + 1;
4892 box_hdr.
num_hops = htons (num_hops);
4893 memcpy (
buf, &box_hdr,
sizeof(box_hdr));
4904 for (
unsigned int j = 0; j < num_hops; j++)
4913 "Routing message of type %u to %s using DV (#%u/%u) via %s\n",
4922 memcpy (&dhops[num_hops],
enc,
sizeof(
enc));
4978 "Trying to route message of type %u to %s without fc\n",
4998 if ((NULL == n) && (NULL == dv))
5001 "Cannot route message of type %u to %s: no route\n",
5005 "# Messages dropped in routing: no acceptable method",
5011 "Routing message of type %u to %s with options %X\n",
5024 if ((NULL != n) && (NULL != dv))
5032 "Try to route message of type %u to %s without fc via neighbour\n",
5049 "Failed to route message, could not determine DV path\n");
5053 "encapsulate_for_dv 1\n");
5111 "Sending FC seq %u to %s with new window %llu\n",
5129 "FC retransmission to %s failed, will retry in %s\n",
5178 "check_vl_transmission to target %s\n",
5187 "check_vl_transmission loop\n");
5194 "Stalled message %llu transmission on VL %s due to flow control: %llu < %llu\n",
5198 (
unsigned long long) (
pm->bytes_msg
5204 "Target window on VL %s not stalled. Scheduling transmission on queue\n",
5217 "Direct neighbour %s not stalled\n",
5226 "Neighbour Queue QID: %u (%u) busy or invalid\n",
5242 if (pos->path_valid_until.abs_value_us <= now.
abs_value_us)
5252 "Stalled message %llu transmission on next hop %s due to flow control: %llu < %llu\n",
5257 (
unsigned long long) (
pm->bytes_msg
5259 outbound_fc_window_size_used));
5269 "Next hop neighbour %s not stalled\n",
5278 "DV Queue QID: %u (%u) busy or invalid\n",
5286 "Eligible message %llu of size %u to %s: %llu/%llu\n",
5291 (
unsigned long long) (
pm->bytes_msg
5316 bytes_msg = ntohs (obmm->
size);
5322 "Don't have %s as a neighbour (anymore).\n",
5330 "# messages dropped (neighbour unknown)",
5338 "1 created pm %p storing vl %p\n",
5345 pm->bytes_msg = bytes_msg;
5346 memcpy (&
pm[1], obmm, bytes_msg);
5348 "Sending %u bytes as <%llu> to %s\n",
5353 tc->details.core.pending_msg_head,
5354 tc->details.core.pending_msg_tail,
5377 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
5384 uint16_t isize = ntohs (inbox->
size);
5385 const char *
is = ((
const char *) &cb[1]) + isize;
5386 size_t slen = strlen (
is) + 1;
5397 "Preparing backchannel transmission to %s:%s of type %u and size %u\n",
5400 ntohs (inbox->
type),
5401 ntohs (inbox->
size));
5406 memcpy (&be[1], inbox, isize);
5440 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5477 "Failed to store our own address `%s' in peerstore!\n",
5481 "Successfully stored our own address `%s' in peerstore!\n",
5509 "Storing our address `%s' in peerstore until %s!\n",
5529 if (NULL == ale->
sc)
5532 "Failed to store our address `%s' with peerstore\n",
5548 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5556 "Communicator added address `%s'!\n",
5557 (
const char *) &aam[1]);
5558 slen = ntohs (aam->header.size) -
sizeof(*aam);
5561 ale->
address = (
const char *) &ale[1];
5563 ale->
aid = aam->aid;
5565 memcpy (&ale[1], &aam[1], slen);
5567 tc->details.communicator.addr_tail,
5582 const struct GNUNET_TRANSPORT_DelAddressMessage *dam)
5598 if (dam->aid != ale->aid)
5602 "Communicator deleted address `%s'!\n",
5609 "Communicator removed address we did not even have.\n");
5658 unsigned int continue_client)
5660 uint16_t
size = ntohs (
mh->size);
5666 "# CORE messages dropped (FC arithmetic overflow)",
5670 "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n",
5671 (
unsigned int) ntohs (
mh->type),
5672 (
unsigned int) ntohs (
mh->size));
5679 "# CORE messages dropped (FC window overflow)",
5683 "CORE messages of type %u with %u bytes dropped (FC window overflow)\n",
5684 (
unsigned int) ntohs (
mh->type),
5685 (
unsigned int) ntohs (
mh->size));
5709 im->
peer = cmc->
im.sender;
5710 memcpy (&im[1],
mh,
size);
5717 "Dropped message to CORE: no CORE client connected!\n");
5723 "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n",
5724 (
unsigned int) ntohs (
mh->type),
5725 (
unsigned int) ntohs (
mh->size));
5730 "Delivered message from %s of type %u to CORE recv window %u\n",
5763 uint16_t
size = ntohs (
mh->size);
5766 "Handling raw message of type %u with %u bytes\n",
5767 (
unsigned int) ntohs (
mh->type),
5768 (
unsigned int) ntohs (
mh->size));
5804 "Storing message for %s and type %u (%u) in ring buffer\n",
5806 (
unsigned int) ntohs (
mh->type),
5807 (
unsigned int) ntohs (mh_copy->
type));
5817 "%u items stored in ring buffer\n",
5911 "Sending ACK with %u components to %s\n",
5921 for (
unsigned int i = 0; i <
ac->num_acks; i++)
5972 "Scheduling ACK %s for transmission to %s\n",
5980 ac->min_transmission_time = max_delay;
5996 ac->min_transmission_time =
6001 ac->ack_uuids[
ac->num_acks].ack_uuid = *ack_uuid;
6078 "No virtual link for %s to handle fragment\n",
6102 fsize = ntohs (fb->
header.
size) -
sizeof(*fb);
6103 if (NULL == (rc = fc.
rc))
6106 + (msize + 7) / 8 *
sizeof(uint8_t) );
6122 target = (
char *) &rc[1];
6129 "Received fragment with size %u at offset %u/%u %u bytes missing from %s for NEW message %u\n",
6139 target = (
char *) &rc[1];
6141 "Received fragment at offset %u/%u from %s for message %u\n",
6162 if (frag_off + fsize > msize)
6169 memcpy (&target[frag_off], &fb[1], fsize);
6171 for (
unsigned int i = frag_off; i < frag_off + fsize; i++)
6173 if (0 == (rc->
bitfield[i / 8] & (1 << (i % 8))))
6175 rc->
bitfield[i / 8] |= (1 << (i % 8));
6206 "Fragment reassembly complete for message %u\n",
6236 "check_send_msg with size %u: inner msg type %u and size %u (%lu %lu)\n",
6238 ntohs (inbox->
type),
6239 ntohs (inbox->
size),
6264 "Received reliability box from %s with UUID %s of type %u\n",
6267 (
unsigned int) ntohs (inbox->
type));
6325 uint16_t bytes_transmitted_ok)
6329 unsigned int age =
get_age ();
6351 uint16_t bytes_transmitted_ok)
6367 uint16_t bytes_transmitted_ok)
6386 "Complete transmission of message %llu %u\n",
6399 pos =
pm->frag_parent;
6407 pos =
pm->frag_parent;
6430 "Completed transmission of message %llu (DV Box)\n",
6432 if (NULL !=
pm->frag_parent)
6434 if (NULL !=
pm->bpm)
6440 pos =
pm->frag_parent;
6470 if (NULL != pa->
queue)
6472 if (NULL != pa->
dvh)
6491 unsigned int n_acks;
6494 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6501 if ((ntohs (ra->
header.
size) -
sizeof(*ra)) !=
6524 unsigned int n_acks;
6525 uint32_t ack_counter;
6527 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6530 for (
unsigned int i = 0; i < n_acks; i++)
6537 "Received ACK from %s with UUID %s which is unknown to us!\n",
6542 "# FRAGMENT_ACKS dropped, no matching pending message",
6548 "Received ACK from %s with UUID %s\n",
6586 isize = ntohs (inbox->
size);
6587 is = ((
const char *) inbox) + isize;
6589 if (
'\0' !=
is[
size - 1])
6612 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
6617 uint16_t isize = ntohs (inbox->
size);
6618 const char *target_communicator = ((
const char *) inbox) + isize;
6633 strcmp (
tc->details.communicator.address_prefix, target_communicator)))
6641 "# Backchannel message dropped: target communicator `%s' unknown",
6642 target_communicator);
6650 "Delivering backchannel message from %s to %s of type %u to %s\n",
6653 ntohs (inbox->
type),
6654 target_communicator);
6659 cbi->pid = cmc->
im.sender;
6660 memcpy (&cbi[1], inbox, isize);
6712 struct GNUNET_TRANSPORT_IncomingMessage im;
6718 "Sending from ring buffer, which has %u items\n",
6722 for (
unsigned int i = 0; i <
head; i++)
6731 "Sending to ring buffer target %s using vl target %s\n",
6737 "Finish handling message of type %u and size %u\n",
6738 (
unsigned int) ntohs (
mh->type),
6739 (
unsigned int) ntohs (
mh->size));
6745 ring_buffer_copy[i] = rbe;
6760 "ring_buffer_copy[i]->mh->type for i %u %u\n",
6762 ring_buffer_copy[i]->
mh->type);
6764 "ring_buffer[i]->mh->type for i %u %u\n",
6770 "%u items still in ring buffer\n",
6786 "Sending from ring buffer dv, which has %u items\n",
6790 for (
unsigned int i = 0; i <
head; i++)
6795 "Sending to ring buffer target %s using vl target %s\n",
6801 "Adding PendingMessage to vl, checking transmission.\n");
6812 ring_buffer_dv_copy[i] =
pm;
6826 "%u items still in ring buffer dv.\n",
6852 "Creating new virtual link %p to %s using DV!\n",
6896 "Virtual link to %s could now also use DV!\n",
6929 unsigned int path_len,
6936 unsigned int shorter_distance;
6946 if (NULL == next_hop)
6952 for (
unsigned int i = 2; i < path_len; i++)
6959 "Path of %u hops useless: directly link to hop %u (%s)\n",
6964 "# Useless DV path ignored: hop is neighbour",
6973 dv->
target = path[path_len - 1];
6985 shorter_distance = 0;
6989 if (pos->distance < path_len - 3)
6994 if ((pos->distance == path_len - 3) && (pos->next_hop == next_hop))
6998 for (
unsigned int i = 0; i < pos->distance; i++)
7012 "# Known DV path refreshed",
7018 pos->path_valid_until =
7033 "Rediscovered path too quickly, not forwarding further\n");
7037 "Refreshed known path to %s valid until %s, forwarding further\n",
7040 pos->path_valid_until));
7051 "Have many shorter DV paths %s, not forwarding further\n",
7057 "Discovered new DV path to %s valid until %s\n",
7094 uint16_t num_hops = ntohs (dvl->
num_hops);
7108 for (
unsigned int i = 0; i < num_hops; i++)
7139 uint16_t bi_history,
7154 "Forwarding DV learn message originating from %s to %s\n",
7165 msg->non_network_delay));
7177 .purpose.size = htonl (
sizeof(dhp)),
7178 .pred = (0 == nhops) ?
msg->initiator : dhops[nhops - 1].
hop,
7180 .challenge =
msg->challenge
7184 &dhops[nhops].hop_sig);
7227 .purpose.size = htonl (
sizeof(ip)),
7228 .monotonic_time = sender_monotonic_time,
7310 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7337 "transmission %s\n",
7342 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7409 unsigned int neighbour_count,
7410 unsigned int eligible_count)
7412 double target_total = 50.0;
7413 double eligible_ratio =
7414 ((double) eligible_count) / ((double) neighbour_count);
7415 double boost_factor = eligible_ratio * eligible_ratio;
7419 if (hops_taken >= 64)
7424 for (
unsigned int i = 1; i < hops_taken; i++)
7428 target_total -= (target_total * boost_factor / (1LLU << i));
7431 (
unsigned int) floor (target_total * boost_factor / (1LLU << hops_taken));
7434 left = target_total - (double) rnd;
7435 if (UINT32_MAX * left >
7439 "Forwarding DV learn message of %u hops %u(/%u/%u) times\n",