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;
2644 uint32_t last_window_consum_limit;
2940 "free_pending_acknowledgement\n");
2949 "remove pa from message\n");
2951 "remove pa from message %llu\n",
2954 "remove pa from message %u\n",
2957 "remove pa from message %s\n",
2988 while (NULL != (frag = root->
head_frag))
2993 while (NULL != (pa = frag->
pa_head))
2999 if (NULL != frag->
qe)
3002 frag->
qe->
pm = NULL;
3032 tc->details.core.pending_msg_head,
3033 tc->details.core.pending_msg_tail,
3036 if ((NULL != vl) && (NULL ==
pm->frag_parent))
3039 "Removing pm %llu\n",
3046 while (NULL != (pa =
pm->pa_head))
3050 "free pending pa null\n");
3051 if (NULL ==
pm->pa_tail)
3053 "free pending pa_tail null\n");
3056 "free pending pa prev null\n");
3059 "free pending pa next null\n");
3070 if (NULL !=
pm->bpm)
3078 "Freeing pm done\n");
3163 "free virtual link %p\n",
3337 "Informing CORE clients about disconnect from %s\n",
3373 if (NULL != (vl =
dv->
vl))
3421 struct GNUNET_TRANSPORT_MonitorData *md;
3422 size_t addr_len = strlen (
address) + 1;
3427 md->nt = htonl ((uint32_t)
nt);
3433 md->cs = htonl ((uint32_t)
me->cs);
3434 md->num_msg_pending = htonl (
me->num_msg_pending);
3435 md->num_bytes_pending = htonl (
me->num_bytes_pending);
3436 memcpy (&md[1],
address, addr_len);
3460 if (
tc->details.monitor.one_shot)
3492 "Client %p of type %u connected\n",
3516 "Freeing neighbour\n");
3517 while (NULL != (dvh = neighbour->
dv_head))
3525 if (NULL != neighbour->
get)
3528 neighbour->
get = NULL;
3530 if (NULL != neighbour->
sc)
3535 neighbour->
sc = NULL;
3537 if (NULL != (
vl = neighbour->
vl))
3551 neighbour->
vl = NULL;
3586 "Informing CORE clients about connection to %s\n",
3617 if (s->tc->details.communicator.address_prefix !=
3618 queue->tc->details.communicator.address_prefix)
3621 "queue address %s qid %u compare with queue: address %s qid %u\n",
3626 if ((s->priority >
queue->priority) && (0 < s->q_capacity) &&
3650 queue->tc->details.communicator.
3654 if (
queue->tc->details.communicator.total_queue_length >=
3658 "Transmission throttled due to communicator queue limit\n");
3661 "# Transmission throttled due to communicator queue limit",
3670 "Transmission throttled due to communicator queue length limit\n");
3672 "# Transmission throttled due to queue queue limit",
3678 if (0 ==
queue->q_capacity)
3681 "Transmission throttled due to communicator message queue qid %u has capacity %"
3686 "# Transmission throttled due to message queue capacity",
3693 if (NULL !=
queue->transmit_task)
3695 queue->transmit_task =
3699 "Considering transmission on queue `%s' QID %llu to %s\n",
3701 (
unsigned long long)
queue->qid,
3722 "Checking if link is down\n");
3730 pos->path_valid_until);
3745 if ((NULL == vl->
n) && (NULL == vl->
dv))
3776 "Cleaning up queue %u\n",
queue->qid);
3777 if (NULL !=
queue->transmit_task)
3780 queue->transmit_task = NULL;
3782 while (NULL != (pa =
queue->pa_head))
3793 tc->details.communicator.queue_head,
3794 tc->details.communicator.queue_tail,
3797 tc->details.communicator.
3798 total_queue_length);
3800 "Cleaning up queue with length %u\n",
3801 queue->queue_length);
3802 while (NULL != (
qe =
queue->queue_head))
3805 queue->queue_length--;
3806 tc->details.communicator.total_queue_length--;
3815 "Cleaning up queue with length %u\n",
3816 queue->queue_length);
3819 tc->details.communicator.total_queue_length))
3824 "# Transmission throttled due to communicator queue limit",
3827 for (
struct Queue *s =
tc->details.communicator.queue_head; NULL != s;
3837 if ((NULL != vl) && (neighbour == vl->
n))
3860 tc->details.communicator.addr_tail,
3862 if (NULL != ale->
sc)
3869 if (NULL != ale->
st)
3932 "Unknown Client %p disconnected, cleaning up.\n",
3938 "CORE Client %p disconnected, cleaning up.\n",
3943 while (NULL != (
pm =
tc->details.core.pending_msg_head))
3946 tc->details.core.pending_msg_head,
3947 tc->details.core.pending_msg_tail,
3956 "MONITOR Client %p disconnected, cleaning up.\n",
3963 "COMMUNICATOR Client %p disconnected, cleaning up.\n",
3969 while (NULL != (
q =
tc->details.communicator.queue_head))
3971 while (NULL != (ale =
tc->details.communicator.addr_head))
3979 "APPLICATION Client %p disconnected, cleaning up.\n",
3992 "Our last client disconnected\n");
4016 "Telling new CORE client about existing connection to %s\n",
4054 "New CORE client with PID %s registered\n",
4111 "client send response\n");
4120 "Confirming transmission of <%llu> to %s\n",
4142 unsigned int hops_array_length)
4144 uint64_t
choices[hops_array_length];
4146 unsigned int dv_count;
4164 if (dv_count <= hops_array_length)
4169 hops_array[dv_count++] = pos;
4172 for (
unsigned int i = 0; i < hops_array_length; i++)
4180 for (
unsigned int j = 0; j < i; j++)
4199 for (
unsigned int i = 0; i < hops_array_length; i++)
4201 hops_array[dv_count++] = pos;
4217 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4228 size = ntohs (cam->header.size) -
sizeof(*cam);
4244 int continue_client)
4246 if (0 != ntohl (cmc->
im.fc_on))
4250 struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
4253 "Acknowledge message with flow control id %" PRIu64
"\n",
4256 ack->reserved = htonl (0);
4257 ack->fc_id = cmc->
im.fc_id;
4258 ack->sender = cmc->
im.neighbour_sender;
4304 "# RECV_OK dropped: virtual link unknown",
4313 "CORE ack receiving message, increased CORE recv window to %u\n",
4319 while (NULL != (cmc = vl->
cmc_tail))
4336 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4341 size = ntohs (cam->header.size) -
sizeof(*cam);
4345 "Receive-only communicator connected\n");
4348 tc->details.communicator.address_prefix =
4350 tc->details.communicator.cc =
4353 "Communicator with prefix `%s' connected\n",
4354 tc->details.communicator.address_prefix);
4369 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
4377 msize = ntohs (cb->header.size) -
sizeof(*cb);
4379 isize = ntohs (inbox->
size);
4385 is = (
const char *) inbox;
4389 if (
'\0' !=
is[msize - 1])
4441 size_t payload_size)
4444 struct GNUNET_TRANSPORT_SendMessageTo *smt;
4450 "Queueing %u bytes of payload for transmission <%llu> on queue %llu to %s\n",
4451 (
unsigned int) payload_size,
4452 (NULL ==
pm) ? 0 :
pm->logging_uuid,
4453 (
unsigned long long)
queue->qid,
4458 smt->qid = htonl (
queue->qid);
4460 smt->receiver = n->
pid;
4461 memcpy (&smt[1],
payload, payload_size);
4469 "Create QueueEntry with MID %" PRIu64
4470 " and QID %u and prefix %s\n",
4473 queue->tc->details.communicator.address_prefix);
4484 "Retransmitting message <%llu> remove pm from qe with MID: %llu \n",
4486 (
unsigned long long)
pm->qe->mid);
4493 if (0 ==
queue->q_capacity)
4498 "Message %llu (pm type %u) was not send because queue has no capacity.\n",
4504 queue->queue_length++;
4505 queue->tc->details.communicator.total_queue_length++;
4507 queue->q_capacity--;
4509 "Queue %s with qid %u has capacity %" PRIu64
"\n",
4514 queue->tc->details.communicator.total_queue_length)
4518 if (0 ==
queue->q_capacity)
4521 if (NULL !=
pm && NULL != (pa =
pm->pa_head))
4523 while (
pm != pa->
pm)
4529 "Sending message MID %" PRIu64
4530 " of type %u (%u) and size %lu with MQ %p QID %u\n",
4533 ntohs (smt->header.size),
4534 (
unsigned long) payload_size,
4558 unsigned int candidates;
4570 for (
struct Queue *pos = n->queue_head; NULL != pos;
4571 pos = pos->next_neighbour)
4574 (pos->validated_until.abs_value_us > now.abs_value_us))
4577 if (0 == candidates)
4582 "Could not route message of type %u to %s: no valid queue\n",
4586 "# route selection failed (all no valid queue)",
4599 for (
struct Queue *pos = n->queue_head; NULL != pos;
4600 pos = pos->next_neighbour)
4603 (pos->validated_until.abs_value_us > now.abs_value_us))
4605 if ((sel1 == candidates) || (sel2 == candidates))
4608 "Routing message of type %u to %s using %s (#%u)\n",
4612 (sel1 == candidates) ? 1 : 2);
4672 sizeof(
key->material),
4673 "transport-backchannel-key",
4674 strlen (
"transport-backchannel-key"),
4681 "Deriving backchannel key based on KM %s and IV %s\n",
4685 GCRY_CIPHER_AES256 ,
4686 GCRY_CIPHER_MODE_CTR,
4689 &
key->material.aes_key,
4690 sizeof(
key->material.aes_key)));
4691 gcry_cipher_setctr (
key->cipher,
4692 &
key->material.aes_ctr,
4693 sizeof(
key->material.aes_ctr));
4785 gcry_cipher_encrypt (
key->cipher, dst, in_size, in, in_size));
4806 gcry_cipher_decrypt (
key->cipher,
4820 gcry_cipher_close (
key->cipher);
4856 unsigned int num_dvhs,
4866 uint16_t enc_body_size = ntohs (hdr->
size);
4882 sizeof(box_hdr.
iv));
4900 for (
unsigned int i = 0; i < num_dvhs; i++)
4903 unsigned int num_hops = dvh->
distance + 1;
4912 box_hdr.
num_hops = htons (num_hops);
4913 memcpy (
buf, &box_hdr,
sizeof(box_hdr));
4924 for (
unsigned int j = 0; j < num_hops; j++)
4933 "Routing message of type %u to %s using DV (#%u/%u) via %s\n",
4942 memcpy (&dhops[num_hops],
enc,
sizeof(
enc));
4998 "Trying to route message of type %u to %s without fc\n",
5018 if ((NULL == n) && (NULL == dv))
5021 "Cannot route message of type %u to %s: no route\n",
5025 "# Messages dropped in routing: no acceptable method",
5031 "Routing message of type %u to %s with options %X\n",
5044 if ((NULL != n) && (NULL != dv))
5052 "Try to route message of type %u to %s without fc via neighbour\n",
5069 "Failed to route message, could not determine DV path\n");
5073 "encapsulate_for_dv 1\n");
5131 "Sending FC seq %u to %s with new window %llu\n",
5151 "FC retransmission to %s failed, will retry in %s\n",
5200 "check_vl_transmission to target %s\n",
5209 "check_vl_transmission loop\n");
5216 "Stalled message %llu transmission on VL %s due to flow control: %llu < %llu\n",
5220 (
unsigned long long) (
pm->bytes_msg
5226 "Target window on VL %s not stalled. Scheduling transmission on queue\n",
5239 "Direct neighbour %s not stalled\n",
5248 "Neighbour Queue QID: %u (%u) busy or invalid\n",
5264 if (pos->path_valid_until.abs_value_us <= now.
abs_value_us)
5274 "Stalled message %llu transmission on next hop %s due to flow control: %llu < %llu\n",
5279 (
unsigned long long) (
pm->bytes_msg
5281 outbound_fc_window_size_used));
5291 "Next hop neighbour %s not stalled\n",
5300 "DV Queue QID: %u (%u) busy or invalid\n",
5308 "Eligible message %llu of size %u to %s: %llu/%llu\n",
5313 (
unsigned long long) (
pm->bytes_msg
5338 bytes_msg = ntohs (obmm->
size);
5344 "Don't have %s as a neighbour (anymore).\n",
5352 "# messages dropped (neighbour unknown)",
5360 "1 created pm %p storing vl %p\n",
5367 pm->bytes_msg = bytes_msg;
5368 memcpy (&
pm[1], obmm, bytes_msg);
5370 "Sending %u bytes as <%llu> to %s\n",
5375 tc->details.core.pending_msg_head,
5376 tc->details.core.pending_msg_tail,
5399 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
5406 uint16_t isize = ntohs (inbox->
size);
5407 const char *
is = ((
const char *) &cb[1]) + isize;
5408 size_t slen = strlen (
is) + 1;
5419 "Preparing backchannel transmission to %s:%s of type %u and size %u\n",
5422 ntohs (inbox->
type),
5423 ntohs (inbox->
size));
5428 memcpy (&be[1], inbox, isize);
5462 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5499 "Failed to store our own address `%s' in peerstore!\n",
5503 "Successfully stored our own address `%s' in peerstore!\n",
5531 "Storing our address `%s' in peerstore until %s!\n",
5551 if (NULL == ale->
sc)
5554 "Failed to store our address `%s' with peerstore\n",
5570 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5578 "Communicator added address `%s'!\n",
5579 (
const char *) &aam[1]);
5580 slen = ntohs (aam->header.size) -
sizeof(*aam);
5583 ale->
address = (
const char *) &ale[1];
5585 ale->
aid = aam->aid;
5587 memcpy (&ale[1], &aam[1], slen);
5589 tc->details.communicator.addr_tail,
5604 const struct GNUNET_TRANSPORT_DelAddressMessage *dam)
5620 if (dam->aid != ale->aid)
5624 "Communicator deleted address `%s'!\n",
5631 "Communicator removed address we did not even have.\n");
5680 unsigned int continue_client)
5682 uint16_t
size = ntohs (
mh->size);
5688 "# CORE messages dropped (FC arithmetic overflow)",
5692 "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n",
5693 (
unsigned int) ntohs (
mh->type),
5694 (
unsigned int) ntohs (
mh->size));
5701 "# CORE messages dropped (FC window overflow)",
5705 "CORE messages of type %u with %u bytes dropped (FC window overflow)\n",
5706 (
unsigned int) ntohs (
mh->type),
5707 (
unsigned int) ntohs (
mh->size));
5731 im->
peer = cmc->
im.sender;
5732 memcpy (&im[1],
mh,
size);
5739 "Dropped message to CORE: no CORE client connected!\n");
5745 "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n",
5746 (
unsigned int) ntohs (
mh->type),
5747 (
unsigned int) ntohs (
mh->size));
5752 "Delivered message from %s of type %u to CORE recv window %u\n",
5784 uint16_t
size = ntohs (
mh->size);
5787 "Handling raw message of type %u with %u bytes\n",
5788 (
unsigned int) ntohs (
mh->type),
5789 (
unsigned int) ntohs (
mh->size));
5825 "Storing message for %s and type %u (%u) in ring buffer\n",
5827 (
unsigned int) ntohs (
mh->type),
5828 (
unsigned int) ntohs (mh_copy->
type));
5838 "%u items stored in ring buffer\n",
5932 "Sending ACK with %u components to %s\n",
5942 for (
unsigned int i = 0; i <
ac->num_acks; i++)
5993 "Scheduling ACK %s for transmission to %s\n",
6001 ac->min_transmission_time = max_delay;
6017 ac->min_transmission_time =
6022 ac->ack_uuids[
ac->num_acks].ack_uuid = *ack_uuid;
6099 "No virtual link for %s to handle fragment\n",
6123 fsize = ntohs (fb->
header.
size) -
sizeof(*fb);
6124 if (NULL == (rc = fc.
rc))
6127 + (msize + 7) / 8 *
sizeof(uint8_t) );
6143 target = (
char *) &rc[1];
6150 "Received fragment with size %u at offset %u/%u %u bytes missing from %s for NEW message %u\n",
6160 target = (
char *) &rc[1];
6162 "Received fragment at offset %u/%u from %s for message %u\n",
6183 if (frag_off + fsize > msize)
6190 memcpy (&target[frag_off], &fb[1], fsize);
6192 for (
unsigned int i = frag_off; i < frag_off + fsize; i++)
6194 if (0 == (rc->
bitfield[i / 8] & (1 << (i % 8))))
6196 rc->
bitfield[i / 8] |= (1 << (i % 8));
6227 "Fragment reassembly complete for message %u\n",
6257 "check_send_msg with size %u: inner msg type %u and size %u (%lu %lu)\n",
6259 ntohs (inbox->
type),
6260 ntohs (inbox->
size),
6285 "Received reliability box from %s with UUID %s of type %u\n",
6288 (
unsigned int) ntohs (inbox->
type));
6346 uint16_t bytes_transmitted_ok)
6350 unsigned int age =
get_age ();
6372 uint16_t bytes_transmitted_ok)
6388 uint16_t bytes_transmitted_ok)
6407 "Complete transmission of message %llu %u\n",
6420 pos =
pm->frag_parent;
6431 pos =
pm->frag_parent;
6454 "Completed transmission of message %llu (DV Box)\n",
6456 if (NULL !=
pm->frag_parent)
6458 if (NULL !=
pm->bpm)
6464 pos =
pm->frag_parent;
6512 unsigned int n_acks;
6515 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6522 if ((ntohs (ra->
header.
size) -
sizeof(*ra)) !=
6545 unsigned int n_acks;
6546 uint32_t ack_counter;
6548 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6551 for (
unsigned int i = 0; i < n_acks; i++)
6558 "Received ACK from %s with UUID %s which is unknown to us!\n",
6563 "# FRAGMENT_ACKS dropped, no matching pending message",
6569 "Received ACK from %s with UUID %s\n",
6607 isize = ntohs (inbox->
size);
6608 is = ((
const char *) inbox) + isize;
6610 if (
'\0' !=
is[
size - 1])
6633 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
6638 uint16_t isize = ntohs (inbox->
size);
6639 const char *target_communicator = ((
const char *) inbox) + isize;
6654 strcmp (
tc->details.communicator.address_prefix, target_communicator)))
6662 "# Backchannel message dropped: target communicator `%s' unknown",
6663 target_communicator);
6671 "Delivering backchannel message from %s to %s of type %u to %s\n",
6674 ntohs (inbox->
type),
6675 target_communicator);
6680 cbi->pid = cmc->
im.sender;
6681 memcpy (&cbi[1], inbox, isize);
6734 struct GNUNET_TRANSPORT_IncomingMessage im;
6740 "Sending from ring buffer, which has %u items\n",
6744 for (
unsigned int i = 0; i <
head; i++)
6753 "Sending to ring buffer target %s using vl target %s\n",
6759 "Finish handling message of type %u and size %u\n",
6760 (
unsigned int) ntohs (
mh->type),
6761 (
unsigned int) ntohs (
mh->size));
6767 ring_buffer_copy[i] = rbe;
6782 "ring_buffer_copy[i]->mh->type for i %u %u\n",
6784 ring_buffer_copy[i]->
mh->type);
6786 "ring_buffer[i]->mh->type for i %u %u\n",
6792 "%u items still in ring buffer\n",
6808 "Sending from ring buffer dv, which has %u items\n",
6812 for (
unsigned int i = 0; i <
head; i++)
6817 "Sending to ring buffer target %s using vl target %s\n",
6823 "Adding PendingMessage to vl, checking transmission.\n");
6834 ring_buffer_dv_copy[i] =
pm;
6848 "%u items still in ring buffer dv.\n",
6874 "Creating new virtual link %p to %s using DV!\n",
6918 "Virtual link to %s could now also use DV!\n",
6951 unsigned int path_len,
6958 unsigned int shorter_distance;
6968 if (NULL == next_hop)
6974 for (
unsigned int i = 2; i < path_len; i++)
6981 "Path of %u hops useless: directly link to hop %u (%s)\n",
6986 "# Useless DV path ignored: hop is neighbour",
6995 dv->
target = path[path_len - 1];
7007 shorter_distance = 0;
7011 if (pos->distance < path_len - 3)
7016 if ((pos->distance == path_len - 3) && (pos->next_hop == next_hop))
7020 for (
unsigned int i = 0; i < pos->distance; i++)
7034 "# Known DV path refreshed",
7040 pos->path_valid_until =
7055 "Rediscovered path too quickly, not forwarding further\n");
7059 "Refreshed known path to %s valid until %s, forwarding further\n",
7062 pos->path_valid_until));
7073 "Have many shorter DV paths %s, not forwarding further\n",
7079 "Discovered new DV path to %s valid until %s\n",
7116 uint16_t num_hops = ntohs (dvl->
num_hops);
7130 for (
unsigned int i = 0; i < num_hops; i++)
7161 uint16_t bi_history,
7176 "Forwarding DV learn message originating from %s to %s\n",
7187 msg->non_network_delay));
7199 .purpose.size = htonl (
sizeof(dhp)),
7200 .pred = (0 == nhops) ?
msg->initiator : dhops[nhops - 1].
hop,
7202 .challenge =
msg->challenge
7206 &dhops[nhops].hop_sig);
7249 .purpose.size = htonl (
sizeof(ip)),
7250 .monotonic_time = sender_monotonic_time,
7332 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7359 "transmission %s\n",
7364 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7431 unsigned int neighbour_count,
7432 unsigned int eligible_count)
7434 double target_total = 50.0;
7435 double eligible_ratio =
7436 ((double) eligible_count) / ((double) neighbour_count);
7437 double boost_factor = eligible_ratio * eligible_ratio;
7441 if (hops_taken >= 64)
7446 for (
unsigned int i = 1; i < hops_taken; i++)
7450 target_total -= (target_total * boost_factor / (1LLU << i));
7453 (
unsigned int) floor (target_total * boost_factor / (1LLU << hops_taken));
7456 left = target_total - (double) rnd;
7457 if (UINT32_MAX * left >
7461 "Forwarding DV learn message of %u hops %u(/%u/%u) times\n",