[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 01/02: - Added distance vector inverse path test case. - Enhanc
From: |
gnunet |
Subject: |
[gnunet] 01/02: - 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 m [...] |
Date: |
Wed, 05 Oct 2022 13:50:27 +0200 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
commit 247230d737e3e4709392148bfabbde25871b6914
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Tue Oct 4 14:28:51 2022 +0200
- 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
---
contrib/netjail/netjail_start.sh | 36 +-
contrib/netjail/topo.sh | 88 +++-
src/include/gnunet_testing_netjail_lib.h | 17 +
src/testing/gnunet-cmds-helper.c | 19 +-
src/testing/testing.c | 214 +++++---
.../testing_api_cmd_netjail_start_testsystem.c | 5 +-
src/transport/Makefile.am | 4 +-
src/transport/gnunet-communicator-tcp.c | 37 +-
src/transport/gnunet-communicator-udp.c | 6 +-
src/transport/gnunet-service-tng.c | 565 ++++++++++++++++-----
...test_transport_distance_vector_circle_topo.conf | 1 -
...est_transport_distance_vector_inverse_topo.conf | 13 +
.../test_transport_plugin_cmd_simple_send.c | 20 +-
.../test_transport_plugin_cmd_simple_send_dv.c | 2 -
.../test_transport_simple_send_dv_circle.sh | 1 +
.../test_transport_simple_send_dv_inverse.sh | 11 +
src/transport/transport.h | 5 +
src/transport/transport_api2_communication.c | 25 +
.../transport_api_cmd_backchannel_check.c | 45 +-
src/transport/transport_api_cmd_connecting_peers.c | 24 +-
src/transport/transport_api_cmd_send_simple.c | 42 +-
src/transport/transport_api_cmd_start_peer.c | 11 +-
22 files changed, 843 insertions(+), 348 deletions(-)
diff --git a/contrib/netjail/netjail_start.sh b/contrib/netjail/netjail_start.sh
index e2d5fd634..d03fa1c87 100755
--- a/contrib/netjail/netjail_start.sh
+++ b/contrib/netjail/netjail_start.sh
@@ -79,14 +79,46 @@ for N in $(seq $GLOBAL_N); do
then
#ip netns exec ${ROUTERS[$N]} nft add rule ip nat prerouting ip daddr
$GLOBAL_GROUP.$N tcp dport 60002 counter dnat to $LOCAL_GROUP.1
#ip netns exec ${ROUTERS[$N]} nft add rule ip filter FORWARD ip daddr
$LOCAL_GROUP.1 ct state new,related,established counter accept
- ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d
$GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
+ if [ "0" == "${R_TCP_ALLOWED_NUMBER[$N]}" ]; then
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp
-d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
+ else
+ delimiter=","
+ sources=$GLOBAL_GROUP."${R_TCP_ALLOWED[$N,1,1]}"
+ if [ "1" -lt "${R_TCP_ALLOWED_NUMBER[$N]}" ]
+ then
+ for ((i = 2; i <= ${R_TCP_ALLOWED_NUMBER[$N]}; i++))
+ do
+ echo $i
+ temp=$delimiter$GLOBAL_GROUP."${R_TCP_ALLOWED[$N,$i,1]}"
+ sources=$sources$temp
+ done
+ fi
+ echo $sources
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp
-s $sources -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
+ fi
ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m
state --state NEW,RELATED,ESTABLISHED -j ACCEPT
fi
if [ "1" == "${R_UDP[$N]}" ]
then
#ip netns exec ${ROUTERS[$N]} nft add rule ip nat prerouting ip daddr
$GLOBAL_GROUP.$N udp dport $PORT counter dnat to $LOCAL_GROUP.1
#ip netns exec ${ROUTERS[$N]} nft add rule ip filter FORWARD ip daddr
$LOCAL_GROUP.1 ct state new,related,established counter accept
- ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d
$GLOBAL_GROUP.$N --dport $PORT -j DNAT --to $LOCAL_GROUP.1
+ if [ "0" == "${R_UDP_ALLOWED_NUMBER[$N]}" ]; then
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp
-d $GLOBAL_GROUP.$N --dport $PORT -j DNAT --to $LOCAL_GROUP.1
+ else
+ delimiter=","
+ sources=$GLOBAL_GROUP."${R_UDP_ALLOWED[$N,1,1]}"
+ if [ "1" -lt "${R_UDP_ALLOWED_NUMBER[$N]}" ]
+ then
+ for ((i = 2; i <= ${R_UDP_ALLOWED_NUMBER[$N]}; i++))
+ do
+ echo $i
+ temp=$delimiter$GLOBAL_GROUP."${R_UDP_ALLOWED[$N,$i,1]}"
+ sources=$sources$temp
+ done
+ fi
+ echo $sources
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp
-s $GLOBAL_GROUP.$sources -d $GLOBAL_GROUP.$N --dport $PORT -j DNAT --to
$LOCAL_GROUP.1
+ fi
ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m
state --state NEW,RELATED,ESTABLISHED -j ACCEPT
fi
done
diff --git a/contrib/netjail/topo.sh b/contrib/netjail/topo.sh
index d7586d425..d94fa0bac 100755
--- a/contrib/netjail/topo.sh
+++ b/contrib/netjail/topo.sh
@@ -2,14 +2,18 @@
declare -A K_PLUGIN
declare -A R_TCP
+declare -A R_TCP_ALLOWED
+declare -i -A R_TCP_ALLOWED_NUMBER
declare -A R_UDP
+declare -A R_UDP_ALLOWED
+declare -i -A R_UDP_ALLOWED_NUMBER
declare -A P_PLUGIN
extract_attributes()
{
line_key=$1
line=$2
-
+
if [ "$line_key" = "P" ]
then
n=$(echo $line|cut -d \| -f 1|awk -F: '{print $2}')
@@ -21,34 +25,68 @@ extract_attributes()
echo $number
fi
- nf=$(echo $line|awk -F: '{print NF}')
+ #nf=$(echo $line|awk -F: '{print NF}')
+ nf=$(echo $line|awk -F\| '{print NF}')
for ((i=2;i<=$nf;i++))
do
- entry=$(echo $line |awk -v i=$i -F\| '{print $i}')
+ entry=$(echo $line |awk -v i=$i -F\| '{print $i}')
+ echo $entry
+ if [ "$(echo $entry|grep P)" = "" ]; then
+ key=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 1)
+ echo $key
+ value=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 2)
+ echo $value
+ if [ "$key" = "tcp_port" ]
+ then
+ R_TCP_ALLOWED_NUMBER[$number]=0
+ echo tcp port: $value
+ R_TCP[$number]=$value
+ elif [ "$key" = "udp_port" ]
+ then
+ R_UDP_ALLOWED_NUMBER[$number]=0
+ echo udp port: $value
+ R_UDP[$number]=$value
+ elif [ "$key" = "plugin" ]
+ then
+ echo plugin: $value
+ echo $line_key
+ if [ "$line_key" = "P" ]
+ then
+ P_PLUGIN[$n,$m]=$value
+ echo $n $m ${P_PLUGIN[$n,$m]}
+ elif [ "$line_key" = "K" ]
+ then
+ K_PLUGIN[$number]=$value
+ fi
+ fi
+ else
+ p1=$(echo $entry|cut -d P -f 2|cut -d } -f 1|cut -d : -f 2)
+ echo $p1
+ p2=$(echo $entry|cut -d P -f 2|cut -d } -f 1|cut -d : -f 3)
+ echo $p2
+ if [ "$key" = "tcp_port" ]
+ then
+ R_TCP_ALLOWED_NUMBER[$number]+=1
+
R_TCP_ALLOWED[$number,${R_TCP_ALLOWED_NUMBER[$number]},1]=$p1
+ R_TCP_ALLOWED[$number,${R_TCP_ALLOWED_NUMBER[$number]},2]=$p2
+ echo ${R_TCP_ALLOWED_NUMBER[$number]}
+ echo
${R_TCP_ALLOWED[$number,${R_TCP_ALLOWED_NUMBER[$number]},1]}
+ echo
${R_TCP_ALLOWED[$number,${R_TCP_ALLOWED_NUMBER[$number]},2]}
+ elif [ "$key" = "udp_port" ]
+ then
+ R_UDP_ALLOWED_NUMBER[$number]+=1
+
R_UDP_ALLOWED[$number,${R_UDP_ALLOWED_NUMBER[$number]},1]=$p1
+ R_UDP_ALLOWED[$number,${R_UDP_ALLOWED_NUMBER[$number]},2]=$p2
+ fi
+ fi
+ done
+ #for ((i=2;i<=$nf;i++))
+ # do
+ #entry=$(echo $line |awk -v i=$i -F\| '{print $i}')
key=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 1)
value=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 2)
- if [ "$key" = "tcp_port" ]
- then
- echo tcp port: $value
- R_TCP[$number]=$value
- elif [ "$key" = "udp_port" ]
- then
- echo udp port: $value
- R_UDP[$number]=$value
- elif [ "$key" = "plugin" ]
- then
- echo plugin: $value
- echo $line_key
- if [ "$line_key" = "P" ]
- then
- P_PLUGIN[$n,$m]=$value
- echo $n $m ${P_PLUGIN[$n,$m]}
- elif [ "$line_key" = "K" ]
- then
- K_PLUGIN[$number]=$value
- fi
- fi
- done
+
+ #done
}
parse_line(){
diff --git a/src/include/gnunet_testing_netjail_lib.h
b/src/include/gnunet_testing_netjail_lib.h
index 4b5d7cfa1..627bc2ef8 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/include/gnunet_testing_netjail_lib.h
@@ -164,6 +164,11 @@ struct GNUNET_TESTING_NetjailNode
*/
unsigned int node_n;
+ /**
+ * The number of unintentional additional connections this node waits for.
This overwrites the global additional_connects value.
+ */
+ unsigned int additional_connects;
+
/**
* Head of the DLL with the connections which shall be established to other
nodes.
*/
@@ -259,6 +264,18 @@ struct GNUNET_TESTING_NetjailTopology *
GNUNET_TESTING_get_topo_from_string (char *data);
+/**
+ * Get the number of unintentional additional connections the node waits for.
+ *
+ * @param num The specific node we want the additional connects for.
+ * @return The number of additional connects
+ */
+unsigned int
+GNUNET_TESTING_get_additional_connects (unsigned int num,
+ struct GNUNET_TESTING_NetjailTopology *
+ topology);
+
+
/**
* Get the connections to other nodes for a specific node.
*
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index f6f079802..178b1b133 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -561,6 +561,7 @@ main (int argc, char **argv)
struct GNUNET_GETOPT_CommandLineOption options[] =
{ GNUNET_GETOPT_OPTION_END };
int ret;
+ unsigned int sscanf_ret;
int i;
size_t topology_data_length = 0;
unsigned int read_file;
@@ -575,11 +576,16 @@ main (int argc, char **argv)
ni->m = argv[3];
ni->n = argv[4];
- sscanf (argv[5], "%u", &read_file);
+ errno = 0;
+ sscanf_ret = sscanf (argv[5], "%u", &read_file);
- if (1 == read_file)
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ else if (1 == read_file)
ni->topology_data = argv[6];
- else
+ else if (0 == read_file)
{
for (i = 6; i<argc; i++)
topology_data_length += strlen (argv[i]) + 1;
@@ -587,12 +593,19 @@ main (int argc, char **argv)
"topo data length %lu\n",
topology_data_length);
ni->topology_data = GNUNET_malloc (topology_data_length);
+ memset (ni->topology_data, '\0', topology_data_length);
for (i = 6; i<argc; i++)
{
strcat (ni->topology_data, argv[i]);
strcat (ni->topology_data, cr);
}
}
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Wrong input for the fourth argument\n");
+ }
+ GNUNET_assert (0 < sscanf_ret);
ni->read_file = &read_file;
ni->topology_data[topology_data_length - 1] = '\0';
LOG (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 6480d32f9..f2482e6f3 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -1809,6 +1809,7 @@ get_key (char *line)
{
char *copy;
size_t slen;
+ size_t tlen;
char *token;
char *ret;
char *rest = NULL;
@@ -1817,8 +1818,9 @@ get_key (char *line)
copy = malloc (slen);
memcpy (copy, line, slen);
token = strtok_r (copy, ":", &rest);
- ret = malloc (2);
- memcpy (ret, token, 2);
+ tlen = strlen (token) + 1;
+ ret = malloc (tlen);
+ memcpy (ret, token, tlen);
GNUNET_free (copy);
return ret;
}
@@ -1911,6 +1913,7 @@ get_connect_value (char *line, struct
GNUNET_TESTING_NetjailNode *node)
char *rest = NULL;
char *rest2 = NULL;
struct GNUNET_TESTING_AddressPrefix *prefix;
+ unsigned int sscanf_ret;
node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
node_connection->node = node;
@@ -1934,10 +1937,22 @@ get_connect_value (char *line, struct
GNUNET_TESTING_NetjailNode *node)
{
node_connection->node_type = GNUNET_TESTING_SUBNET_NODE;
token = strtok_r (NULL, ":", &rest);
- sscanf (token, "%u", &namespace_n);
+ errno = 0;
+ sscanf_ret = sscanf (token, "%u", &namespace_n);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
node_connection->namespace_n = namespace_n;
token = strtok_r (NULL, ":", &rest);
- sscanf (token, "%u", &node_n);
+ errno = 0;
+ sscanf_ret = sscanf (token, "%u", &node_n);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
node_connection->node_n = node_n;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"node_n %u namespace_n %u node->node_n %u node->namespace_n %u\n",
@@ -1946,6 +1961,11 @@ get_connect_value (char *line, struct
GNUNET_TESTING_NetjailNode *node)
node->node_n,
node->namespace_n);
}
+ else
+ {
+ GNUNET_free (node_connection);
+ }
+
while (NULL != (token = strtok_r (NULL, ":", &rest)))
{
prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
@@ -2085,30 +2105,22 @@ log_topo (struct GNUNET_TESTING_NetjailTopology
*topology)
return GNUNET_YES;
}
-
-/**
- * Get the connections to other nodes for a specific node.
- *
- * @param num The specific node we want the connections for.
- * @param topology The topology we get the connections from.
- * @return The connections of the node.
- */
-struct GNUNET_TESTING_NodeConnection *
-GNUNET_TESTING_get_connections (unsigned int num, struct
- GNUNET_TESTING_NetjailTopology *topology)
+void
+get_node_info (unsigned int num,
+ struct GNUNET_TESTING_NetjailTopology *topology,
+ struct GNUNET_TESTING_NetjailNode **node_ex,
+ struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
+ struct GNUNET_TESTING_NodeConnection **node_connections_ex)
{
- struct GNUNET_TESTING_NetjailNode *node;
struct GNUNET_ShortHashCode *hkey;
struct GNUNET_HashCode hc;
+ unsigned int namespace_n;
+ unsigned int node_m;
+ struct GNUNET_TESTING_NetjailNode *node;
struct GNUNET_TESTING_NetjailNamespace *namespace;
- unsigned int namespace_n, node_m;
- struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
+ struct GNUNET_TESTING_NodeConnection *node_connections;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "gaga 1\n");
log_topo (topology);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "gaga 2\n");
hkey = GNUNET_new (struct GNUNET_ShortHashCode);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"num: %u \n",
@@ -2142,21 +2154,53 @@ GNUNET_TESTING_get_connections (unsigned int num, struct
sizeof (*hkey));
namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
hkey);
- if (NULL == namespace)
- return NULL;
- node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
- hkey = GNUNET_new (struct GNUNET_ShortHashCode);
- GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
- memcpy (hkey,
- &hc,
- sizeof (*hkey));
- node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
- hkey);
- if (NULL != node)
- node_connections = node->node_connections_head;
+ if (NULL != namespace)
+ {
+ node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
+ hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+ GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
+ hkey);
+ if (NULL != node)
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "node additional_connects: %u %p\n",
+ node->additional_connects,
+ node);
+ node_connections = node->node_connections_head;
+ }
+ *node_ex = node;
+ *namespace_ex = namespace;
+ *node_connections_ex = node_connections;
+ }
+ GNUNET_free (hkey);
}
+}
+
+
+/**
+ * Get the connections to other nodes for a specific node.
+ *
+ * @param num The specific node we want the connections for.
+ * @param topology The topology we get the connections from.
+ * @return The connections of the node.
+ */
+struct GNUNET_TESTING_NodeConnection *
+GNUNET_TESTING_get_connections (unsigned int num,
+ struct GNUNET_TESTING_NetjailTopology
*topology)
+{
+ struct GNUNET_TESTING_NetjailNode *node;
+ struct GNUNET_TESTING_NetjailNamespace *namespace;
+ struct GNUNET_TESTING_NodeConnection *node_connections;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "get_connections\n");
+
+ get_node_info (num, topology, &node, &namespace, &node_connections);
- GNUNET_free (hkey);
return node_connections;
}
@@ -2175,8 +2219,7 @@ GNUNET_TESTING_get_pub_key (unsigned int num,
struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
GNUNET_CRYPTO_EddsaPublicKey);
- struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct
-
GNUNET_CRYPTO_EddsaPrivateKey);
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
priv_key = GNUNET_TESTING_hostkey_get (tl_system,
num,
@@ -2199,25 +2242,17 @@ free_nodes_cb (void *cls,
(void) cls;
struct GNUNET_TESTING_NetjailNode *node = value;
struct GNUNET_TESTING_NodeConnection *pos_connection;
- struct GNUNET_TESTING_NodeConnection *tmp_connection;
struct GNUNET_TESTING_AddressPrefix *pos_prefix;
- struct GNUNET_TESTING_AddressPrefix *tmp_prefix;
- pos_connection = node->node_connections_head;
-
- while (NULL != pos_connection->next)
+ while (NULL != (pos_connection = node->node_connections_head))
{
- pos_prefix = pos_connection->address_prefixes_head;
- while (NULL != pos_prefix->next)
+ while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
{
- tmp_prefix = pos_prefix->next;
- GNUNET_free (pos_prefix);
- pos_prefix = tmp_prefix;
+ GNUNET_free (pos_prefix->address_prefix);
}
- tmp_connection = pos_connection->next;
GNUNET_free (pos_connection);
- pos_connection = tmp_connection;
}
+
GNUNET_free (node->plugin);
GNUNET_free (node);
return GNUNET_OK;
@@ -2348,6 +2383,34 @@ GNUNET_TESTING_get_address (struct
GNUNET_TESTING_NodeConnection *connection,
return addr;
}
+/**
+ * Get the number of unintentional additional connections the node waits for.
+ *
+ * @param num The specific node we want the additional connects for.
+ * @return The number of additional connects
+ */
+unsigned int
+GNUNET_TESTING_get_additional_connects (unsigned int num,
+ struct GNUNET_TESTING_NetjailTopology *
+ topology)
+{
+ struct GNUNET_TESTING_NetjailNode *node;
+ struct GNUNET_TESTING_NetjailNamespace *namespace;
+ struct GNUNET_TESTING_NodeConnection *node_connections;
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "get_additional_connects\n");
+
+ get_node_info (num, topology, &node, &namespace, &node_connections);
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "node additional_connects: %u %p\n",
+ node->additional_connects,
+ node);
+
+ return node->additional_connects;
+}
+
/**
* Create a GNUNET_CMDS_LOCAL_FINISHED message.
@@ -2389,9 +2452,9 @@ GNUNET_TESTING_get_topo_from_string (char *data)
char *rest = NULL;
char *value = NULL;
char *value2;
+ char *ac_value;
int ret;
struct GNUNET_TESTING_NetjailTopology *topo;
- struct GNUNET_TESTING_NetjailNode *node;
struct GNUNET_TESTING_NetjailRouter *router;
struct GNUNET_TESTING_NetjailNamespace *namespace;
struct GNUNET_ShortHashCode *hkey;
@@ -2466,7 +2529,8 @@ GNUNET_TESTING_get_topo_from_string (char *data)
else if (0 == strcmp (key, "K"))
{
hkey = GNUNET_new (struct GNUNET_ShortHashCode);
- node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
+ struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
+
GNUNET_TESTING_NetjailNode);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get first Value for K.\n");
@@ -2474,12 +2538,12 @@ GNUNET_TESTING_get_topo_from_string (char *data)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"K: %u\n",
out);
- node->node_n = out;
+ k_node->node_n = out;
GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
memcpy (hkey,
&hc,
sizeof (*hkey));
- node->is_global = GNUNET_YES;
+ k_node->is_global = GNUNET_YES;
if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
topo->map_globals,
@@ -2488,7 +2552,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
else
GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
hkey,
- node,
+ k_node,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get value for key value on K.\n");
@@ -2496,14 +2560,14 @@ GNUNET_TESTING_get_topo_from_string (char *data)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"value: %s\n",
value);
- node->plugin = value;
- node_connections (token, node);
+ k_node->plugin = value;
+ node_connections (token, k_node);
+ GNUNET_free (value);
}
else if (0 == strcmp (key, "R"))
{
hkey = GNUNET_new (struct GNUNET_ShortHashCode);
router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
- node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get first Value for R.\n");
@@ -2511,7 +2575,6 @@ GNUNET_TESTING_get_topo_from_string (char *data)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"R: %u\n",
out);
- node->node_n = out;
GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
memcpy (hkey,
&hc,
@@ -2523,18 +2586,19 @@ GNUNET_TESTING_get_topo_from_string (char *data)
"tcp_port: %s\n",
value);
ret = sscanf (value, "%u", &(router->tcp_port));
-
+ GNUNET_free (value);
GNUNET_break (0 != ret && 1 >= router->tcp_port);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get value for key udp_port on R.\n");
value2 = get_value ("udp_port", token);
ret = sscanf (value2, "%u", &(router->udp_port));
+ GNUNET_free (value2);
GNUNET_break (0 != ret && 1 >= router->udp_port);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"udp_port: %s\n",
value2);
-
+ GNUNET_free (value2);
if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
topo->map_namespaces,
hkey))
@@ -2557,8 +2621,8 @@ GNUNET_TESTING_get_topo_from_string (char *data)
}
else if (0 == strcmp (key, "P"))
{
- hkey = GNUNET_new (struct GNUNET_ShortHashCode);
- node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
+ struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
+
GNUNET_TESTING_NetjailNode);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get first Value for P.\n");
@@ -2606,10 +2670,10 @@ GNUNET_TESTING_get_topo_from_string (char *data)
}
else
{
- node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
+
GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
hkey,
- node,
+ p_node,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Get value for key plugin on P.\n");
@@ -2617,11 +2681,23 @@ GNUNET_TESTING_get_topo_from_string (char *data)
LOG (GNUNET_ERROR_TYPE_DEBUG,
"plugin: %s\n",
value);
- node->plugin = value;
- node->node_n = out;
- node->namespace_n = namespace->namespace_n;
+ memcpy (p_node->plugin, value, sizeof (*value));
+ GNUNET_free (value);
+ p_node->node_n = out;
+ p_node->namespace_n = namespace->namespace_n;
}
- node_connections (token, node);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Get AC Value for P.\n");
+ ac_value = get_value ("AC", token);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "ac value: %s\n",
+ ac_value);
+ sscanf (ac_value, "%u", &p_node->additional_connects);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "P:AC %u\n",
+ p_node->additional_connects);
+ node_connections (token, p_node);
+ GNUNET_free (ac_value);
}
token = strtok_r (NULL, "\n", &rest);
if (NULL != token)
@@ -2631,8 +2707,6 @@ GNUNET_TESTING_get_topo_from_string (char *data)
}
if (NULL != key)
GNUNET_free (key);
- /*if (NULL != value)
- GNUNET_free (value);*/
return topo;
}
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c
b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index 0624a7f46..972c566d6 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -300,7 +300,6 @@ send_message_to_locals (
tbc);
tbc->shandle = sh;
- // GNUNET_array_append (tbc->shandle, tbc->n_shandle, sh);
}
@@ -319,6 +318,7 @@ send_all_local_tests_prepared (unsigned int i, unsigned int
j, struct
reply->header.size = htons ((uint16_t) msg_length);
send_message_to_locals (i, j, ns, &reply->header);
+ GNUNET_free (reply);
}
@@ -337,6 +337,7 @@ send_all_peers_started (unsigned int i, unsigned int j,
struct NetJailState *ns)
reply->header.size = htons ((uint16_t) msg_length);
send_message_to_locals (i, j, ns, &reply->header);
+ GNUNET_free (reply);
}
@@ -702,10 +703,10 @@ start_helper (struct NetJailState *ns,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Send handle is NULL!\n");
- GNUNET_free (msg);
GNUNET_TESTING_interpreter_fail (ns->is);
}
GNUNET_free (hkey);
+ GNUNET_free (msg);
}
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= \
test_transport_simple_send.sh \
test_transport_simple_send_broadcast.sh \
test_transport_udp_backchannel.sh \
- test_transport_simple_send_dv_circle.sh
- # test_transport_simple_send_dv_inverse.sh
+ test_transport_simple_send_dv_circle.sh \
+ test_transport_simple_send_dv_inverse.sh
endif
test_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)
GNUNET_TIME_absolute_ntoh (thp.monotonic_time)));
GNUNET_assert (ntohl ((&thp)->purpose.size) == sizeof (*(&thp)));
if (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_verify
(GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY,
- &thp,
- &rekey->sender_sig,
- &queue->target.public_key))
+ GNUNET_CRYPTO_eddsa_verify (
+ GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_REKEY,
+ &thp,
+ &rekey->sender_sig,
+ &queue->target.public_key))
{
GNUNET_break (0);
queue_finish (queue);
@@ -1447,7 +1448,8 @@ handshake_ack_monotime_cb (void *cls,
* @param queue The queue context.
*/
static void
-send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct Queue
*queue)
+send_challenge (struct GNUNET_CRYPTO_ChallengeNonceP challenge, struct
+ Queue *queue)
{
struct TCPConfirmationAck tca;
struct TcpHandshakeAckSignature thas;
@@ -1605,7 +1607,11 @@ queue_write (void *cls)
}
/* can we encrypt more? (always encrypt full messages, needed
such that #mq_cancel() can work!) */
- if ((0 < queue->rekey_left_bytes) &&
+ unsigned int we_do_not_need_to_rekey = (0 < queue->rekey_left_bytes
+ - (queue->cwrite_off
+ + queue->pwrite_off
+ + sizeof (struct TCPRekey)));
+ if (we_do_not_need_to_rekey &&
(queue->pwrite_off > 0) &&
(queue->cwrite_off + queue->pwrite_off <= BUF_SIZE))
{
@@ -1625,11 +1631,11 @@ queue_write (void *cls)
queue->pwrite_off = 0;
}
// if ((-1 != unverified_size)&& ((0 == queue->pwrite_off) &&
- if (((0 == queue->pwrite_off) &&
- ((0 == queue->rekey_left_bytes) ||
- (0 ==
- GNUNET_TIME_absolute_get_remaining (
- queue->rekey_time).rel_value_us))))
+ if (((0 == queue->rekey_left_bytes) ||
+ (0 == GNUNET_TIME_absolute_get_remaining (
+ queue->rekey_time).rel_value_us)) &&
+ (((0 == queue->pwrite_off) || ! we_do_not_need_to_rekey)&&
+ (queue->cwrite_off + sizeof (struct TCPRekey) <= BUF_SIZE)))
{
inject_rekey (queue);
}
@@ -2272,8 +2278,9 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t
*sock_len)
struct sockaddr_in6 v6;
char *start;
+ memset (&v4, 0, sizeof(v4));
start = extract_address (bindto);
- // FIXME: check NULL == start
+ GNUNET_assert (NULL != start);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"start %s\n",
start);
@@ -2472,7 +2479,8 @@ transmit_kx (struct Queue *queue,
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
&tc.challenge,
sizeof(tc.challenge));
- ths.purpose.purpose = htonl
(GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
+ ths.purpose.purpose = htonl (
+ GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
ths.purpose.size = htonl (sizeof(ths));
ths.sender = my_identity;
ths.receiver = queue->target;
@@ -2625,7 +2633,8 @@ decrypt_and_check_tc (struct Queue *queue,
sizeof(*tc),
&ibuf[sizeof(struct GNUNET_CRYPTO_EcdhePublicKey)],
sizeof(*tc)));
- ths.purpose.purpose = htonl
(GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
+ ths.purpose.purpose = htonl (
+ GNUNET_SIGNATURE_PURPOSE_COMMUNICATOR_TCP_HANDSHAKE);
ths.purpose.size = htonl (sizeof(ths));
ths.sender = tc->sender;
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,
uint16_t type;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "try_handle_plaintext of size %u (%u %u) and type %u\n",
+ "try_handle_plaintext of size %lu (%u %lu) and type %u\n",
buf_size,
ntohs (hdr->size),
sizeof(*hdr),
@@ -2394,6 +2394,7 @@ sock_read (void *cls)
GNUNET_i2s (&sender));
GNUNET_TRANSPORT_application_validate (ah, &sender, nt, addr_s);
GNUNET_free (addr_s);
+ GNUNET_free (addr_verify);
return;
}
else
@@ -2589,6 +2590,8 @@ udp_address_to_sockaddr (const char *bindto, socklen_t
*sock_len)
{
/* try IPv4 */
struct sockaddr_in v4;
+
+ memset (&v4, 0, sizeof(v4));
if (1 == inet_pton (AF_INET, cp, &v4.sin_addr))
{
v4.sin_family = AF_INET;
@@ -2607,6 +2610,7 @@ udp_address_to_sockaddr (const char *bindto, socklen_t
*sock_len)
struct sockaddr_in6 v6;
const char *start;
+ memset (&v6, 0, sizeof(v6));
start = cp;
if (('[' == *cp) && (']' == cp[strlen (cp) - 1]))
{
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
@@ -81,6 +81,11 @@
#include "gnunet_signatures.h"
#include "transport.h"
+/**
+ * Size of ring buffer to cache CORE and forwarded DVBox messages.
+ */
+#define RING_BUFFER_SIZE 16
+
/**
* Maximum number of FC retransmissions for a runing retransmission task.
*/
@@ -1180,6 +1185,11 @@ struct CommunicatorMessageContext
*/
struct GNUNET_TRANSPORT_IncomingMessage im;
+ /**
+ * The message to demultiplex.
+ */
+ const struct GNUNET_MessageHeader *mh;
+
/**
* Number of hops the message has travelled (if DV-routed).
* FIXME: make use of this in ACK handling!
@@ -1188,6 +1198,23 @@ struct CommunicatorMessageContext
};
+/**
+ * Entry for the ring buffer caching messages send to core, when virtual link
is avaliable.
+ **/
+struct RingBufferEntry
+{
+ /**
+ * Communicator context for this ring buffer entry.
+ **/
+ struct CommunicatorMessageContext *cmc;
+
+ /**
+ * The message in this entry.
+ **/
+ struct GNUNET_MessageHeader *mh;
+};
+
+
/**
* Closure for #core_env_sent_cb.
*/
@@ -2168,9 +2195,15 @@ struct PendingMessage
/**
* Target of the request (always the ultimate destination!).
+ * Might be NULL in case of a forwarded DVBox we have no validated neighbour.
*/
struct VirtualLink *vl;
+ /**
+ * In case of a not validated neighbour, we store the target peer.
+ **/
+ struct GNUNET_PeerIdentity target;
+
/**
* Set to non-NULL value if this message is currently being given to a
* communicator and we are awaiting that communicator's acknowledgement.
@@ -2668,6 +2701,36 @@ struct Backtalker
};
+/**
+ * Ring buffer for a CORE message we did not deliver to CORE, because of
missing virtual link to sender.
+ */
+static struct RingBufferEntry *ring_buffer[RING_BUFFER_SIZE];
+
+/**
+ * Head of the ring buffer.
+ */
+static unsigned int ring_buffer_head;
+
+/**
+ * Is the ring buffer filled up to RING_BUFFER_SIZE.
+ */
+static unsigned int is_ring_buffer_full;
+
+/**
+ * Ring buffer for a forwarded DVBox message we did not deliver to the next
hop, because of missing virtual link that hop.
+ */
+static struct PendingMessage *ring_buffer_dv[RING_BUFFER_SIZE];
+
+/**
+ * Head of the ring buffer.
+ */
+static unsigned int ring_buffer_dv_head;
+
+/**
+ * Is the ring buffer filled up to RING_BUFFER_SIZE.
+ */
+static unsigned int is_ring_buffer_dv_full;
+
/**
* Head of linked list of all clients to this service.
*/
@@ -2777,18 +2840,6 @@ static struct GNUNET_SCHEDULER_Task *dvlearn_task;
*/
static struct GNUNET_SCHEDULER_Task *validation_task;
-/**
- * The most recent PA we have created, head of DLL.
- * The length of the DLL is kept in #pa_count.
- */
-static struct PendingAcknowledgement *pa_head;
-
-/**
- * The oldest PA we have created, tail of DLL.
- * The length of the DLL is kept in #pa_count.
- */
-static struct PendingAcknowledgement *pa_tail;
-
/**
* List of incoming connections where we are trying
* to get a connection back established. Length
@@ -2811,12 +2862,6 @@ static unsigned int ir_total;
*/
static unsigned long long logging_uuid_gen;
-/**
- * Number of entries in the #pa_head/#pa_tail DLL. Used to
- * limit the size of the data structure.
- */
-static unsigned int pa_count;
-
/**
* Monotonic time we use for HELLOs generated at this time. TODO: we
* should increase this value from time to time (i.e. whenever a
@@ -2949,8 +2994,9 @@ free_fragment_tree (struct PendingMessage *root)
GNUNET_CONTAINER_DLL_remove (frag->qe->queue->queue_head,
frag->qe->queue->queue_tail,
frag->qe);
+ frag->qe->queue->queue_length--;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing QueueEntry MID %llu from queue\n",
+ "Removing QueueEntry MID %lu from queue\n",
frag->qe->mid);
GNUNET_free (frag->qe);
}
@@ -2989,7 +3035,7 @@ free_pending_message (struct PendingMessage *pm)
if ((NULL != vl) && (NULL == pm->frag_parent))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing pm %lu\n",
+ "Removing pm %llu\n",
pm->logging_uuid);
GNUNET_CONTAINER_MDLL_remove (vl,
vl->pending_msg_head,
@@ -3022,20 +3068,23 @@ free_pending_message (struct PendingMessage *pm)
GNUNET_CONTAINER_DLL_remove (pm->qe->queue->queue_head,
pm->qe->queue->queue_tail,
pm->qe);
+ pm->qe->queue->queue_length--;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing QueueEntry MID %llu from queue\n",
+ "Removing QueueEntry MID %lu from queue\n",
pm->qe->mid);
GNUNET_free (pm->qe);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "QueueEntry MID freed\n");
}
if (NULL != pm->bpm)
{
free_fragment_tree (pm->bpm);
GNUNET_free (pm->bpm);
}
- if (NULL == pm)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "free pending pm null\n");
+
GNUNET_free (pm);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Freeing pm done\n");
}
@@ -3755,6 +3804,9 @@ free_queue (struct Queue *queue)
maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <=
tc->details.communicator.
total_queue_length);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaning up queue with length %u\n",
+ queue->queue_length);
while (NULL != (qe = queue->queue_head))
{
GNUNET_CONTAINER_DLL_remove (queue->queue_head, queue->queue_tail, qe);
@@ -3767,6 +3819,9 @@ free_queue (struct Queue *queue)
}
GNUNET_free (qe);
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaning up queue with length %u\n",
+ queue->queue_length);
GNUNET_assert (0 == queue->queue_length);
if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT >
tc->details.communicator.total_queue_length))
@@ -3787,7 +3842,7 @@ free_queue (struct Queue *queue)
GNUNET_free (queue);
vl = lookup_virtual_link (&neighbour->pid);
- if ((NULL != vl) && (GNUNET_YES == vl->confirmed) && (neighbour == vl->n))
+ if ((NULL != vl) && (neighbour == vl->n))
{
GNUNET_SCHEDULER_cancel (vl->visibility_task);
check_link_down (vl);
@@ -4192,7 +4247,9 @@ check_communicator_available (
* @param cmc context for which we are done handling the message
*/
static void
-finish_cmc_handling (struct CommunicatorMessageContext *cmc)
+finish_cmc_handling_with_continue (struct CommunicatorMessageContext *cmc,
+ unsigned
+ int continue_client)
{
if (0 != ntohl (cmc->im.fc_on))
{
@@ -4200,17 +4257,31 @@ finish_cmc_handling (struct CommunicatorMessageContext
*cmc)
struct GNUNET_MQ_Envelope *env;
struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Acknowledge message with flow control id %lu\n",
+ cmc->im.fc_id);
env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK);
ack->reserved = htonl (0);
ack->fc_id = cmc->im.fc_id;
- ack->sender = cmc->im.sender;
+ ack->sender = cmc->im.neighbour_sender;
GNUNET_MQ_send (cmc->tc->mq, env);
}
- GNUNET_SERVICE_client_continue (cmc->tc->client);
+
+ if (GNUNET_YES == continue_client)
+ {
+ GNUNET_SERVICE_client_continue (cmc->tc->client);
+ }
GNUNET_free (cmc);
}
+static void
+finish_cmc_handling (struct CommunicatorMessageContext *cmc)
+{
+ finish_cmc_handling_with_continue (cmc, GNUNET_YES);
+}
+
+
/**
* Client confirms that it is done handling message(s) to a particular
* 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)
}
delta = ntohl (rom->increase_window_delta);
vl->core_recv_window += delta;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CORE ack receiving message, increased CORE recv window to %u\n",
+ vl->core_recv_window);
if (vl->core_recv_window <= 0)
return;
/* resume communicators */
@@ -4254,6 +4328,7 @@ handle_client_recv_ok (void *cls, const struct
RecvOkMessage *rom)
GNUNET_CONTAINER_DLL_remove (vl->cmc_head, vl->cmc_tail, cmc);
finish_cmc_handling (cmc);
}
+ GNUNET_SERVICE_client_continue (tc->client);
}
@@ -4403,14 +4478,14 @@ queue_send_msg (struct Queue *queue,
qe->pm = pm;
// TODO Why do we have a retransmission. When we know, make decision if
we still want this.
// GNUNET_assert (NULL == pm->qe);
- /*if (NULL != pm->qe)
+ if (NULL != pm->qe)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Retransmitting message <%llu> remove pm from qe with MID:
%llu \n",
pm->logging_uuid,
(unsigned long long) pm->qe->mid);
- pm->qe->pm = NULL;
- }*/
+ // pm->qe->pm = NULL;
+ }
pm->qe = qe;
}
GNUNET_CONTAINER_DLL_insert (queue->queue_head, queue->queue_tail, qe);
@@ -4434,7 +4509,7 @@ queue_send_msg (struct Queue *queue,
if (0 == queue->q_capacity)
queue->idle = GNUNET_NO;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending message MID %llu of type %u (%u) and size %u with MQ
%p\n",
+ "Sending message MID %lu of type %u (%u) and size %lu with MQ
%p\n",
smt->mid,
ntohs (((const struct GNUNET_MessageHeader *) payload)->type),
ntohs (smt->header.size),
@@ -5104,7 +5179,7 @@ check_vl_transmission (struct VirtualLink *vl)
vl->outbound_fc_window_size)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Stalled message %lu transmission on VL %s due to flow
control: %llu < %llu\n",
+ "Stalled message %llu transmission on VL %s due to flow
control: %llu < %llu\n",
pm->logging_uuid,
GNUNET_i2s (&vl->target),
(unsigned long long) vl->outbound_fc_window_size,
@@ -5157,11 +5232,12 @@ check_vl_transmission (struct VirtualLink *vl)
else
{
vl_next_hop = lookup_virtual_link (&nh->pid);
+ GNUNET_assert (NULL != vl_next_hop);
if (pm->bytes_msg + vl_next_hop->outbound_fc_window_size_used >
vl_next_hop->outbound_fc_window_size)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Stalled message %lu transmission on next hop %s due
to flow control: %llu < %llu\n",
+ "Stalled message %llu transmission on next hop %s due
to flow control: %llu < %llu\n",
pm->logging_uuid,
GNUNET_i2s (&vl_next_hop->target),
(unsigned long
@@ -5195,7 +5271,7 @@ check_vl_transmission (struct VirtualLink *vl)
}
if (GNUNET_YES == elig)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Eligible message %lu of size %llu to %s: %llu/%llu\n",
+ "Eligible message %llu of size %u to %s: %llu/%llu\n",
pm->logging_uuid,
pm->bytes_msg,
GNUNET_i2s (&vl->target),
@@ -5532,8 +5608,7 @@ handle_del_address (void *cls,
* @param msg message to demultiplex
*/
static void
-demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
- const struct GNUNET_MessageHeader *msg);
+demultiplex_with_cmc (struct CommunicatorMessageContext *cmc);
/**
@@ -5564,60 +5639,15 @@ core_env_sent_cb (void *cls)
}
-/**
- * Communicator gave us an unencapsulated message to pass as-is to
- * CORE. Process the request.
- *
- * @param cls a `struct CommunicatorMessageContext` (must call
- * #finish_cmc_handling() when done)
- * @param mh the message that was received
- */
static void
-handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
+finish_handling_raw_message (struct VirtualLink *vl,
+ const struct GNUNET_MessageHeader *mh,
+ struct CommunicatorMessageContext *cmc,
+ unsigned int continue_client)
{
- struct CommunicatorMessageContext *cmc = cls;
- struct VirtualLink *vl;
uint16_t size = ntohs (mh->size);
int have_core;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Handling raw message of type %u with %u bytes\n",
- (unsigned int) ntohs (mh->type),
- (unsigned int) ntohs (mh->size));
-
- if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
- (size < sizeof(struct GNUNET_MessageHeader)))
- {
- struct GNUNET_SERVICE_Client *client = cmc->tc->client;
-
- GNUNET_break (0);
- finish_cmc_handling (cmc);
- GNUNET_SERVICE_client_drop (client);
- return;
- }
- vl = lookup_virtual_link (&cmc->im.sender);
- if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
- {
- /* FIXME: sender is giving us messages for CORE but we don't have
- the link up yet! I *suspect* this can happen right now (i.e.
- sender has verified us, but we didn't verify sender), but if
- we pass this on, CORE would be confused (link down, messages
- arrive). We should investigate more if this happens often,
- or in a persistent manner, and possibly do "something" about
- it. Thus logging as error for now. */
- GNUNET_break_op (0);
- GNUNET_STATISTICS_update (GST_stats,
- "# CORE messages dropped (virtual link still
down)",
- 1,
- GNUNET_NO);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "CORE messages of type %u with %u bytes dropped (virtual link
still down)\n",
- (unsigned int) ntohs (mh->type),
- (unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
- return;
- }
if (vl->incoming_fc_window_size_ram > UINT_MAX - size)
{
GNUNET_STATISTICS_update (GST_stats,
@@ -5628,7 +5658,7 @@ handle_raw_message (void *cls, const struct
GNUNET_MessageHeader *mh)
"CORE messages of type %u with %u bytes dropped (FC arithmetic
overflow)\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
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)
"CORE messages of type %u with %u bytes dropped (FC window
overflow)\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
@@ -5681,16 +5711,17 @@ handle_raw_message (void *cls, const struct
GNUNET_MessageHeader *mh)
"Dropped message of type %u with %u bytes to CORE: no CORE
client connected!\n",
(unsigned int) ntohs (mh->type),
(unsigned int) ntohs (mh->size));
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Delivered message from %s of type %u to CORE\n",
+ "Delivered message from %s of type %u to CORE recv window %u\n",
GNUNET_i2s (&cmc->im.sender),
- ntohs (mh->type));
+ ntohs (mh->type),
+ vl->core_recv_window);
if (vl->core_recv_window > 0)
{
- finish_cmc_handling (cmc);
+ finish_cmc_handling_with_continue (cmc, continue_client);
return;
}
/* Wait with calling #finish_cmc_handling(cmc) until the message
@@ -5699,6 +5730,100 @@ handle_raw_message (void *cls, const struct
GNUNET_MessageHeader *mh)
}
+
+/**
+ * Communicator gave us an unencapsulated message to pass as-is to
+ * CORE. Process the request.
+ *
+ * @param cls a `struct CommunicatorMessageContext` (must call
+ * #finish_cmc_handling() when done)
+ * @param mh the message that was received
+ */
+static void
+handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
+{
+ struct CommunicatorMessageContext *cmc = cls;
+ // struct CommunicatorMessageContext *cmc_copy =
+ // GNUNET_new (struct CommunicatorMessageContext);
+ struct GNUNET_MessageHeader *mh_copy;
+ struct RingBufferEntry *rbe;
+ struct VirtualLink *vl;
+ uint16_t size = ntohs (mh->size);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Handling raw message of type %u with %u bytes\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+
+ if ((size > UINT16_MAX - sizeof(struct InboundMessage)) ||
+ (size < sizeof(struct GNUNET_MessageHeader)))
+ {
+ struct GNUNET_SERVICE_Client *client = cmc->tc->client;
+
+ GNUNET_break (0);
+ finish_cmc_handling (cmc);
+ GNUNET_SERVICE_client_drop (client);
+ return;
+ }
+ vl = lookup_virtual_link (&cmc->im.sender);
+ if ((NULL == vl) || (GNUNET_NO == vl->confirmed))
+ {
+ /* FIXME: sender is giving us messages for CORE but we don't have
+ the link up yet! I *suspect* this can happen right now (i.e.
+ sender has verified us, but we didn't verify sender), but if
+ we pass this on, CORE would be confused (link down, messages
+ arrive). We should investigate more if this happens often,
+ or in a persistent manner, and possibly do "something" about
+ it. Thus logging as error for now. */
+
+ mh_copy = GNUNET_malloc (size);
+ rbe = GNUNET_new (struct RingBufferEntry);
+ rbe->cmc = cmc;
+ /*cmc_copy->tc = cmc->tc;
+ cmc_copy->im = cmc->im;*/
+ GNUNET_memcpy (mh_copy, mh, size);
+
+ rbe->mh = mh_copy;
+
+ ring_buffer[ring_buffer_head] = rbe;// cmc_copy;
+ // cmc_copy->mh = (const struct GNUNET_MessageHeader *) mh_copy;
+ cmc->mh = (const struct GNUNET_MessageHeader *) mh_copy;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Storing message for %s and type %u (%u) in ring buffer\n",
+ GNUNET_i2s (&cmc->im.sender),
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh_copy->type));
+ if (RING_BUFFER_SIZE - 1 == ring_buffer_head)
+ {
+ ring_buffer_head = 0;
+ is_ring_buffer_full = GNUNET_YES;
+ }
+ else
+ ring_buffer_head++;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items stored in ring buffer\n",
+ ring_buffer_head);
+
+ /*GNUNET_break_op (0);
+ GNUNET_STATISTICS_update (GST_stats,
+ "# CORE messages dropped (virtual link still
down)",
+ 1,
+ GNUNET_NO);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "CORE messages of type %u with %u bytes dropped (virtual link
still down)\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+ finish_cmc_handling (cmc);*/
+ GNUNET_SERVICE_client_continue (cmc->tc->client);
+ // GNUNET_free (cmc);
+ return;
+ }
+ finish_handling_raw_message (vl, mh, cmc, GNUNET_YES);
+}
+
+
/**
* Communicator gave us a fragment box. Check the message.
*
@@ -6070,7 +6195,8 @@ handle_fragment_box (void *cls, const struct
TransportFragmentBoxMessage *fb)
(unsigned int) fb->msg_uuid.uuid);
/* FIXME: check that the resulting msg is NOT a
DV Box or Reliability Box, as that is NOT allowed! */
- demultiplex_with_cmc (cmc, msg);
+ cmc->mh = msg;
+ demultiplex_with_cmc (cmc);
/* FIXME-OPTIMIZE: really free here? Might be bad if fragments are still
en-route and we forget that we finished this reassembly immediately!
-> keep around until timeout?
@@ -6095,7 +6221,7 @@ check_reliability_box (void *cls,
GNUNET_MessageHeader *) &rb[1];
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "check_send_msg with size %u: inner msg type %u and size %u (%u
%u)\n",
+ "check_send_msg with size %u: inner msg type %u and size %u (%lu
%lu)\n",
ntohs (rb->header.size),
ntohs (inbox->type),
ntohs (inbox->size),
@@ -6141,7 +6267,8 @@ handle_reliability_box (void *cls,
/* continue with inner message */
/* FIXME: check that inbox is NOT a DV Box, fragment or another
reliability box (not allowed!) */
- demultiplex_with_cmc (cmc, inbox);
+ cmc->mh = inbox;
+ demultiplex_with_cmc (cmc);
}
@@ -6295,8 +6422,13 @@ completed_pending_message (struct PendingMessage *pm)
if (NULL != pm->bpm)
{
GNUNET_free (pm->bpm);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Freed bpm\n");
}
- client_send_response (pm->frag_parent);
+ pos = pm->frag_parent;
+ free_pending_message (pm);
+ pos->bpm = NULL;
+ client_send_response (pos);
}
else
client_send_response (pm);
@@ -6552,6 +6684,140 @@ path_cleanup_cb (void *cls)
}
+static void send_msg_from_cache (struct VirtualLink *vl)
+{
+
+ const struct GNUNET_PeerIdentity target = vl->target;
+
+
+ if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_head))
+ {
+ struct RingBufferEntry *ring_buffer_copy[RING_BUFFER_SIZE];
+ unsigned int tail = GNUNET_YES == is_ring_buffer_full ? ring_buffer_head :
+ 0;
+ unsigned int head = GNUNET_YES == is_ring_buffer_full ? RING_BUFFER_SIZE :
+ ring_buffer_head;
+ struct GNUNET_TRANSPORT_IncomingMessage im;
+ struct CommunicatorMessageContext *cmc;
+ struct RingBufferEntry *rbe;
+ struct GNUNET_MessageHeader *mh;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending from ring buffer, which has %u items\n",
+ ring_buffer_head);
+
+ ring_buffer_head = 0;
+ for (unsigned int i = 0; i < head; i++)
+ {
+ rbe = ring_buffer[(i + tail) % RING_BUFFER_SIZE];
+ cmc = rbe->cmc;
+ mh = rbe->mh;
+
+ im = cmc->im;
+ // mh = cmc->mh;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to ring buffer target %s using vl target %s\n",
+ GNUNET_i2s (&im.sender),
+ GNUNET_i2s2 (&target));
+ if (0 == GNUNET_memcmp (&target, &im.sender))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Finish handling message of type %u and size %u\n",
+ (unsigned int) ntohs (mh->type),
+ (unsigned int) ntohs (mh->size));
+ finish_handling_raw_message (vl, mh, cmc, GNUNET_NO);
+ GNUNET_free (mh);
+ }
+ else
+ {
+ ring_buffer_copy[i] = rbe;
+ ring_buffer_head++;
+ }
+ }
+
+ if ((GNUNET_YES == is_ring_buffer_full) && (RING_BUFFER_SIZE - 1 >
+ ring_buffer_head))
+ {
+ is_ring_buffer_full = GNUNET_NO;
+ }
+
+ for (unsigned int i = 0; i < ring_buffer_head; i++)
+ {
+ ring_buffer[i] = ring_buffer_copy[i];
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ring_buffer_copy[i]->mh->type for i %u %u\n",
+ i,
+ ring_buffer_copy[i]->mh->type);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ring_buffer[i]->mh->type for i %u %u\n",
+ i,
+ ring_buffer[i]->mh->type);
+ }
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items still in ring buffer\n",
+ ring_buffer_head);
+ }
+
+ if ((GNUNET_YES == is_ring_buffer_full) || (0 < ring_buffer_dv_head))
+ {
+ struct PendingMessage *ring_buffer_dv_copy[RING_BUFFER_SIZE];
+ struct PendingMessage *pm;
+ unsigned int tail = GNUNET_YES == is_ring_buffer_dv_full ?
+ ring_buffer_dv_head :
+ 0;
+ unsigned int head = GNUNET_YES == is_ring_buffer_dv_full ?
+ RING_BUFFER_SIZE :
+ ring_buffer_dv_head;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending from ring buffer dv, which has %u items\n",
+ ring_buffer_dv_head);
+
+ ring_buffer_dv_head = 0;
+ for (unsigned int i = 0; i < head; i++)
+ {
+ pm = ring_buffer_dv[(i + tail) % RING_BUFFER_SIZE];
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending to ring buffer target %s using vl target %s\n",
+ GNUNET_i2s (&pm->target),
+ GNUNET_i2s2 (&target));
+ if (0 == GNUNET_memcmp (&target, &pm->target))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Adding PendingMessage to vl, checking transmission.\n");
+ pm->vl = vl;
+ GNUNET_CONTAINER_MDLL_insert (vl,
+ vl->pending_msg_head,
+ vl->pending_msg_tail,
+ pm);
+
+ check_vl_transmission (vl);
+ }
+ else
+ {
+ ring_buffer_dv_copy[i] = pm;
+ ring_buffer_dv_head++;
+ }
+ }
+
+ if (is_ring_buffer_dv_full && (RING_BUFFER_SIZE - 1 > ring_buffer_dv_head))
+ {
+ is_ring_buffer_dv_full = GNUNET_NO;
+ }
+
+ for (unsigned int i = 0; i < ring_buffer_dv_head; i++)
+ ring_buffer_dv[i] = ring_buffer_dv_copy[i];
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items still in ring buffer dv.\n",
+ ring_buffer_dv_head);
+
+ }
+}
+
+
/**
* The @a hop is a validated path to the respective target
* peer and we should tell core about it -- and schedule
@@ -6595,6 +6861,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop
*hop)
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&dv->target);
+ send_msg_from_cache (vl);
}
else
{
@@ -6610,6 +6877,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop
*hop)
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&dv->target);
+ send_msg_from_cache (vl);
}
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7358,7 +7626,6 @@ handle_dv_learn (void *cls, const struct
TransportDVLearnMessage *dvl)
struct GNUNET_TIME_Relative host_latency_sum;
struct GNUNET_TIME_Relative latency;
struct GNUNET_TIME_Relative network_latency;
- struct GNUNET_TIME_Absolute now;
/* We initiated this, learn the forward path! */
path[0] = GST_my_identity;
@@ -7367,7 +7634,6 @@ handle_dv_learn (void *cls, const struct
TransportDVLearnMessage *dvl)
// Need also something to lookup initiation time
// to compute RTT! -> add RTT argument here?
- now = GNUNET_TIME_absolute_get ();
latency = GNUNET_TIME_absolute_get_duration (GNUNET_TIME_absolute_ntoh (
dvl->monotonic_time));
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)
iret = learn_dv_path (path,
i + 3,
GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TIME_relative_to_absolute (
+ ADDRESS_VALIDATION_LIFETIME));
if (GNUNET_SYSERR == iret)
{
/* path invalid or too long to be interesting for US, thus should also
@@ -7602,7 +7869,7 @@ forward_dv_box (struct Neighbour *next_hop,
GNUNET_MessageHeader *) msg_buf,
RMO_ANYTHING_GOES);
}
- else if (NULL != vl)
+ else
{
pm = GNUNET_malloc (sizeof(struct PendingMessage) + msg_size);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -7611,29 +7878,48 @@ forward_dv_box (struct Neighbour *next_hop,
vl);
pm->pmt = PMT_DV_BOX;
pm->vl = vl;
+ pm->target = next_hop->pid;
pm->timeout = GNUNET_TIME_relative_to_absolute (DV_FORWARD_TIMEOUT);
pm->logging_uuid = logging_uuid_gen++;
pm->prefs = GNUNET_MQ_PRIO_BACKGROUND;
pm->bytes_msg = msg_size;
buf = (char *) &pm[1];
memcpy (buf, msg_buf, msg_size);
- GNUNET_CONTAINER_MDLL_insert (vl,
- vl->pending_msg_head,
- vl->pending_msg_tail,
- pm);
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Created pending message %llu for DV Box with next hop %s
(%u/%u)\n",
pm->logging_uuid,
GNUNET_i2s (&next_hop->pid),
(unsigned int) num_hops,
(unsigned int) total_hops);
- check_vl_transmission (vl);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "The virtual link is not ready for forwarding a DV Box with
payload.\n");
- // FIXME The DV Box was send before the validation response. Shall we send
a validation request for DV paths?
+
+ if ((NULL != vl) && (GNUNET_YES == vl->confirmed))
+ {
+ GNUNET_CONTAINER_MDLL_insert (vl,
+ vl->pending_msg_head,
+ vl->pending_msg_tail,
+ pm);
+
+ check_vl_transmission (vl);
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "The virtual link is not ready for forwarding a DV Box with
payload, storing PendingMessage in ring buffer.\n");
+
+ ring_buffer_dv[ring_buffer_dv_head] = pm;
+ if (RING_BUFFER_SIZE - 1 == ring_buffer_dv_head)
+ {
+ ring_buffer_dv_head = 0;
+ is_ring_buffer_dv_full = GNUNET_YES;
+ }
+ else
+ ring_buffer_dv_head++;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "%u items stored in DV ring buffer\n",
+ ring_buffer_dv_head);
+ }
}
}
@@ -7745,9 +8031,9 @@ backtalker_monotime_cb (void *cls,
continue normal processing */
b->get = NULL;
GNUNET_assert (NULL != b->cmc);
+ b->cmc->mh = (const struct GNUNET_MessageHeader *) &b[1];
if (0 != b->body_size)
- demultiplex_with_cmc (b->cmc,
- (const struct GNUNET_MessageHeader *) &b[1]);
+ demultiplex_with_cmc (b->cmc);
else
finish_cmc_handling (b->cmc);
b->cmc = NULL;
@@ -7865,7 +8151,6 @@ handle_dv_box (void *cls, const struct
TransportDVBoxMessage *dvb)
const char *enc_payload = (const char *) &hops[num_hops];
uint16_t enc_payload_size =
size - (num_hops * sizeof(struct GNUNET_PeerIdentity));
- char enc[enc_payload_size];
struct DVKeyState *key;
struct GNUNET_HashCode hmac;
const char *hdr;
@@ -8053,8 +8338,8 @@ handle_dv_box (void *cls, const struct
TransportDVBoxMessage *dvb)
update_backtalker_monotime (b);
b->timeout =
GNUNET_TIME_relative_to_absolute (BACKCHANNEL_INACTIVITY_TIMEOUT);
-
- demultiplex_with_cmc (cmc, mh);
+ cmc->mh = mh;
+ demultiplex_with_cmc (cmc);
return;
}
/* setup data structure to cache signature AND check
@@ -8535,6 +8820,10 @@ handle_validation_response (
if ((origin_time.abs_value_us < vs->first_challenge_use.abs_value_us) ||
(origin_time.abs_value_us > vs->last_challenge_use.abs_value_us))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Diff first use %lu and last use %lu\n",
+ vs->first_challenge_use.abs_value_us -
origin_time.abs_value_us,
+ origin_time.abs_value_us -
vs->last_challenge_use.abs_value_us);
GNUNET_break_op (0);
finish_cmc_handling (cmc);
return;
@@ -8585,8 +8874,9 @@ handle_validation_response (
GNUNET_TIME_UNIT_ZERO_ABS; /* challenge was not yet used */
update_next_challenge_time (vs, vs->first_challenge_use);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Validation response %s accepted, address valid until %s\n",
+ "Validation response %s from %s accepted, address valid until
%s\n",
GNUNET_sh2s (&tvr->challenge.value),
+ GNUNET_i2s (&cmc->im.sender),
GNUNET_STRINGS_absolute_time_to_string (vs->valid_until));
vs->sc = GNUNET_PEERSTORE_store (peerstore,
"transport",
@@ -8644,6 +8934,7 @@ handle_validation_response (
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&n->pid);
+ send_msg_from_cache (vl);
}
else
{
@@ -8654,7 +8945,7 @@ handle_validation_response (
n->vl = vl;
if (GNUNET_YES == vl->confirmed)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Virtual link to %s could now also direct neighbour!\n",
+ "Virtual link to %s could now also use direct
neighbour!\n",
GNUNET_i2s (&vs->pid));
}
else
@@ -8671,6 +8962,7 @@ handle_validation_response (
/* We lacked a confirmed connection to the target
before, so tell CORE about it (finally!) */
cores_send_connect_info (&n->pid);
+ send_msg_from_cache (vl);
}
}
}
@@ -8692,10 +8984,13 @@ handle_incoming_msg (void *cls,
cmc->tc = tc;
cmc->im = *im;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received message with size %u via communicator from peer %s\n",
- &im->header.size,
+ "Received message with size %u and flow control id %lu via
communicator from peer %s\n",
+ ntohs (im->header.size),
+ im->fc_id,
GNUNET_i2s (&im->sender));
- demultiplex_with_cmc (cmc, (const struct GNUNET_MessageHeader *) &im[1]);
+ cmc->im.neighbour_sender = cmc->im.sender;
+ cmc->mh = (const struct GNUNET_MessageHeader *) &im[1];
+ demultiplex_with_cmc (cmc);
}
@@ -8783,7 +9078,7 @@ handle_flow_control (void *cls, const struct
TransportFlowControlMessage *fc)
% FC_NO_CHANGE_REPLY_PROBABILITY)))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "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",
+ "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",
(unsigned long long) wnd,
(unsigned long long) vl->incoming_fc_window_size,
(unsigned long long) vl->last_outbound_window_size_received,
@@ -8817,8 +9112,7 @@ handle_flow_control (void *cls, const struct
TransportFlowControlMessage *fc)
* @param msg message to demultiplex
*/
static void
-demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
- const struct GNUNET_MessageHeader *msg)
+demultiplex_with_cmc (struct CommunicatorMessageContext *cmc)
{
struct GNUNET_MQ_MessageHandler handlers[] =
{ GNUNET_MQ_hd_var_size (fragment_box,
@@ -8861,6 +9155,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext
*cmc,
cmc),
GNUNET_MQ_handler_end () };
int ret;
+ const struct GNUNET_MessageHeader *msg = cmc->mh;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Handling message of type %u with %u bytes\n",
@@ -9154,7 +9449,7 @@ reliability_box_message (struct Queue *queue,
memcpy (&msg[sizeof(rbox)], &pm[1], pm->bytes_msg);
pm->bpm = bpm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Preparing reliability box for message <%llu> of size %lu (%lu)
to %s on queue %s\n",
+ "Preparing reliability box for message <%llu> of size %d (%d) to
%s on queue %s\n",
pm->logging_uuid,
pm->bytes_msg,
ntohs (((const struct GNUNET_MessageHeader *) &pm[1])->size),
@@ -9200,7 +9495,6 @@ static void
update_pm_next_attempt (struct PendingMessage *pm,
struct GNUNET_TIME_Absolute next_attempt)
{
- struct VirtualLink *vl = pm->vl;
// TODO Do we really need a next_attempt value for PendingMessage other than
the root Pending Message?
pm->next_attempt = next_attempt;
@@ -9221,7 +9515,8 @@ update_pm_next_attempt (struct PendingMessage *pm,
root = root->frag_parent;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Next attempt for root message <%llu> set to %s\n",
- root->logging_uuid);
+ root->logging_uuid,
+ GNUNET_STRINGS_absolute_time_to_string (next_attempt));
root->next_attempt = next_attempt;
reorder_root_pm (root, next_attempt);
}
@@ -9356,7 +9651,7 @@ select_best_pending_from_link (struct
PendingMessageScoreContext *sc,
/* determine if we have to fragment, if so add fragmentation
overhead! */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "check %u for sc->best\n",
+ "check %llu for sc->best\n",
pos->logging_uuid);
frag = GNUNET_NO;
if (((0 != queue->mtu) &&
@@ -9369,7 +9664,7 @@ select_best_pending_from_link (struct
PendingMessageScoreContext *sc,
this queue */))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "fragment msg with size %u, realoverhead is %u\n",
+ "fragment msg with size %u, realoverhead is %lu\n",
pos->bytes_msg,
real_overhead);
frag = GNUNET_YES;
@@ -9399,7 +9694,7 @@ select_best_pending_from_link (struct
PendingMessageScoreContext *sc,
relb = GNUNET_YES;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Create reliability box of msg with size %u, realoverhead is
%u %u %u %u\n",
+ "Create reliability box of msg with size %u, realoverhead is
%lu %u %u %u\n",
pos->bytes_msg,
real_overhead,
queue->mtu,
@@ -9449,7 +9744,7 @@ select_best_pending_from_link (struct
PendingMessageScoreContext *sc,
if (sc_score + time_delta > pm_score)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "sc_score of %u larger, keep sc->best %u\n",
+ "sc_score of %llu larger, keep sc->best %llu\n",
pos->logging_uuid,
sc->best->logging_uuid);
continue; /* sc_score larger, keep sc->best */
@@ -9610,7 +9905,7 @@ transmit_on_queue (void *cls)
GNUNET_NO);
GNUNET_assert (NULL != sc.best->bpm);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%u %u %u %u %u\n",
+ "%lu %lu %lu %lu %u\n",
sizeof(struct GNUNET_PeerIdentity),
sizeof(struct TransportDVBoxMessage),
sizeof(struct TransportDVBoxPayloadP),
@@ -9723,12 +10018,12 @@ transmit_on_queue (void *cls)
struct GNUNET_TIME_Relative plus = GNUNET_TIME_relative_multiply (
wait_duration, 4);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Waiting %s (%llu) for ACK until %llu\n",
+ "Waiting %s (%s) for ACK until %s\n",
GNUNET_STRINGS_relative_time_to_string (
GNUNET_TIME_relative_multiply (
queue->pd.aged_rtt, 4), GNUNET_NO),
- plus,
- next);
+ GNUNET_STRINGS_relative_time_to_string (plus, GNUNET_YES),
+ GNUNET_STRINGS_absolute_time_to_string (next));
update_pm_next_attempt (pm,
GNUNET_TIME_relative_to_absolute (
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 @@
M:1
N:3
X:0
-AC:1
B:0
T:libgnunet_test_transport_plugin_cmd_simple_send_dv
R: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 @@
+M:1
+N:4
+X:0
+AC:1
+T:libgnunet_test_transport_plugin_cmd_simple_send_dv
+R:1|{tcp_port:1}|{udp_port:0}
+R:2|{tcp_port:1}|{udp_port:0}
+R:3|{tcp_port:1}|{udp_port:0}
+R:4|{tcp_port:1}|{udp_port:0}
+P:1:1|{connect:{P:2:1:tcp}}|{AC:2}
+P:2:1|{connect:{P:3:1:tcp}}|{AC:2}
+P:3:1|{connect:{P:4:1:tcp}}|{AC:2}
+P: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,
unsigned int num;
struct TestState *ts = GNUNET_new (struct TestState);
struct GNUNET_TESTING_NetjailTopology *topology;
+ unsigned int sscanf_ret = 0;
if (GNUNET_YES == *read_file)
{
@@ -239,10 +240,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb
write_message, char *router_ip,
ts->topology = topology;
+ errno = 0;
sscanf (m, "%u", &m_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
sscanf (n, "%u", &n_int);
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
+ errno = 0;
sscanf (local_m, "%u", &local_m_int);
-
+ if (errno != 0)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
+ }
+ GNUNET_assert (0 < sscanf_ret);
if (0 == n_int)
num = m_int;
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,
{
struct GNUNET_PeerIdentity *peer = cls;
const struct GNUNET_TESTING_AsyncContext *ac_block;
- const struct GNUNET_TESTING_AsyncContext *ac_start;
- const struct GNUNET_TESTING_Command *cmd;
const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
unsigned int connected;
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
fi
fi
exec 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"
+# 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 @@
+#!/bin/bash
+if ! [ -d "/run/netns" ]; then
+ echo You have to create the directory /run/netns.
+fi
+if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" == 1 ]; then
+ # 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"
+ 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"
+else
+ 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"
+ exit 78
+fi
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
*/
struct GNUNET_PeerIdentity sender;
+ /**
+ * Direct neighbour sender identifier.
+ */
+ struct GNUNET_PeerIdentity neighbour_sender;
+
/* followed by the message */
};
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 (
&incoming_ack->sender,
sizeof(struct GNUNET_PeerIdentity))))
{
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Done with message with flow control id %lu for sender %s
from sender %s\n",
+ incoming_ack->fc_id,
+ GNUNET_i2s (&fc->sender),
+ GNUNET_i2s (&incoming_ack->sender));
GNUNET_CONTAINER_DLL_remove (ch->fc_head, ch->fc_tail, fc);
fc->cb (fc->cb_cls, GNUNET_OK);
GNUNET_free (fc);
return;
}
}
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Message with flow control id %lu from sender %s not found\n",
+ incoming_ack->fc_id,
+ GNUNET_i2s (&incoming_ack->sender));
GNUNET_break (0);
disconnect (ch);
/* TODO: maybe do this with exponential backoff/delay */
@@ -948,6 +957,10 @@ GNUNET_TRANSPORT_communicator_receive (
fc->cb = cb;
fc->cb_cls = cb_cls;
GNUNET_CONTAINER_DLL_insert (ch->fc_head, ch->fc_tail, fc);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Created flow control id %lu for sender %s\n",
+ fc->id,
+ GNUNET_i2s (&fc->sender));
}
GNUNET_MQ_send (ch->mq, env);
return GNUNET_OK;
@@ -1101,6 +1114,18 @@ GNUNET_TRANSPORT_communicator_address_remove (
struct GNUNET_TRANSPORT_CommunicatorHandle *ch = ai->ch;
send_del_address (ai);
+ if (NULL == ai->prev)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "prev null\n");
+ if (ch->ai_head == ai)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "equals head\n");
+ if (NULL == ai->next)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "next null\n");
+ if (ch->ai_tail == ai)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "equals tail\n");
GNUNET_CONTAINER_DLL_remove (ch->ai_head, ch->ai_tail, ai);
GNUNET_free (ai->address);
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
}
else
GNUNET_assert (0);
+ GNUNET_free (peer);
+ GNUNET_free (us);
}
@@ -400,17 +402,10 @@ backchannel_check_run (void *cls,
struct GNUNET_TESTING_Interpreter *is)
{
struct CheckState *cs = cls;
- // char *buf;
- // char *part_one = "Delivering backchannel message from ";
- // char *part_two = " of type 1460 to udp";
const struct GNUNET_TESTING_Command *system_cmd;
const struct GNUNET_TESTING_System *tl_system;
const struct GNUNET_TESTING_Command *peer1_cmd;
const struct GNUNET_TRANSPORT_ApplicationHandle *ah;
- // struct GNUNET_PeerIdentity *peer;
- // uint32_t num;
- // struct GNUNET_TESTING_NodeConnection *pos_connection;
- // unsigned int con_num = 0;
struct GNUNET_CONTAINER_MultiShortmapIterator *node_it;
struct GNUNET_CONTAINER_MultiShortmapIterator *namespace_it;
struct GNUNET_ShortHashCode node_key;
@@ -484,40 +479,7 @@ backchannel_check_run (void *cls,
}
}
}
- /* for (pos_connection = cs->node_connections_head; NULL != pos_connection;
*/
- /* pos_connection = pos_connection->next) */
- /* { */
- /* if (GNUNET_YES == will_the_other_node_connect_via_udp (cs, node)) */
- /* { */
- /* num = GNUNET_TESTING_calculate_num (pos_connection, cs->topology); */
- /* peer = GNUNET_TESTING_get_pub_key (num, tl_system); */
- /* LOG (GNUNET_ERROR_TYPE_DEBUG, */
- /* "peer: %s\n", */
- /* GNUNET_i2s (peer)); */
-
- /* if (0 < GNUNET_asprintf (&buf, */
- /* "%s%s%s", */
- /* part_one, */
- /* GNUNET_i2s (peer), */
- /* part_two)) */
- /* { */
- /* GNUNET_array_append (cs->search_string, */
- /* con_num, */
- /* buf); */
- /* /\*LOG (GNUNET_ERROR_TYPE_DEBUG, */
- /* "con_num: %u search: %s %p\n", */
- /* con_num, */
- /* cs->search_string[con_num - 1], */
- /* cs->search_string);*\/ */
- /* } */
- /* else */
- /* GNUNET_assert (0); */
- /* } */
-
-
- /* } */
- // cs->con_num = con_num;
if (0 != cs->con_num)
{
cs->task =
@@ -527,6 +489,9 @@ backchannel_check_run (void *cls,
else
GNUNET_TESTING_async_finish (&cs->ac);
+ GNUNET_free (namespace_it);
+ GNUNET_free (node_it);
+
}
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,
struct GNUNET_TESTING_AddressPrefix *pos_prefix;
unsigned int con_num = 0;
const enum GNUNET_GenericReturnValue *broadcast;
- char *port;
cps->is = is;
peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
@@ -167,17 +166,18 @@ notify_connect (struct GNUNET_TESTING_Interpreter *is,
cps->con_num_notified++;
GNUNET_free (peer_connection);
}
- if (cps->con_num == con_num)
+ if (cps->con_num_notified == con_num)
cps->additional_connects_notified++;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "con_num: %u add: %u num_notified: %u add_notified: %u\n",
+ "con_num: %u add: %u num_notified: %u add_notified: %u peer:
%s\n",
cps->con_num,
cps->additional_connects,
cps->con_num_notified,
- cps->additional_connects_notified);
- if (cps->con_num + cps->additional_connects == cps->con_num_notified
- + cps->additional_connects_notified)
+ cps->additional_connects_notified,
+ GNUNET_i2s (peer));
+ if ((cps->con_num == cps->con_num_notified) &&
+ (cps->additional_connects <= cps->additional_connects_notified))
{
GNUNET_TESTING_async_finish (&cps->ac);
}
@@ -241,6 +241,18 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
unsigned int additional_connects)
{
struct ConnectPeersState *cps;
+ unsigned int node_additional_connects;
+
+ node_additional_connects = GNUNET_TESTING_get_additional_connects (num,
+ topology);
+
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "global: %u and local: %u additional_connects\n",
+ additional_connects,
+ node_additional_connects);
+
+ if (0 != node_additional_connects)
+ additional_connects = node_additional_connects;
cps = GNUNET_new (struct ConnectPeersState);
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,
struct GNUNET_TRANSPORT_TESTING_TestMessage *test;
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Sending simple test message\n");
+ "Sending simple test message with mq %p\n",
+ mq);
env = GNUNET_MQ_msg_extra (test,
1000 - sizeof(*test),
@@ -116,13 +117,6 @@ send_simple_run (void *cls,
struct SendSimpleState *sss = cls;
const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
const struct GNUNET_TESTING_Command *peer1_cmd;
- // struct GNUNET_ShortHashCode *key = GNUNET_new (struct
GNUNET_ShortHashCode);
- struct GNUNET_HashCode hc;
- struct GNUNET_TESTING_NodeConnection *node_connections_head;
- struct GNUNET_PeerIdentity *peer;
- struct GNUNET_CRYPTO_EddsaPublicKey public_key;
- uint32_t num;
- struct GNUNET_TESTING_NodeConnection *pos_connection;
const struct GNUNET_TESTING_Command *system_cmd;
const struct GNUNET_TESTING_System *tl_system;
@@ -136,42 +130,10 @@ send_simple_run (void *cls,
GNUNET_TESTING_get_trait_test_system (system_cmd,
&tl_system);
- node_connections_head = GNUNET_TESTING_get_connections (sss->num,
- sss->topology);
-
GNUNET_CONTAINER_multishortmap_iterate (
(struct GNUNET_CONTAINER_MultiShortmap *)
connected_peers_map, send_simple_cb,
sss);
- /*for (int i = 0; i < 1; i++)
- {
- for (pos_connection = node_connections_head; NULL != pos_connection;
- pos_connection = pos_connection->next)
- {
- num = GNUNET_TESTING_calculate_num (pos_connection, sss->topology);
- peer = GNUNET_TESTING_get_pub_key (num, tl_system);
- public_key = peer->public_key;
- GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
-
- memcpy (key,
- &hc,
- sizeof (*key));
- mq = GNUNET_CONTAINER_multishortmap_get (connected_peers_map,
- key);
- env = GNUNET_MQ_msg_extra (test,
- 1000 - sizeof(*test),
- GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE);
- test->num = htonl (sss->num);
- memset (&test[1],
- sss->num,
- 1000 - sizeof(*test));
- GNUNET_MQ_send (mq,
- env);
- }
- }*/
-
- // GNUNET_free (key);
-
}
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,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"This Peer %s \n",
GNUNET_i2s (&sps->id));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Peer %s connected to peer number %u\n",
- GNUNET_i2s (peer),
- sps->no);
+
GNUNET_CRYPTO_hash (&public_key, sizeof(public_key), &hc);
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer %s connected to peer number %u with mq %p\n",
+ GNUNET_i2s (peer),
+ sps->no,
+ mq);
+
memcpy (key,
&hc,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] branch master updated (95fd03909 -> 8e4312d5e), gnunet, 2022/10/05
- [gnunet] 02/02: Merge branch 'master' of ssh://git.gnunet.org/gnunet, gnunet, 2022/10/05
- [gnunet] 01/02: - 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 m [...],
gnunet <=