aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2022-10-04 14:28:51 +0200
committert3sserakt <t3ss@posteo.de>2022-10-05 13:23:32 +0200
commit247230d737e3e4709392148bfabbde25871b6914 (patch)
treec18f51cafb00b9436af050fffbc7d56d3f09bf95 /src/transport
parentb47e578091e7451fd5c98cc56447d0fadba15b00 (diff)
downloadgnunet-247230d737e3e4709392148bfabbde25871b6914.tar.gz
gnunet-247230d737e3e4709392148bfabbde25871b6914.zip
- Added distance vector inverse path test case.
- Enhanced port forwarding configuration to restrict port forwarding to specific source IPs. - Add configuration for counting additional connections per peer. - Added caching for Core Messages, if confirmed virtual link is missing. - Added caching for DV forwarding, if confirmed virtual link is missing. - Fixed bug in fragmentation logic. - Fixed bug in queueing logic. - Fixed bug in flow control logic. - Fixed Bug with lifetime of DV learn message. (Validation against replay attack still missing) - removed make warnings - fixed coverty findings
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/Makefile.am4
-rw-r--r--src/transport/gnunet-communicator-tcp.c37
-rw-r--r--src/transport/gnunet-communicator-udp.c6
-rw-r--r--src/transport/gnunet-service-tng.c565
-rw-r--r--src/transport/test_transport_distance_vector_circle_topo.conf1
-rw-r--r--src/transport/test_transport_distance_vector_inverse_topo.conf13
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c20
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_dv.c2
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_circle.sh1
-rwxr-xr-xsrc/transport/test_transport_simple_send_dv_inverse.sh11
-rw-r--r--src/transport/transport.h5
-rw-r--r--src/transport/transport_api2_communication.c25
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c45
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c24
-rw-r--r--src/transport/transport_api_cmd_send_simple.c42
-rw-r--r--src/transport/transport_api_cmd_start_peer.c11
16 files changed, 566 insertions, 246 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 2b09ccf63..773fa2877 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -780,8 +780,8 @@ check_SCRIPTS= \
780 test_transport_simple_send.sh \ 780 test_transport_simple_send.sh \
781 test_transport_simple_send_broadcast.sh \ 781 test_transport_simple_send_broadcast.sh \
782 test_transport_udp_backchannel.sh \ 782 test_transport_udp_backchannel.sh \
783 test_transport_simple_send_dv_circle.sh 783 test_transport_simple_send_dv_circle.sh \
784 # test_transport_simple_send_dv_inverse.sh 784 test_transport_simple_send_dv_inverse.sh
785endif 785endif
786 786
787test_transport_start_with_config_SOURCES = \ 787test_transport_start_with_config_SOURCES = \
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index be75fa0e8..1161ac73a 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -1340,10 +1340,11 @@ do_rekey (struct Queue *queue, const struct TCPRekey *rekey)
1340 GNUNET_TIME_absolute_ntoh (thp.monotonic_time))); 1340 GNUNET_TIME_absolute_ntoh (thp.monotonic_time)));
1341 GNUNET_assert (ntohl ((&thp)->purpose.size) == sizeof (*(&thp))); 1341 GNUNET_assert (ntohl ((&thp)->purpose.size) == sizeof (*(&thp)));
1342 if (GNUNET_OK != 1342 if (GNUNET_OK !=
1343 GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY, 1343 GNUNET_CRYPTO_eddsa_verify (
1344 &thp, 1344 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY,
1345 &rekey->sender_sig, 1345 &thp,
1346 &queue->target.public_key)) 1346 &rekey->sender_sig,
1347 &queue->target.public_key))
1347 { 1348 {
1348 GNUNET_break (0); 1349 GNUNET_break (0);
1349 queue_finish (queue); 1350 queue_finish (queue);
@@ -1447,7 +1448,8 @@ handshake_ack_monotime_cb (void *cls,
1447 * @param queue The queue context. 1448 * @param queue The queue context.
1448 */ 1449 */
1449static void 1450static void
1450send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct Queue *queue) 1451send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct
1452 Queue *queue)
1451{ 1453{
1452 struct TCPConfirmationAck tca; 1454 struct TCPConfirmationAck tca;
1453 struct TcpHandshakeAckSignature thas; 1455 struct TcpHandshakeAckSignature thas;
@@ -1605,7 +1607,11 @@ queue_write (void *cls)
1605 } 1607 }
1606 /* can we encrypt more? (always encrypt full messages, needed 1608 /* can we encrypt more? (always encrypt full messages, needed
1607 such that #mq_cancel() can work!) */ 1609 such that #mq_cancel() can work!) */
1608 if ((0 < queue->rekey_left_bytes) && 1610 unsigned int we_do_not_need_to_rekey = (0 < queue->rekey_left_bytes
1611 - (queue->cwrite_off
1612 + queue->pwrite_off
1613 + sizeof (struct TCPRekey)));
1614 if (we_do_not_need_to_rekey &&
1609 (queue->pwrite_off > 0) && 1615 (queue->pwrite_off > 0) &&
1610 (queue->cwrite_off + queue->pwrite_off <= BUF_SIZE)) 1616 (queue->cwrite_off + queue->pwrite_off <= BUF_SIZE))
1611 { 1617 {
@@ -1625,11 +1631,11 @@ queue_write (void *cls)
1625 queue->pwrite_off = 0; 1631 queue->pwrite_off = 0;
1626 } 1632 }
1627 // if ((-1 != unverified_size)&& ((0 == queue->pwrite_off) && 1633 // if ((-1 != unverified_size)&& ((0 == queue->pwrite_off) &&
1628 if (((0 == queue->pwrite_off) && 1634 if (((0 == queue->rekey_left_bytes) ||
1629 ((0 == queue->rekey_left_bytes) || 1635 (0 == GNUNET_TIME_absolute_get_remaining (
1630 (0 == 1636 queue->rekey_time).rel_value_us)) &&
1631 GNUNET_TIME_absolute_get_remaining ( 1637 (((0 == queue->pwrite_off) || ! we_do_not_need_to_rekey)&&
1632 queue->rekey_time).rel_value_us)))) 1638 (queue->cwrite_off + sizeof (struct TCPRekey) <= BUF_SIZE)))
1633 { 1639 {
1634 inject_rekey (queue); 1640 inject_rekey (queue);
1635 } 1641 }
@@ -2272,8 +2278,9 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2272 struct sockaddr_in6 v6; 2278 struct sockaddr_in6 v6;
2273 char *start; 2279 char *start;
2274 2280
2281 memset (&v4, 0, sizeof(v4));
2275 start = extract_address (bindto); 2282 start = extract_address (bindto);
2276 // FIXME: check NULL == start 2283 GNUNET_assert (NULL != start);
2277 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2278 "start %s\n", 2285 "start %s\n",
2279 start); 2286 start);
@@ -2472,7 +2479,8 @@ transmit_kx (struct Queue *queue,
2472 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 2479 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
2473 &tc.challenge, 2480 &tc.challenge,
2474 sizeof(tc.challenge)); 2481 sizeof(tc.challenge));
2475 ths.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE); 2482 ths.purpose.purpose = htonl (
2483 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
2476 ths.purpose.size = htonl (sizeof(ths)); 2484 ths.purpose.size = htonl (sizeof(ths));
2477 ths.sender = my_identity; 2485 ths.sender = my_identity;
2478 ths.receiver = queue->target; 2486 ths.receiver = queue->target;
@@ -2625,7 +2633,8 @@ decrypt_and_check_tc (struct Queue *queue,
2625 sizeof(*tc), 2633 sizeof(*tc),
2626 &ibuf[sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)], 2634 &ibuf[sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)],
2627 sizeof(*tc))); 2635 sizeof(*tc)));
2628 ths.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE); 2636 ths.purpose.purpose = htonl (
2637 GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
2629 ths.purpose.size = htonl (sizeof(ths)); 2638 ths.purpose.size = htonl (sizeof(ths));
2630 ths.sender = tc->sender; 2639 ths.sender = tc->sender;
2631 ths.receiver = my_identity; 2640 ths.receiver = my_identity;
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 70848ff79..07beeac38 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1723,7 +1723,7 @@ try_handle_plaintext (struct SenderAddress *sender,
1723 uint16_t type; 1723 uint16_t type;
1724 1724
1725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1726 "try_handle_plaintext of size %u (%u %u) and type %u\n", 1726 "try_handle_plaintext of size %lu (%u %lu) and type %u\n",
1727 buf_size, 1727 buf_size,
1728 ntohs (hdr->size), 1728 ntohs (hdr->size),
1729 sizeof(*hdr), 1729 sizeof(*hdr),
@@ -2394,6 +2394,7 @@ sock_read (void *cls)
2394 GNUNET_i2s (&sender)); 2394 GNUNET_i2s (&sender));
2395 GNUNET_TRANSPORT_application_validate (ah, &sender, nt, addr_s); 2395 GNUNET_TRANSPORT_application_validate (ah, &sender, nt, addr_s);
2396 GNUNET_free (addr_s); 2396 GNUNET_free (addr_s);
2397 GNUNET_free (addr_verify);
2397 return; 2398 return;
2398 } 2399 }
2399 else 2400 else
@@ -2589,6 +2590,8 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2589 { 2590 {
2590 /* try IPv4 */ 2591 /* try IPv4 */
2591 struct sockaddr_in v4; 2592 struct sockaddr_in v4;
2593
2594 memset (&v4, 0, sizeof(v4));
2592 if (1 == inet_pton (AF_INET, cp, &v4.sin_addr)) 2595 if (1 == inet_pton (AF_INET, cp, &v4.sin_addr))
2593 { 2596 {
2594 v4.sin_family = AF_INET; 2597 v4.sin_family = AF_INET;
@@ -2607,6 +2610,7 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2607 struct sockaddr_in6 v6; 2610 struct sockaddr_in6 v6;
2608 const char *start; 2611 const char *start;
2609 2612
2613 memset (&v6, 0, sizeof(v6));
2610 start = cp; 2614 start = cp;
2611 if (('[' == *cp) && (']' == cp[strlen (cp) - 1])) 2615 if (('[' == *cp) && (']' == cp[strlen (cp) - 1]))
2612 { 2616 {
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 18ec0aa0b..783047a5b 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -82,6 +82,11 @@
82#include "transport.h" 82#include "transport.h"
83 83
84/** 84/**
85 * Size of ring buffer to cache CORE and forwarded DVBox messages.
86 */
87#define RING_BUFFER_SIZE 16
88
89/**
85 * Maximum number of FC retransmissions for a runing retransmission task. 90 * Maximum number of FC retransmissions for a runing retransmission task.
86 */ 91 */
87#define MAX_FC_RETRANSMIT_COUNT 1000 92#define MAX_FC_RETRANSMIT_COUNT 1000
@@ -1181,6 +1186,11 @@ struct CommunicatorMessageContext
1181 struct GNUNET_TRANSPORT_IncomingMessage im; 1186 struct GNUNET_TRANSPORT_IncomingMessage im;
1182 1187
1183 /** 1188 /**
1189 * The message to demultiplex.
1190 */
1191 const struct GNUNET_MessageHeader *mh;
1192
1193 /**
1184 * Number of hops the message has travelled (if DV-routed). 1194 * Number of hops the message has travelled (if DV-routed).
1185 * FIXME: make use of this in ACK handling! 1195 * FIXME: make use of this in ACK handling!
1186 */ 1196 */
@@ -1189,6 +1199,23 @@ struct CommunicatorMessageContext
1189 1199
1190 1200
1191/** 1201/**
1202 * Entry for the ring buffer caching messages send to core, when virtual link is avaliable.
1203 **/
1204struct RingBufferEntry
1205{
1206 /**
1207 * Communicator context for this ring buffer entry.
1208 **/
1209 struct CommunicatorMessageContext *cmc;
1210
1211 /**
1212 * The message in this entry.
1213 **/
1214 struct GNUNET_MessageHeader *mh;
1215};
1216
1217
1218/**
1192 * Closure for #core_env_sent_cb. 1219 * Closure for #core_env_sent_cb.
1193 */ 1220 */
1194struct CoreSentContext 1221struct CoreSentContext
@@ -2168,10 +2195,16 @@ struct PendingMessage
2168 2195
2169 /** 2196 /**
2170 * Target of the request (always the ultimate destination!). 2197 * Target of the request (always the ultimate destination!).
2198 * Might be NULL in case of a forwarded DVBox we have no validated neighbour.
2171 */ 2199 */
2172 struct VirtualLink *vl; 2200 struct VirtualLink *vl;
2173 2201
2174 /** 2202 /**
2203 * In case of a not validated neighbour, we store the target peer.
2204 **/
2205 struct GNUNET_PeerIdentity target;
2206
2207 /**
2175 * Set to non-NULL value if this message is currently being given to a 2208 * Set to non-NULL value if this message is currently being given to a
2176 * communicator and we are awaiting that communicator's acknowledgement. 2209 * communicator and we are awaiting that communicator's acknowledgement.
2177 * Note that we must not retransmit a pending message while we're still 2210 * Note that we must not retransmit a pending message while we're still
@@ -2669,6 +2702,36 @@ struct Backtalker
2669 2702
2670 2703
2671/** 2704/**
2705 * Ring buffer for a CORE message we did not deliver to CORE, because of missing virtual link to sender.
2706 */
2707static struct RingBufferEntry *ring_buffer[RING_BUFFER_SIZE];
2708
2709/**
2710 * Head of the ring buffer.
2711 */
2712static unsigned int ring_buffer_head;
2713
2714/**
2715 * Is the ring buffer filled up to RING_BUFFER_SIZE.
2716 */
2717static unsigned int is_ring_buffer_full;
2718
2719/**
2720 * Ring buffer for a forwarded DVBox message we did not deliver to the next hop, because of missing virtual link that hop.
2721 */
2722static struct PendingMessage *ring_buffer_dv[RING_BUFFER_SIZE];
2723
2724/**
2725 * Head of the ring buffer.
2726 */
2727static unsigned int ring_buffer_dv_head;
2728
2729/**
2730 * Is the ring buffer filled up to RING_BUFFER_SIZE.
2731 */
2732static unsigned int is_ring_buffer_dv_full;
2733
2734/**
2672 * Head of linked list of all clients to this service. 2735 * Head of linked list of all clients to this service.
2673 */ 2736 */
2674static struct TransportClient *clients_head; 2737static struct TransportClient *clients_head;
@@ -2778,18 +2841,6 @@ static struct GNUNET_SCHEDULER_Task *dvlearn_task;
2778static struct GNUNET_SCHEDULER_Task *validation_task; 2841static struct GNUNET_SCHEDULER_Task *validation_task;
2779 2842
2780/** 2843/**
2781 * The most recent PA we have created, head of DLL.
2782 * The length of the DLL is kept in #pa_count.
2783 */
2784static struct PendingAcknowledgement *pa_head;
2785
2786/**
2787 * The oldest PA we have created, tail of DLL.
2788 * The length of the DLL is kept in #pa_count.
2789 */
2790static struct PendingAcknowledgement *pa_tail;
2791
2792/**
2793 * List of incoming connections where we are trying 2844 * List of incoming connections where we are trying
2794 * to get a connection back established. Length 2845 * to get a connection back established. Length
2795 * kept in #ir_total. 2846 * kept in #ir_total.
@@ -2812,12 +2863,6 @@ static unsigned int ir_total;
2812static unsigned long long logging_uuid_gen; 2863static unsigned long long logging_uuid_gen;
2813 2864
2814/** 2865/**
2815 * Number of entries in the #pa_head/#pa_tail DLL. Used to
2816 * limit the size of the data structure.
2817 */
2818static unsigned int pa_count;
2819
2820/**
2821 * Monotonic time we use for HELLOs generated at this time. TODO: we 2866 * Monotonic time we use for HELLOs generated at this time. TODO: we
2822 * should increase this value from time to time (i.e. whenever a 2867 * should increase this value from time to time (i.e. whenever a
2823 * `struct AddressListEntry` actually expires), but IF we do this, we 2868 * `struct AddressListEntry` actually expires), but IF we do this, we
@@ -2949,8 +2994,9 @@ free_fragment_tree (struct PendingMessage *root)
2949 GNUNET_CONTAINER_DLL_remove (frag->qe->queue->queue_head, 2994 GNUNET_CONTAINER_DLL_remove (frag->qe->queue->queue_head,
2950 frag->qe->queue->queue_tail, 2995 frag->qe->queue->queue_tail,
2951 frag->qe); 2996 frag->qe);
2997 frag->qe->queue->queue_length--;
2952 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2998 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2953 "Removing QueueEntry MID %llu from queue\n", 2999 "Removing QueueEntry MID %lu from queue\n",
2954 frag->qe->mid); 3000 frag->qe->mid);
2955 GNUNET_free (frag->qe); 3001 GNUNET_free (frag->qe);
2956 } 3002 }
@@ -2989,7 +3035,7 @@ free_pending_message (struct PendingMessage *pm)
2989 if ((NULL != vl) && (NULL == pm->frag_parent)) 3035 if ((NULL != vl) && (NULL == pm->frag_parent))
2990 { 3036 {
2991 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3037 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2992 "Removing pm %lu\n", 3038 "Removing pm %llu\n",
2993 pm->logging_uuid); 3039 pm->logging_uuid);
2994 GNUNET_CONTAINER_MDLL_remove (vl, 3040 GNUNET_CONTAINER_MDLL_remove (vl,
2995 vl->pending_msg_head, 3041 vl->pending_msg_head,
@@ -3022,20 +3068,23 @@ free_pending_message (struct PendingMessage *pm)
3022 GNUNET_CONTAINER_DLL_remove (pm->qe->queue->queue_head, 3068 GNUNET_CONTAINER_DLL_remove (pm->qe->queue->queue_head,
3023 pm->qe->queue->queue_tail, 3069 pm->qe->queue->queue_tail,
3024 pm->qe); 3070 pm->qe);
3071 pm->qe->queue->queue_length--;
3025 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3072 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3026 "Removing QueueEntry MID %llu from queue\n", 3073 "Removing QueueEntry MID %lu from queue\n",
3027 pm->qe->mid); 3074 pm->qe->mid);
3028 GNUNET_free (pm->qe); 3075 GNUNET_free (pm->qe);
3076 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3077 "QueueEntry MID freed\n");
3029 } 3078 }
3030 if (NULL != pm->bpm) 3079 if (NULL != pm->bpm)
3031 { 3080 {
3032 free_fragment_tree (pm->bpm); 3081 free_fragment_tree (pm->bpm);
3033 GNUNET_free (pm->bpm); 3082 GNUNET_free (pm->bpm);
3034 } 3083 }
3035 if (NULL == pm) 3084
3036 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3037 "free pending pm null\n");
3038 GNUNET_free (pm); 3085 GNUNET_free (pm);
3086 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3087 "Freeing pm done\n");
3039} 3088}
3040 3089
3041 3090
@@ -3755,6 +3804,9 @@ free_queue (struct Queue *queue)
3755 maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <= 3804 maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <=
3756 tc->details.communicator. 3805 tc->details.communicator.
3757 total_queue_length); 3806 total_queue_length);
3807 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3808 "Cleaning up queue with length %u\n",
3809 queue->queue_length);
3758 while (NULL != (qe = queue->queue_head)) 3810 while (NULL != (qe = queue->queue_head))
3759 { 3811 {
3760 GNUNET_CONTAINER_DLL_remove (queue->queue_head, queue->queue_tail, qe); 3812 GNUNET_CONTAINER_DLL_remove (queue->queue_head, queue->queue_tail, qe);
@@ -3767,6 +3819,9 @@ free_queue (struct Queue *queue)
3767 } 3819 }
3768 GNUNET_free (qe); 3820 GNUNET_free (qe);
3769 } 3821 }
3822 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3823 "Cleaning up queue with length %u\n",
3824 queue->queue_length);
3770 GNUNET_assert (0 == queue->queue_length); 3825 GNUNET_assert (0 == queue->queue_length);
3771 if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT > 3826 if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT >
3772 tc->details.communicator.total_queue_length)) 3827 tc->details.communicator.total_queue_length))
@@ -3787,7 +3842,7 @@ free_queue (struct Queue *queue)
3787 GNUNET_free (queue); 3842 GNUNET_free (queue);
3788 3843
3789 vl = lookup_virtual_link (&neighbour->pid); 3844 vl = lookup_virtual_link (&neighbour->pid);
3790 if ((NULL != vl) && (GNUNET_YES == vl->confirmed) && (neighbour == vl->n)) 3845 if ((NULL != vl) && (neighbour == vl->n))
3791 { 3846 {
3792 GNUNET_SCHEDULER_cancel (vl->visibility_task); 3847 GNUNET_SCHEDULER_cancel (vl->visibility_task);
3793 check_link_down (vl); 3848 check_link_down (vl);
@@ -4192,7 +4247,9 @@ check_communicator_available (
4192 * @param cmc context for which we are done handling the message 4247 * @param cmc context for which we are done handling the message
4193 */ 4248 */
4194static void 4249static void
4195finish_cmc_handling (struct CommunicatorMessageContext *cmc) 4250finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc,
4251 unsigned
4252 int continue_client)
4196{ 4253{
4197 if (0 != ntohl (cmc->im.fc_on)) 4254 if (0 != ntohl (cmc->im.fc_on))
4198 { 4255 {
@@ -4200,17 +4257,31 @@ finish_cmc_handling (struct CommunicatorMessageContext *cmc)
4200 struct GNUNET_MQ_Envelope *env; 4257 struct GNUNET_MQ_Envelope *env;
4201 struct GNUNET_TRANSPORT_IncomingMessageAck *ack; 4258 struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
4202 4259
4260 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4261 "Acknowledge message with flow control id %lu\n",
4262 cmc->im.fc_id);
4203 env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK); 4263 env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK);
4204 ack->reserved = htonl (0); 4264 ack->reserved = htonl (0);
4205 ack->fc_id = cmc->im.fc_id; 4265 ack->fc_id = cmc->im.fc_id;
4206 ack->sender = cmc->im.sender; 4266 ack->sender = cmc->im.neighbour_sender;
4207 GNUNET_MQ_send (cmc->tc->mq, env); 4267 GNUNET_MQ_send (cmc->tc->mq, env);
4208 } 4268 }
4209 GNUNET_SERVICE_client_continue (cmc->tc->client); 4269
4270 if (GNUNET_YES == continue_client)
4271 {
4272 GNUNET_SERVICE_client_continue (cmc->tc->client);
4273 }
4210 GNUNET_free (cmc); 4274 GNUNET_free (cmc);
4211} 4275}
4212 4276
4213 4277
4278static void
4279finish_cmc_handling (struct CommunicatorMessageContext *cmc)
4280{
4281 finish_cmc_handling_with_continue (cmc, GNUNET_YES);
4282}
4283
4284
4214/** 4285/**
4215 * Client confirms that it is done handling message(s) to a particular 4286 * Client confirms that it is done handling message(s) to a particular
4216 * peer. We may now provide more messages to CORE for this peer. 4287 * peer. We may now provide more messages to CORE for this peer.
@@ -4246,6 +4317,9 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom)
4246 } 4317 }
4247 delta = ntohl (rom->increase_window_delta); 4318 delta = ntohl (rom->increase_window_delta);
4248 vl->core_recv_window += delta; 4319 vl->core_recv_window += delta;
4320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4321 "CORE ack receiving message, increased CORE recv window to %u\n",
4322 vl->core_recv_window);
4249 if (vl->core_recv_window <= 0) 4323 if (vl->core_recv_window <= 0)
4250 return; 4324 return;
4251 /* resume communicators */ 4325 /* resume communicators */
@@ -4254,6 +4328,7 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom)
4254 GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc); 4328 GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc);
4255 finish_cmc_handling (cmc); 4329 finish_cmc_handling (cmc);
4256 } 4330 }
4331 GNUNET_SERVICE_client_continue (tc->client);
4257} 4332}
4258 4333
4259 4334
@@ -4403,14 +4478,14 @@ queue_send_msg (struct Queue *queue,
4403 qe->pm = pm; 4478 qe->pm = pm;
4404 // TODO Why do we have a retransmission. When we know, make decision if we still want this. 4479 // TODO Why do we have a retransmission. When we know, make decision if we still want this.
4405 // GNUNET_assert (NULL == pm->qe); 4480 // GNUNET_assert (NULL == pm->qe);
4406 /*if (NULL != pm->qe) 4481 if (NULL != pm->qe)
4407 { 4482 {
4408 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4409 "Retransmitting message <%llu> remove pm from qe with MID: %llu \n", 4484 "Retransmitting message <%llu> remove pm from qe with MID: %llu \n",
4410 pm->logging_uuid, 4485 pm->logging_uuid,
4411 (unsigned long long) pm->qe->mid); 4486 (unsigned long long) pm->qe->mid);
4412 pm->qe->pm = NULL; 4487 // pm->qe->pm = NULL;
4413 }*/ 4488 }
4414 pm->qe = qe; 4489 pm->qe = qe;
4415 } 4490 }
4416 GNUNET_CONTAINER_DLL_insert (queue->queue_head, queue->queue_tail, qe); 4491 GNUNET_CONTAINER_DLL_insert (queue->queue_head, queue->queue_tail, qe);
@@ -4434,7 +4509,7 @@ queue_send_msg (struct Queue *queue,
4434 if (0 == queue->q_capacity) 4509 if (0 == queue->q_capacity)
4435 queue->idle = GNUNET_NO; 4510 queue->idle = GNUNET_NO;
4436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 4511 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
4437 "Sending message MID %llu of type %u (%u) and size %u with MQ %p\n", 4512 "Sending message MID %lu of type %u (%u) and size %lu with MQ %p\n",
4438 smt->mid, 4513 smt->mid,
4439 ntohs (((const struct GNUNET_MessageHeader *) payload)->type), 4514 ntohs (((const struct GNUNET_MessageHeader *) payload)->type),
4440 ntohs (smt->header.size), 4515 ntohs (smt->header.size),
@@ -5104,7 +5179,7 @@ check_vl_transmission (struct VirtualLink *vl)
5104 vl->outbound_fc_window_size) 5179 vl->outbound_fc_window_size)
5105 { 5180 {
5106 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5107 "Stalled message %lu transmission on VL %s due to flow control: %llu < %llu\n", 5182 "Stalled message %llu transmission on VL %s due to flow control: %llu < %llu\n",
5108 pm->logging_uuid, 5183 pm->logging_uuid,
5109 GNUNET_i2s (&vl->target), 5184 GNUNET_i2s (&vl->target),
5110 (unsigned long long) vl->outbound_fc_window_size, 5185 (unsigned long long) vl->outbound_fc_window_size,
@@ -5157,11 +5232,12 @@ check_vl_transmission (struct VirtualLink *vl)
5157 else 5232 else
5158 { 5233 {
5159 vl_next_hop = lookup_virtual_link (&nh->pid); 5234 vl_next_hop = lookup_virtual_link (&nh->pid);
5235 GNUNET_assert (NULL != vl_next_hop);
5160 if (pm->bytes_msg + vl_next_hop->outbound_fc_window_size_used > 5236 if (pm->bytes_msg + vl_next_hop->outbound_fc_window_size_used >
5161 vl_next_hop->outbound_fc_window_size) 5237 vl_next_hop->outbound_fc_window_size)
5162 { 5238 {
5163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5239 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5164 "Stalled message %lu transmission on next hop %s due to flow control: %llu < %llu\n", 5240 "Stalled message %llu transmission on next hop %s due to flow control: %llu < %llu\n",
5165 pm->logging_uuid, 5241 pm->logging_uuid,
5166 GNUNET_i2s (&vl_next_hop->target), 5242 GNUNET_i2s (&vl_next_hop->target),
5167 (unsigned long 5243 (unsigned long
@@ -5195,7 +5271,7 @@ check_vl_transmission (struct VirtualLink *vl)
5195 } 5271 }
5196 if (GNUNET_YES == elig) 5272 if (GNUNET_YES == elig)
5197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5198 "Eligible message %lu of size %llu to %s: %llu/%llu\n", 5274 "Eligible message %llu of size %u to %s: %llu/%llu\n",
5199 pm->logging_uuid, 5275 pm->logging_uuid,
5200 pm->bytes_msg, 5276 pm->bytes_msg,
5201 GNUNET_i2s (&vl->target), 5277 GNUNET_i2s (&vl->target),
@@ -5532,8 +5608,7 @@ handle_del_address (void *cls,
5532 * @param msg message to demultiplex 5608 * @param msg message to demultiplex
5533 */ 5609 */
5534static void 5610static void
5535demultiplex_with_cmc (struct CommunicatorMessageContext *cmc, 5611demultiplex_with_cmc (struct CommunicatorMessageContext *cmc);
5536 const struct GNUNET_MessageHeader *msg);
5537 5612
5538 5613
5539/** 5614/**
@@ -5564,60 +5639,15 @@ core_env_sent_cb (void *cls)
5564} 5639}
5565 5640
5566 5641
5567/**
5568 * Communicator gave us an unencapsulated message to pass as-is to
5569 * CORE. Process the request.
5570 *
5571 * @param cls a `struct CommunicatorMessageContext` (must call
5572 * #finish_cmc_handling() when done)
5573 * @param mh the message that was received
5574 */
5575static void 5642static void
5576handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) 5643finish_handling_raw_message (struct VirtualLink *vl,
5644 const struct GNUNET_MessageHeader *mh,
5645 struct CommunicatorMessageContext *cmc,
5646 unsigned int continue_client)
5577{ 5647{
5578 struct CommunicatorMessageContext *cmc = cls;
5579 struct VirtualLink *vl;
5580 uint16_t size = ntohs (mh->size); 5648 uint16_t size = ntohs (mh->size);
5581 int have_core; 5649 int have_core;
5582 5650
5583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5584 "Handling raw message of type %u with %u bytes\n",
5585 (unsigned int) ntohs (mh->type),
5586 (unsigned int) ntohs (mh->size));
5587
5588 if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
5589 (size < sizeof(struct GNUNET_MessageHeader)))
5590 {
5591 struct GNUNET_SERVICE_Client *client = cmc->tc->client;
5592
5593 GNUNET_break (0);
5594 finish_cmc_handling (cmc);
5595 GNUNET_SERVICE_client_drop (client);
5596 return;
5597 }
5598 vl = lookup_virtual_link (&cmc->im.sender);
5599 if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
5600 {
5601 /* FIXME: sender is giving us messages for CORE but we don't have
5602 the link up yet! I *suspect* this can happen right now (i.e.
5603 sender has verified us, but we didn't verify sender), but if
5604 we pass this on, CORE would be confused (link down, messages
5605 arrive). We should investigate more if this happens often,
5606 or in a persistent manner, and possibly do "something" about
5607 it. Thus logging as error for now. */
5608 GNUNET_break_op (0);
5609 GNUNET_STATISTICS_update (GST_stats,
5610 "# CORE messages dropped (virtual link still down)",
5611 1,
5612 GNUNET_NO);
5613
5614 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5615 "CORE messages of type %u with %u bytes dropped (virtual link still down)\n",
5616 (unsigned int) ntohs (mh->type),
5617 (unsigned int) ntohs (mh->size));
5618 finish_cmc_handling (cmc);
5619 return;
5620 }
5621 if (vl->incoming_fc_window_size_ram > UINT_MAX - size) 5651 if (vl->incoming_fc_window_size_ram > UINT_MAX - size)
5622 { 5652 {
5623 GNUNET_STATISTICS_update (GST_stats, 5653 GNUNET_STATISTICS_update (GST_stats,
@@ -5628,7 +5658,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
5628 "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n", 5658 "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n",
5629 (unsigned int) ntohs (mh->type), 5659 (unsigned int) ntohs (mh->type),
5630 (unsigned int) ntohs (mh->size)); 5660 (unsigned int) ntohs (mh->size));
5631 finish_cmc_handling (cmc); 5661 finish_cmc_handling_with_continue (cmc, continue_client);
5632 return; 5662 return;
5633 } 5663 }
5634 if (vl->incoming_fc_window_size_ram + size > vl->available_fc_window_size) 5664 if (vl->incoming_fc_window_size_ram + size > vl->available_fc_window_size)
@@ -5641,7 +5671,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
5641 "CORE messages of type %u with %u bytes dropped (FC window overflow)\n", 5671 "CORE messages of type %u with %u bytes dropped (FC window overflow)\n",
5642 (unsigned int) ntohs (mh->type), 5672 (unsigned int) ntohs (mh->type),
5643 (unsigned int) ntohs (mh->size)); 5673 (unsigned int) ntohs (mh->size));
5644 finish_cmc_handling (cmc); 5674 finish_cmc_handling_with_continue (cmc, continue_client);
5645 return; 5675 return;
5646 } 5676 }
5647 5677
@@ -5681,16 +5711,17 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
5681 "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n", 5711 "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n",
5682 (unsigned int) ntohs (mh->type), 5712 (unsigned int) ntohs (mh->type),
5683 (unsigned int) ntohs (mh->size)); 5713 (unsigned int) ntohs (mh->size));
5684 finish_cmc_handling (cmc); 5714 finish_cmc_handling_with_continue (cmc, continue_client);
5685 return; 5715 return;
5686 } 5716 }
5687 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5717 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5688 "Delivered message from %s of type %u to CORE\n", 5718 "Delivered message from %s of type %u to CORE recv window %u\n",
5689 GNUNET_i2s (&cmc->im.sender), 5719 GNUNET_i2s (&cmc->im.sender),
5690 ntohs (mh->type)); 5720 ntohs (mh->type),
5721 vl->core_recv_window);
5691 if (vl->core_recv_window > 0) 5722 if (vl->core_recv_window > 0)
5692 { 5723 {
5693 finish_cmc_handling (cmc); 5724 finish_cmc_handling_with_continue (cmc, continue_client);
5694 return; 5725 return;
5695 } 5726 }
5696 /* Wait with calling #finish_cmc_handling(cmc) until the message 5727 /* Wait with calling #finish_cmc_handling(cmc) until the message
@@ -5699,6 +5730,100 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
5699} 5730}
5700 5731
5701 5732
5733
5734/**
5735 * Communicator gave us an unencapsulated message to pass as-is to
5736 * CORE. Process the request.
5737 *
5738 * @param cls a `struct CommunicatorMessageContext` (must call
5739 * #finish_cmc_handling() when done)
5740 * @param mh the message that was received
5741 */
5742static void
5743handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
5744{
5745 struct CommunicatorMessageContext *cmc = cls;
5746 // struct CommunicatorMessageContext *cmc_copy =
5747 // GNUNET_new (struct CommunicatorMessageContext);
5748 struct GNUNET_MessageHeader *mh_copy;
5749 struct RingBufferEntry *rbe;
5750 struct VirtualLink *vl;
5751 uint16_t size = ntohs (mh->size);
5752
5753 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5754 "Handling raw message of type %u with %u bytes\n",
5755 (unsigned int) ntohs (mh->type),
5756 (unsigned int) ntohs (mh->size));
5757
5758 if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
5759 (size < sizeof(struct GNUNET_MessageHeader)))
5760 {
5761 struct GNUNET_SERVICE_Client *client = cmc->tc->client;
5762
5763 GNUNET_break (0);
5764 finish_cmc_handling (cmc);
5765 GNUNET_SERVICE_client_drop (client);
5766 return;
5767 }
5768 vl = lookup_virtual_link (&cmc->im.sender);
5769 if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
5770 {
5771 /* FIXME: sender is giving us messages for CORE but we don't have
5772 the link up yet! I *suspect* this can happen right now (i.e.
5773 sender has verified us, but we didn't verify sender), but if
5774 we pass this on, CORE would be confused (link down, messages
5775 arrive). We should investigate more if this happens often,
5776 or in a persistent manner, and possibly do "something" about
5777 it. Thus logging as error for now. */
5778
5779 mh_copy = GNUNET_malloc (size);
5780 rbe = GNUNET_new (struct RingBufferEntry);
5781 rbe->cmc = cmc;
5782 /*cmc_copy->tc = cmc->tc;
5783 cmc_copy->im = cmc->im;*/
5784 GNUNET_memcpy (mh_copy, mh, size);
5785
5786 rbe->mh = mh_copy;
5787
5788 ring_buffer[ring_buffer_head] = rbe;// cmc_copy;
5789 // cmc_copy->mh = (const struct GNUNET_MessageHeader *) mh_copy;
5790 cmc->mh = (const struct GNUNET_MessageHeader *) mh_copy;
5791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5792 "Storing message for %s and type %u (%u) in ring buffer\n",
5793 GNUNET_i2s (&cmc->im.sender),
5794 (unsigned int) ntohs (mh->type),
5795 (unsigned int) ntohs (mh_copy->type));
5796 if (RING_BUFFER_SIZE - 1 == ring_buffer_head)
5797 {
5798 ring_buffer_head = 0;
5799 is_ring_buffer_full = GNUNET_YES;
5800 }
5801 else
5802 ring_buffer_head++;
5803
5804 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5805 "%u items stored in ring buffer\n",
5806 ring_buffer_head);
5807
5808 /*GNUNET_break_op (0);
5809 GNUNET_STATISTICS_update (GST_stats,
5810 "# CORE messages dropped (virtual link still down)",
5811 1,
5812 GNUNET_NO);
5813
5814 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5815 "CORE messages of type %u with %u bytes dropped (virtual link still down)\n",
5816 (unsigned int) ntohs (mh->type),
5817 (unsigned int) ntohs (mh->size));
5818 finish_cmc_handling (cmc);*/
5819 GNUNET_SERVICE_client_continue (cmc->tc->client);
5820 // GNUNET_free (cmc);
5821 return;
5822 }
5823 finish_handling_raw_message (vl, mh, cmc, GNUNET_YES);
5824}
5825
5826
5702/** 5827/**
5703 * Communicator gave us a fragment box. Check the message. 5828 * Communicator gave us a fragment box. Check the message.
5704 * 5829 *
@@ -6070,7 +6195,8 @@ handle_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
6070 (unsigned int) fb->msg_uuid.uuid); 6195 (unsigned int) fb->msg_uuid.uuid);
6071 /* FIXME: check that the resulting msg is NOT a 6196 /* FIXME: check that the resulting msg is NOT a
6072 DV Box or Reliability Box, as that is NOT allowed! */ 6197 DV Box or Reliability Box, as that is NOT allowed! */
6073 demultiplex_with_cmc (cmc, msg); 6198 cmc->mh = msg;
6199 demultiplex_with_cmc (cmc);
6074 /* FIXME-OPTIMIZE: really free here? Might be bad if fragments are still 6200 /* FIXME-OPTIMIZE: really free here? Might be bad if fragments are still
6075 en-route and we forget that we finished this reassembly immediately! 6201 en-route and we forget that we finished this reassembly immediately!
6076 -> keep around until timeout? 6202 -> keep around until timeout?
@@ -6095,7 +6221,7 @@ check_reliability_box (void *cls,
6095 GNUNET_MessageHeader *) &rb[1]; 6221 GNUNET_MessageHeader *) &rb[1];
6096 6222
6097 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 6223 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6098 "check_send_msg with size %u: inner msg type %u and size %u (%u %u)\n", 6224 "check_send_msg with size %u: inner msg type %u and size %u (%lu %lu)\n",
6099 ntohs (rb->header.size), 6225 ntohs (rb->header.size),
6100 ntohs (inbox->type), 6226 ntohs (inbox->type),
6101 ntohs (inbox->size), 6227 ntohs (inbox->size),
@@ -6141,7 +6267,8 @@ handle_reliability_box (void *cls,
6141 /* continue with inner message */ 6267 /* continue with inner message */
6142 /* FIXME: check that inbox is NOT a DV Box, fragment or another 6268 /* FIXME: check that inbox is NOT a DV Box, fragment or another
6143 reliability box (not allowed!) */ 6269 reliability box (not allowed!) */
6144 demultiplex_with_cmc (cmc, inbox); 6270 cmc->mh = inbox;
6271 demultiplex_with_cmc (cmc);
6145} 6272}
6146 6273
6147 6274
@@ -6295,8 +6422,13 @@ completed_pending_message (struct PendingMessage *pm)
6295 if (NULL != pm->bpm) 6422 if (NULL != pm->bpm)
6296 { 6423 {
6297 GNUNET_free (pm->bpm); 6424 GNUNET_free (pm->bpm);
6425 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6426 "Freed bpm\n");
6298 } 6427 }
6299 client_send_response (pm->frag_parent); 6428 pos = pm->frag_parent;
6429 free_pending_message (pm);
6430 pos->bpm = NULL;
6431 client_send_response (pos);
6300 } 6432 }
6301 else 6433 else
6302 client_send_response (pm); 6434 client_send_response (pm);
@@ -6552,6 +6684,140 @@ path_cleanup_cb (void *cls)
6552} 6684}
6553 6685
6554 6686
6687static void send_msg_from_cache (struct VirtualLink *vl)
6688{
6689
6690 const struct GNUNET_PeerIdentity target = vl->target;
6691
6692
6693 if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_head))
6694 {
6695 struct RingBufferEntry *ring_buffer_copy[RING_BUFFER_SIZE];
6696 unsigned int tail = GNUNET_YES == is_ring_buffer_full ? ring_buffer_head :
6697 0;
6698 unsigned int head = GNUNET_YES == is_ring_buffer_full ? RING_BUFFER_SIZE :
6699 ring_buffer_head;
6700 struct GNUNET_TRANSPORT_IncomingMessage im;
6701 struct CommunicatorMessageContext *cmc;
6702 struct RingBufferEntry *rbe;
6703 struct GNUNET_MessageHeader *mh;
6704
6705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6706 "Sending from ring buffer, which has %u items\n",
6707 ring_buffer_head);
6708
6709 ring_buffer_head = 0;
6710 for (unsigned int i = 0; i < head; i++)
6711 {
6712 rbe = ring_buffer[(i + tail) % RING_BUFFER_SIZE];
6713 cmc = rbe->cmc;
6714 mh = rbe->mh;
6715
6716 im = cmc->im;
6717 // mh = cmc->mh;
6718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6719 "Sending to ring buffer target %s using vl target %s\n",
6720 GNUNET_i2s (&im.sender),
6721 GNUNET_i2s2 (&target));
6722 if (0 == GNUNET_memcmp (&target, &im.sender))
6723 {
6724 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6725 "Finish handling message of type %u and size %u\n",
6726 (unsigned int) ntohs (mh->type),
6727 (unsigned int) ntohs (mh->size));
6728 finish_handling_raw_message (vl, mh, cmc, GNUNET_NO);
6729 GNUNET_free (mh);
6730 }
6731 else
6732 {
6733 ring_buffer_copy[i] = rbe;
6734 ring_buffer_head++;
6735 }
6736 }
6737
6738 if ((GNUNET_YES == is_ring_buffer_full) && (RING_BUFFER_SIZE - 1 >
6739 ring_buffer_head))
6740 {
6741 is_ring_buffer_full = GNUNET_NO;
6742 }
6743
6744 for (unsigned int i = 0; i < ring_buffer_head; i++)
6745 {
6746 ring_buffer[i] = ring_buffer_copy[i];
6747 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6748 "ring_buffer_copy[i]->mh->type for i %u %u\n",
6749 i,
6750 ring_buffer_copy[i]->mh->type);
6751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6752 "ring_buffer[i]->mh->type for i %u %u\n",
6753 i,
6754 ring_buffer[i]->mh->type);
6755 }
6756
6757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6758 "%u items still in ring buffer\n",
6759 ring_buffer_head);
6760 }
6761
6762 if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_dv_head))
6763 {
6764 struct PendingMessage *ring_buffer_dv_copy[RING_BUFFER_SIZE];
6765 struct PendingMessage *pm;
6766 unsigned int tail = GNUNET_YES == is_ring_buffer_dv_full ?
6767 ring_buffer_dv_head :
6768 0;
6769 unsigned int head = GNUNET_YES == is_ring_buffer_dv_full ?
6770 RING_BUFFER_SIZE :
6771 ring_buffer_dv_head;
6772
6773 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6774 "Sending from ring buffer dv, which has %u items\n",
6775 ring_buffer_dv_head);
6776
6777 ring_buffer_dv_head = 0;
6778 for (unsigned int i = 0; i < head; i++)
6779 {
6780 pm = ring_buffer_dv[(i + tail) % RING_BUFFER_SIZE];
6781
6782 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6783 "Sending to ring buffer target %s using vl target %s\n",
6784 GNUNET_i2s (&pm->target),
6785 GNUNET_i2s2 (&target));
6786 if (0 == GNUNET_memcmp (&target, &pm->target))
6787 {
6788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6789 "Adding PendingMessage to vl, checking transmission.\n");
6790 pm->vl = vl;
6791 GNUNET_CONTAINER_MDLL_insert (vl,
6792 vl->pending_msg_head,
6793 vl->pending_msg_tail,
6794 pm);
6795
6796 check_vl_transmission (vl);
6797 }
6798 else
6799 {
6800 ring_buffer_dv_copy[i] = pm;
6801 ring_buffer_dv_head++;
6802 }
6803 }
6804
6805 if (is_ring_buffer_dv_full && (RING_BUFFER_SIZE - 1 > ring_buffer_dv_head))
6806 {
6807 is_ring_buffer_dv_full = GNUNET_NO;
6808 }
6809
6810 for (unsigned int i = 0; i < ring_buffer_dv_head; i++)
6811 ring_buffer_dv[i] = ring_buffer_dv_copy[i];
6812
6813 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6814 "%u items still in ring buffer dv.\n",
6815 ring_buffer_dv_head);
6816
6817 }
6818}
6819
6820
6555/** 6821/**
6556 * The @a hop is a validated path to the respective target 6822 * The @a hop is a validated path to the respective target
6557 * peer and we should tell core about it -- and schedule 6823 * peer and we should tell core about it -- and schedule
@@ -6595,6 +6861,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
6595 /* We lacked a confirmed connection to the target 6861 /* We lacked a confirmed connection to the target
6596 before, so tell CORE about it (finally!) */ 6862 before, so tell CORE about it (finally!) */
6597 cores_send_connect_info (&dv->target); 6863 cores_send_connect_info (&dv->target);
6864 send_msg_from_cache (vl);
6598 } 6865 }
6599 else 6866 else
6600 { 6867 {
@@ -6610,6 +6877,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
6610 /* We lacked a confirmed connection to the target 6877 /* We lacked a confirmed connection to the target
6611 before, so tell CORE about it (finally!) */ 6878 before, so tell CORE about it (finally!) */
6612 cores_send_connect_info (&dv->target); 6879 cores_send_connect_info (&dv->target);
6880 send_msg_from_cache (vl);
6613 } 6881 }
6614 else 6882 else
6615 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 6883 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7358,7 +7626,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
7358 struct GNUNET_TIME_Relative host_latency_sum; 7626 struct GNUNET_TIME_Relative host_latency_sum;
7359 struct GNUNET_TIME_Relative latency; 7627 struct GNUNET_TIME_Relative latency;
7360 struct GNUNET_TIME_Relative network_latency; 7628 struct GNUNET_TIME_Relative network_latency;
7361 struct GNUNET_TIME_Absolute now;
7362 7629
7363 /* We initiated this, learn the forward path! */ 7630 /* We initiated this, learn the forward path! */
7364 path[0] = GST_my_identity; 7631 path[0] = GST_my_identity;
@@ -7367,7 +7634,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
7367 7634
7368 // Need also something to lookup initiation time 7635 // Need also something to lookup initiation time
7369 // to compute RTT! -> add RTT argument here? 7636 // to compute RTT! -> add RTT argument here?
7370 now = GNUNET_TIME_absolute_get ();
7371 latency = GNUNET_TIME_absolute_get_duration (GNUNET_TIME_absolute_ntoh ( 7637 latency = GNUNET_TIME_absolute_get_duration (GNUNET_TIME_absolute_ntoh (
7372 dvl->monotonic_time)); 7638 dvl->monotonic_time));
7373 GNUNET_assert (latency.rel_value_us >= host_latency_sum.rel_value_us); 7639 GNUNET_assert (latency.rel_value_us >= host_latency_sum.rel_value_us);
@@ -7429,7 +7695,8 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
7429 iret = learn_dv_path (path, 7695 iret = learn_dv_path (path,
7430 i + 3, 7696 i + 3,
7431 GNUNET_TIME_UNIT_FOREVER_REL, 7697 GNUNET_TIME_UNIT_FOREVER_REL,
7432 GNUNET_TIME_UNIT_ZERO_ABS); 7698 GNUNET_TIME_relative_to_absolute (
7699 ADDRESS_VALIDATION_LIFETIME));
7433 if (GNUNET_SYSERR == iret) 7700 if (GNUNET_SYSERR == iret)
7434 { 7701 {
7435 /* path invalid or too long to be interesting for US, thus should also 7702 /* path invalid or too long to be interesting for US, thus should also
@@ -7602,7 +7869,7 @@ forward_dv_box (struct Neighbour *next_hop,
7602 GNUNET_MessageHeader *) msg_buf, 7869 GNUNET_MessageHeader *) msg_buf,
7603 RMO_ANYTHING_GOES); 7870 RMO_ANYTHING_GOES);
7604 } 7871 }
7605 else if (NULL != vl) 7872 else
7606 { 7873 {
7607 pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size); 7874 pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size);
7608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 7875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7611,29 +7878,48 @@ forward_dv_box (struct Neighbour *next_hop,
7611 vl); 7878 vl);
7612 pm->pmt = PMT_DV_BOX; 7879 pm->pmt = PMT_DV_BOX;
7613 pm->vl = vl; 7880 pm->vl = vl;
7881 pm->target = next_hop->pid;
7614 pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT); 7882 pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT);
7615 pm->logging_uuid = logging_uuid_gen++; 7883 pm->logging_uuid = logging_uuid_gen++;
7616 pm->prefs = GNUNET_MQ_PRIO_BACKGROUND; 7884 pm->prefs = GNUNET_MQ_PRIO_BACKGROUND;
7617 pm->bytes_msg = msg_size; 7885 pm->bytes_msg = msg_size;
7618 buf = (char *) &pm[1]; 7886 buf = (char *) &pm[1];
7619 memcpy (buf, msg_buf, msg_size); 7887 memcpy (buf, msg_buf, msg_size);
7620 GNUNET_CONTAINER_MDLL_insert (vl, 7888
7621 vl->pending_msg_head,
7622 vl->pending_msg_tail,
7623 pm);
7624 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 7889 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7625 "Created pending message %llu for DV Box with next hop %s (%u/%u)\n", 7890 "Created pending message %llu for DV Box with next hop %s (%u/%u)\n",
7626 pm->logging_uuid, 7891 pm->logging_uuid,
7627 GNUNET_i2s (&next_hop->pid), 7892 GNUNET_i2s (&next_hop->pid),
7628 (unsigned int) num_hops, 7893 (unsigned int) num_hops,
7629 (unsigned int) total_hops); 7894 (unsigned int) total_hops);
7630 check_vl_transmission (vl); 7895
7631 } 7896 if ((NULL != vl) && (GNUNET_YES == vl->confirmed))
7632 else 7897 {
7633 { 7898 GNUNET_CONTAINER_MDLL_insert (vl,
7634 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 7899 vl->pending_msg_head,
7635 "The virtual link is not ready for forwarding a DV Box with payload.\n"); 7900 vl->pending_msg_tail,
7636 // FIXME The DV Box was send before the validation response. Shall we send a validation request for DV paths? 7901 pm);
7902
7903 check_vl_transmission (vl);
7904 }
7905 else
7906 {
7907 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7908 "The virtual link is not ready for forwarding a DV Box with payload, storing PendingMessage in ring buffer.\n");
7909
7910 ring_buffer_dv[ring_buffer_dv_head] = pm;
7911 if (RING_BUFFER_SIZE - 1 == ring_buffer_dv_head)
7912 {
7913 ring_buffer_dv_head = 0;
7914 is_ring_buffer_dv_full = GNUNET_YES;
7915 }
7916 else
7917 ring_buffer_dv_head++;
7918
7919 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
7920 "%u items stored in DV ring buffer\n",
7921 ring_buffer_dv_head);
7922 }
7637 } 7923 }
7638} 7924}
7639 7925
@@ -7745,9 +8031,9 @@ backtalker_monotime_cb (void *cls,
7745 continue normal processing */ 8031 continue normal processing */
7746 b->get = NULL; 8032 b->get = NULL;
7747 GNUNET_assert (NULL != b->cmc); 8033 GNUNET_assert (NULL != b->cmc);
8034 b->cmc->mh = (const struct GNUNET_MessageHeader *) &b[1];
7748 if (0 != b->body_size) 8035 if (0 != b->body_size)
7749 demultiplex_with_cmc (b->cmc, 8036 demultiplex_with_cmc (b->cmc);
7750 (const struct GNUNET_MessageHeader *) &b[1]);
7751 else 8037 else
7752 finish_cmc_handling (b->cmc); 8038 finish_cmc_handling (b->cmc);
7753 b->cmc = NULL; 8039 b->cmc = NULL;
@@ -7865,7 +8151,6 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
7865 const char *enc_payload = (const char *) &hops[num_hops]; 8151 const char *enc_payload = (const char *) &hops[num_hops];
7866 uint16_t enc_payload_size = 8152 uint16_t enc_payload_size =
7867 size - (num_hops * sizeof(struct GNUNET_PeerIdentity)); 8153 size - (num_hops * sizeof(struct GNUNET_PeerIdentity));
7868 char enc[enc_payload_size];
7869 struct DVKeyState *key; 8154 struct DVKeyState *key;
7870 struct GNUNET_HashCode hmac; 8155 struct GNUNET_HashCode hmac;
7871 const char *hdr; 8156 const char *hdr;
@@ -8053,8 +8338,8 @@ handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
8053 update_backtalker_monotime (b); 8338 update_backtalker_monotime (b);
8054 b->timeout = 8339 b->timeout =
8055 GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT); 8340 GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT);
8056 8341 cmc->mh = mh;
8057 demultiplex_with_cmc (cmc, mh); 8342 demultiplex_with_cmc (cmc);
8058 return; 8343 return;
8059 } 8344 }
8060 /* setup data structure to cache signature AND check 8345 /* setup data structure to cache signature AND check
@@ -8535,6 +8820,10 @@ handle_validation_response (
8535 if ((origin_time.abs_value_us < vs->first_challenge_use.abs_value_us) || 8820 if ((origin_time.abs_value_us < vs->first_challenge_use.abs_value_us) ||
8536 (origin_time.abs_value_us > vs->last_challenge_use.abs_value_us)) 8821 (origin_time.abs_value_us > vs->last_challenge_use.abs_value_us))
8537 { 8822 {
8823 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8824 "Diff first use %lu and last use %lu\n",
8825 vs->first_challenge_use.abs_value_us - origin_time.abs_value_us,
8826 origin_time.abs_value_us - vs->last_challenge_use.abs_value_us);
8538 GNUNET_break_op (0); 8827 GNUNET_break_op (0);
8539 finish_cmc_handling (cmc); 8828 finish_cmc_handling (cmc);
8540 return; 8829 return;
@@ -8585,8 +8874,9 @@ handle_validation_response (
8585 GNUNET_TIME_UNIT_ZERO_ABS; /* challenge was not yet used */ 8874 GNUNET_TIME_UNIT_ZERO_ABS; /* challenge was not yet used */
8586 update_next_challenge_time (vs, vs->first_challenge_use); 8875 update_next_challenge_time (vs, vs->first_challenge_use);
8587 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8876 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8588 "Validation response %s accepted, address valid until %s\n", 8877 "Validation response %s from %s accepted, address valid until %s\n",
8589 GNUNET_sh2s (&tvr->challenge.value), 8878 GNUNET_sh2s (&tvr->challenge.value),
8879 GNUNET_i2s (&cmc->im.sender),
8590 GNUNET_STRINGS_absolute_time_to_string (vs->valid_until)); 8880 GNUNET_STRINGS_absolute_time_to_string (vs->valid_until));
8591 vs->sc = GNUNET_PEERSTORE_store (peerstore, 8881 vs->sc = GNUNET_PEERSTORE_store (peerstore,
8592 "transport", 8882 "transport",
@@ -8644,6 +8934,7 @@ handle_validation_response (
8644 /* We lacked a confirmed connection to the target 8934 /* We lacked a confirmed connection to the target
8645 before, so tell CORE about it (finally!) */ 8935 before, so tell CORE about it (finally!) */
8646 cores_send_connect_info (&n->pid); 8936 cores_send_connect_info (&n->pid);
8937 send_msg_from_cache (vl);
8647 } 8938 }
8648 else 8939 else
8649 { 8940 {
@@ -8654,7 +8945,7 @@ handle_validation_response (
8654 n->vl = vl; 8945 n->vl = vl;
8655 if (GNUNET_YES == vl->confirmed) 8946 if (GNUNET_YES == vl->confirmed)
8656 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8947 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8657 "Virtual link to %s could now also direct neighbour!\n", 8948 "Virtual link to %s could now also use direct neighbour!\n",
8658 GNUNET_i2s (&vs->pid)); 8949 GNUNET_i2s (&vs->pid));
8659 } 8950 }
8660 else 8951 else
@@ -8671,6 +8962,7 @@ handle_validation_response (
8671 /* We lacked a confirmed connection to the target 8962 /* We lacked a confirmed connection to the target
8672 before, so tell CORE about it (finally!) */ 8963 before, so tell CORE about it (finally!) */
8673 cores_send_connect_info (&n->pid); 8964 cores_send_connect_info (&n->pid);
8965 send_msg_from_cache (vl);
8674 } 8966 }
8675 } 8967 }
8676} 8968}
@@ -8692,10 +8984,13 @@ handle_incoming_msg (void *cls,
8692 cmc->tc = tc; 8984 cmc->tc = tc;
8693 cmc->im = *im; 8985 cmc->im = *im;
8694 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 8986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8695 "Received message with size %u via communicator from peer %s\n", 8987 "Received message with size %u and flow control id %lu via communicator from peer %s\n",
8696 &im->header.size, 8988 ntohs (im->header.size),
8989 im->fc_id,
8697 GNUNET_i2s (&im->sender)); 8990 GNUNET_i2s (&im->sender));
8698 demultiplex_with_cmc (cmc, (const struct GNUNET_MessageHeader *) &im[1]); 8991 cmc->im.neighbour_sender = cmc->im.sender;
8992 cmc->mh = (const struct GNUNET_MessageHeader *) &im[1];
8993 demultiplex_with_cmc (cmc);
8699} 8994}
8700 8995
8701 8996
@@ -8783,7 +9078,7 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
8783 % FC_NO_CHANGE_REPLY_PROBABILITY))) 9078 % FC_NO_CHANGE_REPLY_PROBABILITY)))
8784 { 9079 {
8785 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9080 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8786 "Consider re-sending our FC message, as clearly the other peer's idea of the window is not up-to-date (%llu vs %llu) or %llu last received differs, or random reply %lu\n", 9081 "Consider re-sending our FC message, as clearly the other peer's idea of the window is not up-to-date (%llu vs %llu) or %llu last received differs, or random reply %u\n",
8787 (unsigned long long) wnd, 9082 (unsigned long long) wnd,
8788 (unsigned long long) vl->incoming_fc_window_size, 9083 (unsigned long long) vl->incoming_fc_window_size,
8789 (unsigned long long) vl->last_outbound_window_size_received, 9084 (unsigned long long) vl->last_outbound_window_size_received,
@@ -8817,8 +9112,7 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
8817 * @param msg message to demultiplex 9112 * @param msg message to demultiplex
8818 */ 9113 */
8819static void 9114static void
8820demultiplex_with_cmc (struct CommunicatorMessageContext *cmc, 9115demultiplex_with_cmc (struct CommunicatorMessageContext *cmc)
8821 const struct GNUNET_MessageHeader *msg)
8822{ 9116{
8823 struct GNUNET_MQ_MessageHandler handlers[] = 9117 struct GNUNET_MQ_MessageHandler handlers[] =
8824 { GNUNET_MQ_hd_var_size (fragment_box, 9118 { GNUNET_MQ_hd_var_size (fragment_box,
@@ -8861,6 +9155,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
8861 cmc), 9155 cmc),
8862 GNUNET_MQ_handler_end () }; 9156 GNUNET_MQ_handler_end () };
8863 int ret; 9157 int ret;
9158 const struct GNUNET_MessageHeader *msg = cmc->mh;
8864 9159
8865 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9160 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
8866 "Handling message of type %u with %u bytes\n", 9161 "Handling message of type %u with %u bytes\n",
@@ -9154,7 +9449,7 @@ reliability_box_message (struct Queue *queue,
9154 memcpy (&msg[sizeof(rbox)], &pm[1], pm->bytes_msg); 9449 memcpy (&msg[sizeof(rbox)], &pm[1], pm->bytes_msg);
9155 pm->bpm = bpm; 9450 pm->bpm = bpm;
9156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9451 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9157 "Preparing reliability box for message <%llu> of size %lu (%lu) to %s on queue %s\n", 9452 "Preparing reliability box for message <%llu> of size %d (%d) to %s on queue %s\n",
9158 pm->logging_uuid, 9453 pm->logging_uuid,
9159 pm->bytes_msg, 9454 pm->bytes_msg,
9160 ntohs (((const struct GNUNET_MessageHeader *) &pm[1])->size), 9455 ntohs (((const struct GNUNET_MessageHeader *) &pm[1])->size),
@@ -9200,7 +9495,6 @@ static void
9200update_pm_next_attempt (struct PendingMessage *pm, 9495update_pm_next_attempt (struct PendingMessage *pm,
9201 struct GNUNET_TIME_Absolute next_attempt) 9496 struct GNUNET_TIME_Absolute next_attempt)
9202{ 9497{
9203 struct VirtualLink *vl = pm->vl;
9204 9498
9205 // TODO Do we really need a next_attempt value for PendingMessage other than the root Pending Message? 9499 // TODO Do we really need a next_attempt value for PendingMessage other than the root Pending Message?
9206 pm->next_attempt = next_attempt; 9500 pm->next_attempt = next_attempt;
@@ -9221,7 +9515,8 @@ update_pm_next_attempt (struct PendingMessage *pm,
9221 root = root->frag_parent; 9515 root = root->frag_parent;
9222 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9516 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9223 "Next attempt for root message <%llu> set to %s\n", 9517 "Next attempt for root message <%llu> set to %s\n",
9224 root->logging_uuid); 9518 root->logging_uuid,
9519 GNUNET_STRINGS_absolute_time_to_string (next_attempt));
9225 root->next_attempt = next_attempt; 9520 root->next_attempt = next_attempt;
9226 reorder_root_pm (root, next_attempt); 9521 reorder_root_pm (root, next_attempt);
9227 } 9522 }
@@ -9356,7 +9651,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9356 /* determine if we have to fragment, if so add fragmentation 9651 /* determine if we have to fragment, if so add fragmentation
9357 overhead! */ 9652 overhead! */
9358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9653 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9359 "check %u for sc->best\n", 9654 "check %llu for sc->best\n",
9360 pos->logging_uuid); 9655 pos->logging_uuid);
9361 frag = GNUNET_NO; 9656 frag = GNUNET_NO;
9362 if (((0 != queue->mtu) && 9657 if (((0 != queue->mtu) &&
@@ -9369,7 +9664,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9369 this queue */)) 9664 this queue */))
9370 { 9665 {
9371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9666 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9372 "fragment msg with size %u, realoverhead is %u\n", 9667 "fragment msg with size %u, realoverhead is %lu\n",
9373 pos->bytes_msg, 9668 pos->bytes_msg,
9374 real_overhead); 9669 real_overhead);
9375 frag = GNUNET_YES; 9670 frag = GNUNET_YES;
@@ -9399,7 +9694,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9399 relb = GNUNET_YES; 9694 relb = GNUNET_YES;
9400 } 9695 }
9401 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9696 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9402 "Create reliability box of msg with size %u, realoverhead is %u %u %u %u\n", 9697 "Create reliability box of msg with size %u, realoverhead is %lu %u %u %u\n",
9403 pos->bytes_msg, 9698 pos->bytes_msg,
9404 real_overhead, 9699 real_overhead,
9405 queue->mtu, 9700 queue->mtu,
@@ -9449,7 +9744,7 @@ select_best_pending_from_link (struct PendingMessageScoreContext *sc,
9449 if (sc_score + time_delta > pm_score) 9744 if (sc_score + time_delta > pm_score)
9450 { 9745 {
9451 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9746 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9452 "sc_score of %u larger, keep sc->best %u\n", 9747 "sc_score of %llu larger, keep sc->best %llu\n",
9453 pos->logging_uuid, 9748 pos->logging_uuid,
9454 sc->best->logging_uuid); 9749 sc->best->logging_uuid);
9455 continue; /* sc_score larger, keep sc->best */ 9750 continue; /* sc_score larger, keep sc->best */
@@ -9610,7 +9905,7 @@ transmit_on_queue (void *cls)
9610 GNUNET_NO); 9905 GNUNET_NO);
9611 GNUNET_assert (NULL != sc.best->bpm); 9906 GNUNET_assert (NULL != sc.best->bpm);
9612 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 9907 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9613 "%u %u %u %u %u\n", 9908 "%lu %lu %lu %lu %u\n",
9614 sizeof(struct GNUNET_PeerIdentity), 9909 sizeof(struct GNUNET_PeerIdentity),
9615 sizeof(struct TransportDVBoxMessage), 9910 sizeof(struct TransportDVBoxMessage),
9616 sizeof(struct TransportDVBoxPayloadP), 9911 sizeof(struct TransportDVBoxPayloadP),
@@ -9723,12 +10018,12 @@ transmit_on_queue (void *cls)
9723 struct GNUNET_TIME_Relative plus = GNUNET_TIME_relative_multiply ( 10018 struct GNUNET_TIME_Relative plus = GNUNET_TIME_relative_multiply (
9724 wait_duration, 4); 10019 wait_duration, 4);
9725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 10020 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9726 "Waiting %s (%llu) for ACK until %llu\n", 10021 "Waiting %s (%s) for ACK until %s\n",
9727 GNUNET_STRINGS_relative_time_to_string ( 10022 GNUNET_STRINGS_relative_time_to_string (
9728 GNUNET_TIME_relative_multiply ( 10023 GNUNET_TIME_relative_multiply (
9729 queue->pd.aged_rtt, 4), GNUNET_NO), 10024 queue->pd.aged_rtt, 4), GNUNET_NO),
9730 plus, 10025 GNUNET_STRINGS_relative_time_to_string (plus, GNUNET_YES),
9731 next); 10026 GNUNET_STRINGS_absolute_time_to_string (next));
9732 update_pm_next_attempt (pm, 10027 update_pm_next_attempt (pm,
9733 GNUNET_TIME_relative_to_absolute ( 10028 GNUNET_TIME_relative_to_absolute (
9734 GNUNET_TIME_relative_multiply (wait_duration, 10029 GNUNET_TIME_relative_multiply (wait_duration,
diff --git a/src/transport/test_transport_distance_vector_circle_topo.conf b/src/transport/test_transport_distance_vector_circle_topo.conf
index 210179291..e8d694c3a 100644
--- a/src/transport/test_transport_distance_vector_circle_topo.conf
+++ b/src/transport/test_transport_distance_vector_circle_topo.conf
@@ -1,7 +1,6 @@
1M:1 1M:1
2N:3 2N:3
3X:0 3X:0
4AC:1
5B:0 4B:0
6T:libgnunet_test_transport_plugin_cmd_simple_send_dv 5T:libgnunet_test_transport_plugin_cmd_simple_send_dv
7R:1|{tcp_port:0}|{udp_port:1} 6R:1|{tcp_port:0}|{udp_port:1}
diff --git a/src/transport/test_transport_distance_vector_inverse_topo.conf b/src/transport/test_transport_distance_vector_inverse_topo.conf
new file mode 100644
index 000000000..e062b3e2e
--- /dev/null
+++ b/src/transport/test_transport_distance_vector_inverse_topo.conf
@@ -0,0 +1,13 @@
1M:1
2N:4
3X:0
4AC:1
5T:libgnunet_test_transport_plugin_cmd_simple_send_dv
6R:1|{tcp_port:1}|{udp_port:0}
7R:2|{tcp_port:1}|{udp_port:0}
8R:3|{tcp_port:1}|{udp_port:0}
9R:4|{tcp_port:1}|{udp_port:0}
10P:1:1|{connect:{P:2:1:tcp}}|{AC:2}
11P:2:1|{connect:{P:3:1:tcp}}|{AC:2}
12P:3:1|{connect:{P:4:1:tcp}}|{AC:2}
13P:4:1|{AC:3} \ No newline at end of file
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c
index 154c0abca..a59452449 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -227,6 +227,7 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
227 unsigned int num; 227 unsigned int num;
228 struct TestState *ts = GNUNET_new (struct TestState); 228 struct TestState *ts = GNUNET_new (struct TestState);
229 struct GNUNET_TESTING_NetjailTopology *topology; 229 struct GNUNET_TESTING_NetjailTopology *topology;
230 unsigned int sscanf_ret = 0;
230 231
231 if (GNUNET_YES == *read_file) 232 if (GNUNET_YES == *read_file)
232 { 233 {
@@ -239,10 +240,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
239 240
240 ts->topology = topology; 241 ts->topology = topology;
241 242
243 errno = 0;
242 sscanf (m, "%u", &m_int); 244 sscanf (m, "%u", &m_int);
245 if (errno != 0)
246 {
247 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
248 }
249 GNUNET_assert (0 < sscanf_ret);
250 errno = 0;
243 sscanf (n, "%u", &n_int); 251 sscanf (n, "%u", &n_int);
252 if (errno != 0)
253 {
254 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
255 }
256 GNUNET_assert (0 < sscanf_ret);
257 errno = 0;
244 sscanf (local_m, "%u", &local_m_int); 258 sscanf (local_m, "%u", &local_m_int);
245 259 if (errno != 0)
260 {
261 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
262 }
263 GNUNET_assert (0 < sscanf_ret);
246 if (0 == n_int) 264 if (0 == n_int)
247 num = m_int; 265 num = m_int;
248 else 266 else
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_dv.c b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
index f1f168102..3ef2f64cd 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send_dv.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send_dv.c
@@ -107,8 +107,6 @@ handle_test (void *cls,
107{ 107{
108 struct GNUNET_PeerIdentity *peer = cls; 108 struct GNUNET_PeerIdentity *peer = cls;
109 const struct GNUNET_TESTING_AsyncContext *ac_block; 109 const struct GNUNET_TESTING_AsyncContext *ac_block;
110 const struct GNUNET_TESTING_AsyncContext *ac_start;
111 const struct GNUNET_TESTING_Command *cmd;
112 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 110 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
113 unsigned int connected; 111 unsigned int connected;
114 struct BlockState *bs; 112 struct BlockState *bs;
diff --git a/src/transport/test_transport_simple_send_dv_circle.sh b/src/transport/test_transport_simple_send_dv_circle.sh
index bd5f00abe..353d14f65 100755
--- a/src/transport/test_transport_simple_send_dv_circle.sh
+++ b/src/transport/test_transport_simple_send_dv_circle.sh
@@ -9,3 +9,4 @@ if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
9 fi 9 fi
10fi 10fi
11exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_distance_vector_circle_topo.conf" 11exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_distance_vector_circle_topo.conf"
12# sudo valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip/sed/bash ./test_transport_start_with_config test_transport_distance_vector_circle_topo.conf
diff --git a/src/transport/test_transport_simple_send_dv_inverse.sh b/src/transport/test_transport_simple_send_dv_inverse.sh
new file mode 100755
index 000000000..eac437cba
--- /dev/null
+++ b/src/transport/test_transport_simple_send_dv_inverse.sh
@@ -0,0 +1,11 @@
1#!/bin/bash
2if ! [ -d "/run/netns" ]; then
3 echo You have to create the directory /run/netns.
4fi
5if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" == 1 ]; then
6 # exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip/sed/bash ./test_transport_start_with_config test_transport_distance_vector_inverse_topo.conf"
7 exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_distance_vector_inverse_topo.conf"
8else
9 echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
10 exit 78
11fi
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 8ffc87070..c06c2abb3 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -773,6 +773,11 @@ struct GNUNET_TRANSPORT_IncomingMessage
773 */ 773 */
774 struct GNUNET_PeerIdentity sender; 774 struct GNUNET_PeerIdentity sender;
775 775
776 /**
777 * Direct neighbour sender identifier.
778 */
779 struct GNUNET_PeerIdentity neighbour_sender;
780
776 /* followed by the message */ 781 /* followed by the message */
777}; 782};
778 783
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c
index 2a80db87b..5bcfb30c7 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -540,12 +540,21 @@ handle_incoming_ack (
540 &incoming_ack->sender, 540 &incoming_ack->sender,
541 sizeof(struct GNUNET_PeerIdentity)))) 541 sizeof(struct GNUNET_PeerIdentity))))
542 { 542 {
543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
544 "Done with message with flow control id %lu for sender %s from sender %s\n",
545 incoming_ack->fc_id,
546 GNUNET_i2s (&fc->sender),
547 GNUNET_i2s (&incoming_ack->sender));
543 GNUNET_CONTAINER_DLL_remove (ch->fc_head, ch->fc_tail, fc); 548 GNUNET_CONTAINER_DLL_remove (ch->fc_head, ch->fc_tail, fc);
544 fc->cb (fc->cb_cls, GNUNET_OK); 549 fc->cb (fc->cb_cls, GNUNET_OK);
545 GNUNET_free (fc); 550 GNUNET_free (fc);
546 return; 551 return;
547 } 552 }
548 } 553 }
554 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
555 "Message with flow control id %lu from sender %s not found\n",
556 incoming_ack->fc_id,
557 GNUNET_i2s (&incoming_ack->sender));
549 GNUNET_break (0); 558 GNUNET_break (0);
550 disconnect (ch); 559 disconnect (ch);
551 /* TODO: maybe do this with exponential backoff/delay */ 560 /* TODO: maybe do this with exponential backoff/delay */
@@ -948,6 +957,10 @@ GNUNET_TRANSPORT_communicator_receive (
948 fc->cb = cb; 957 fc->cb = cb;
949 fc->cb_cls = cb_cls; 958 fc->cb_cls = cb_cls;
950 GNUNET_CONTAINER_DLL_insert (ch->fc_head, ch->fc_tail, fc); 959 GNUNET_CONTAINER_DLL_insert (ch->fc_head, ch->fc_tail, fc);
960 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
961 "Created flow control id %lu for sender %s\n",
962 fc->id,
963 GNUNET_i2s (&fc->sender));
951 } 964 }
952 GNUNET_MQ_send (ch->mq, env); 965 GNUNET_MQ_send (ch->mq, env);
953 return GNUNET_OK; 966 return GNUNET_OK;
@@ -1101,6 +1114,18 @@ GNUNET_TRANSPORT_communicator_address_remove (
1101 struct GNUNET_TRANSPORT_CommunicatorHandle *ch = ai->ch; 1114 struct GNUNET_TRANSPORT_CommunicatorHandle *ch = ai->ch;
1102 1115
1103 send_del_address (ai); 1116 send_del_address (ai);
1117 if (NULL == ai->prev)
1118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1119 "prev null\n");
1120 if (ch->ai_head == ai)
1121 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1122 "equals head\n");
1123 if (NULL == ai->next)
1124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1125 "next null\n");
1126 if (ch->ai_tail == ai)
1127 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1128 "equals tail\n");
1104 GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai); 1129 GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai);
1105 GNUNET_free (ai->address); 1130 GNUNET_free (ai->address);
1106 GNUNET_free (ai); 1131 GNUNET_free (ai);
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c
index 4ffd96210..b285d7abf 100644
--- a/src/transport/transport_api_cmd_backchannel_check.c
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -388,6 +388,8 @@ add_search_string (struct CheckState *cs, const struct
388 } 388 }
389 else 389 else
390 GNUNET_assert (0); 390 GNUNET_assert (0);
391 GNUNET_free (peer);
392 GNUNET_free (us);
391} 393}
392 394
393 395
@@ -400,17 +402,10 @@ backchannel_check_run (void *cls,
400 struct GNUNET_TESTING_Interpreter *is) 402 struct GNUNET_TESTING_Interpreter *is)
401{ 403{
402 struct CheckState *cs = cls; 404 struct CheckState *cs = cls;
403 // char *buf;
404 // char *part_one = "Delivering backchannel message from ";
405 // char *part_two = " of type 1460 to udp";
406 const struct GNUNET_TESTING_Command *system_cmd; 405 const struct GNUNET_TESTING_Command *system_cmd;
407 const struct GNUNET_TESTING_System *tl_system; 406 const struct GNUNET_TESTING_System *tl_system;
408 const struct GNUNET_TESTING_Command *peer1_cmd; 407 const struct GNUNET_TESTING_Command *peer1_cmd;
409 const struct GNUNET_TRANSPORT_ApplicationHandle *ah; 408 const struct GNUNET_TRANSPORT_ApplicationHandle *ah;
410 // struct GNUNET_PeerIdentity *peer;
411 // uint32_t num;
412 // struct GNUNET_TESTING_NodeConnection *pos_connection;
413 // unsigned int con_num = 0;
414 struct GNUNET_CONTAINER_MultiShortmapIterator *node_it; 409 struct GNUNET_CONTAINER_MultiShortmapIterator *node_it;
415 struct GNUNET_CONTAINER_MultiShortmapIterator *namespace_it; 410 struct GNUNET_CONTAINER_MultiShortmapIterator *namespace_it;
416 struct GNUNET_ShortHashCode node_key; 411 struct GNUNET_ShortHashCode node_key;
@@ -484,40 +479,7 @@ backchannel_check_run (void *cls,
484 } 479 }
485 } 480 }
486 } 481 }
487 /* for (pos_connection = cs->node_connections_head; NULL != pos_connection; */
488 /* pos_connection = pos_connection->next) */
489 /* { */
490 482
491 /* if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node)) */
492 /* { */
493 /* num = GNUNET_TESTING_calculate_num (pos_connection, cs->topology); */
494 /* peer = GNUNET_TESTING_get_pub_key (num, tl_system); */
495 /* LOG (GNUNET_ERROR_TYPE_DEBUG, */
496 /* "peer: %s\n", */
497 /* GNUNET_i2s (peer)); */
498
499 /* if (0 < GNUNET_asprintf (&buf, */
500 /* "%s%s%s", */
501 /* part_one, */
502 /* GNUNET_i2s (peer), */
503 /* part_two)) */
504 /* { */
505 /* GNUNET_array_append (cs->search_string, */
506 /* con_num, */
507 /* buf); */
508 /* /\*LOG (GNUNET_ERROR_TYPE_DEBUG, */
509 /* "con_num: %u search: %s %p\n", */
510 /* con_num, */
511 /* cs->search_string[con_num - 1], */
512 /* cs->search_string);*\/ */
513 /* } */
514 /* else */
515 /* GNUNET_assert (0); */
516 /* } */
517
518
519 /* } */
520 // cs->con_num = con_num;
521 if (0 != cs->con_num) 483 if (0 != cs->con_num)
522 { 484 {
523 cs->task = 485 cs->task =
@@ -527,6 +489,9 @@ backchannel_check_run (void *cls,
527 else 489 else
528 GNUNET_TESTING_async_finish (&cs->ac); 490 GNUNET_TESTING_async_finish (&cs->ac);
529 491
492 GNUNET_free (namespace_it);
493 GNUNET_free (node_it);
494
530} 495}
531 496
532 497
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c
index 8aba290c3..4d9e9c3ab 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -61,7 +61,6 @@ connect_peers_run (void *cls,
61 struct GNUNET_TESTING_AddressPrefix *pos_prefix; 61 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
62 unsigned int con_num = 0; 62 unsigned int con_num = 0;
63 const enum GNUNET_GenericReturnValue *broadcast; 63 const enum GNUNET_GenericReturnValue *broadcast;
64 char *port;
65 64
66 cps->is = is; 65 cps->is = is;
67 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 66 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
@@ -167,17 +166,18 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
167 cps->con_num_notified++; 166 cps->con_num_notified++;
168 GNUNET_free (peer_connection); 167 GNUNET_free (peer_connection);
169 } 168 }
170 if (cps->con_num == con_num) 169 if (cps->con_num_notified == con_num)
171 cps->additional_connects_notified++; 170 cps->additional_connects_notified++;
172 171
173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 172 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
174 "con_num: %u add: %u num_notified: %u add_notified: %u\n", 173 "con_num: %u add: %u num_notified: %u add_notified: %u peer: %s\n",
175 cps->con_num, 174 cps->con_num,
176 cps->additional_connects, 175 cps->additional_connects,
177 cps->con_num_notified, 176 cps->con_num_notified,
178 cps->additional_connects_notified); 177 cps->additional_connects_notified,
179 if (cps->con_num + cps->additional_connects == cps->con_num_notified 178 GNUNET_i2s (peer));
180 + cps->additional_connects_notified) 179 if ((cps->con_num == cps->con_num_notified) &&
180 (cps->additional_connects <= cps->additional_connects_notified))
181 { 181 {
182 GNUNET_TESTING_async_finish (&cps->ac); 182 GNUNET_TESTING_async_finish (&cps->ac);
183 } 183 }
@@ -241,6 +241,18 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
241 unsigned int additional_connects) 241 unsigned int additional_connects)
242{ 242{
243 struct ConnectPeersState *cps; 243 struct ConnectPeersState *cps;
244 unsigned int node_additional_connects;
245
246 node_additional_connects = GNUNET_TESTING_get_additional_connects (num,
247 topology);
248
249 LOG (GNUNET_ERROR_TYPE_DEBUG,
250 "global: %u and local: %u additional_connects\n",
251 additional_connects,
252 node_additional_connects);
253
254 if (0 != node_additional_connects)
255 additional_connects = node_additional_connects;
244 256
245 cps = GNUNET_new (struct ConnectPeersState); 257 cps = GNUNET_new (struct ConnectPeersState);
246 cps->start_peer_label = start_peer_label; 258 cps->start_peer_label = start_peer_label;
diff --git a/src/transport/transport_api_cmd_send_simple.c b/src/transport/transport_api_cmd_send_simple.c
index ade0cc914..a00e1b922 100644
--- a/src/transport/transport_api_cmd_send_simple.c
+++ b/src/transport/transport_api_cmd_send_simple.c
@@ -90,7 +90,8 @@ send_simple_cb (void *cls,
90 struct GNUNET_TRANSPORT_TESTING_TestMessage *test; 90 struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
91 91
92 LOG (GNUNET_ERROR_TYPE_DEBUG, 92 LOG (GNUNET_ERROR_TYPE_DEBUG,
93 "Sending simple test message\n"); 93 "Sending simple test message with mq %p\n",
94 mq);
94 95
95 env = GNUNET_MQ_msg_extra (test, 96 env = GNUNET_MQ_msg_extra (test,
96 1000 - sizeof(*test), 97 1000 - sizeof(*test),
@@ -116,13 +117,6 @@ send_simple_run (void *cls,
116 struct SendSimpleState *sss = cls; 117 struct SendSimpleState *sss = cls;
117 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 118 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
118 const struct GNUNET_TESTING_Command *peer1_cmd; 119 const struct GNUNET_TESTING_Command *peer1_cmd;
119 // struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode);
120 struct GNUNET_HashCode hc;
121 struct GNUNET_TESTING_NodeConnection *node_connections_head;
122 struct GNUNET_PeerIdentity *peer;
123 struct GNUNET_CRYPTO_EddsaPublicKey public_key;
124 uint32_t num;
125 struct GNUNET_TESTING_NodeConnection *pos_connection;
126 const struct GNUNET_TESTING_Command *system_cmd; 120 const struct GNUNET_TESTING_Command *system_cmd;
127 const struct GNUNET_TESTING_System *tl_system; 121 const struct GNUNET_TESTING_System *tl_system;
128 122
@@ -136,42 +130,10 @@ send_simple_run (void *cls,
136 GNUNET_TESTING_get_trait_test_system (system_cmd, 130 GNUNET_TESTING_get_trait_test_system (system_cmd,
137 &tl_system); 131 &tl_system);
138 132
139 node_connections_head = GNUNET_TESTING_get_connections (sss->num,
140 sss->topology);
141
142 GNUNET_CONTAINER_multishortmap_iterate ( 133 GNUNET_CONTAINER_multishortmap_iterate (
143 (struct GNUNET_CONTAINER_MultiShortmap *) 134 (struct GNUNET_CONTAINER_MultiShortmap *)
144 connected_peers_map, send_simple_cb, 135 connected_peers_map, send_simple_cb,
145 sss); 136 sss);
146 /*for (int i = 0; i < 1; i++)
147 {
148 for (pos_connection = node_connections_head; NULL != pos_connection;
149 pos_connection = pos_connection->next)
150 {
151 num = GNUNET_TESTING_calculate_num (pos_connection, sss->topology);
152 peer = GNUNET_TESTING_get_pub_key (num, tl_system);
153 public_key = peer->public_key;
154 GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
155
156 memcpy (key,
157 &hc,
158 sizeof (*key));
159 mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map,
160 key);
161 env = GNUNET_MQ_msg_extra (test,
162 1000 - sizeof(*test),
163 GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE);
164 test->num = htonl (sss->num);
165 memset (&test[1],
166 sss->num,
167 1000 - sizeof(*test));
168 GNUNET_MQ_send (mq,
169 env);
170 }
171 }*/
172
173 // GNUNET_free (key);
174
175} 137}
176 138
177 139
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 7448eff5a..4add06609 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -129,13 +129,16 @@ notify_connect (void *cls,
129 LOG (GNUNET_ERROR_TYPE_DEBUG, 129 LOG (GNUNET_ERROR_TYPE_DEBUG,
130 "This Peer %s \n", 130 "This Peer %s \n",
131 GNUNET_i2s (&sps->id)); 131 GNUNET_i2s (&sps->id));
132 LOG (GNUNET_ERROR_TYPE_DEBUG, 132
133 "Peer %s connected to peer number %u\n",
134 GNUNET_i2s (peer),
135 sps->no);
136 133
137 GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc); 134 GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
138 135
136 LOG (GNUNET_ERROR_TYPE_DEBUG,
137 "Peer %s connected to peer number %u with mq %p\n",
138 GNUNET_i2s (peer),
139 sps->no,
140 mq);
141
139 142
140 memcpy (key, 143 memcpy (key,
141 &hc, 144 &hc,