aboutsummaryrefslogtreecommitdiff
path: root/src/testing
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/testing
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/testing')
-rw-r--r--src/testing/gnunet-cmds-helper.c19
-rw-r--r--src/testing/testing.c214
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c5
3 files changed, 163 insertions, 75 deletions
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)
561 struct GNUNET_GETOPT_CommandLineOption options[] = 561 struct GNUNET_GETOPT_CommandLineOption options[] =
562 { GNUNET_GETOPT_OPTION_END }; 562 { GNUNET_GETOPT_OPTION_END };
563 int ret; 563 int ret;
564 unsigned int sscanf_ret;
564 int i; 565 int i;
565 size_t topology_data_length = 0; 566 size_t topology_data_length = 0;
566 unsigned int read_file; 567 unsigned int read_file;
@@ -575,11 +576,16 @@ main (int argc, char **argv)
575 ni->m = argv[3]; 576 ni->m = argv[3];
576 ni->n = argv[4]; 577 ni->n = argv[4];
577 578
578 sscanf (argv[5], "%u", &read_file); 579 errno = 0;
580 sscanf_ret = sscanf (argv[5], "%u", &read_file);
579 581
580 if (1 == read_file) 582 if (errno != 0)
583 {
584 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
585 }
586 else if (1 == read_file)
581 ni->topology_data = argv[6]; 587 ni->topology_data = argv[6];
582 else 588 else if (0 == read_file)
583 { 589 {
584 for (i = 6; i<argc; i++) 590 for (i = 6; i<argc; i++)
585 topology_data_length += strlen (argv[i]) + 1; 591 topology_data_length += strlen (argv[i]) + 1;
@@ -587,12 +593,19 @@ main (int argc, char **argv)
587 "topo data length %lu\n", 593 "topo data length %lu\n",
588 topology_data_length); 594 topology_data_length);
589 ni->topology_data = GNUNET_malloc (topology_data_length); 595 ni->topology_data = GNUNET_malloc (topology_data_length);
596 memset (ni->topology_data, '\0', topology_data_length);
590 for (i = 6; i<argc; i++) 597 for (i = 6; i<argc; i++)
591 { 598 {
592 strcat (ni->topology_data, argv[i]); 599 strcat (ni->topology_data, argv[i]);
593 strcat (ni->topology_data, cr); 600 strcat (ni->topology_data, cr);
594 } 601 }
595 } 602 }
603 else
604 {
605 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
606 "Wrong input for the fourth argument\n");
607 }
608 GNUNET_assert (0 < sscanf_ret);
596 ni->read_file = &read_file; 609 ni->read_file = &read_file;
597 ni->topology_data[topology_data_length - 1] = '\0'; 610 ni->topology_data[topology_data_length - 1] = '\0';
598 LOG (GNUNET_ERROR_TYPE_DEBUG, 611 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)
1809{ 1809{
1810 char *copy; 1810 char *copy;
1811 size_t slen; 1811 size_t slen;
1812 size_t tlen;
1812 char *token; 1813 char *token;
1813 char *ret; 1814 char *ret;
1814 char *rest = NULL; 1815 char *rest = NULL;
@@ -1817,8 +1818,9 @@ get_key (char *line)
1817 copy = malloc (slen); 1818 copy = malloc (slen);
1818 memcpy (copy, line, slen); 1819 memcpy (copy, line, slen);
1819 token = strtok_r (copy, ":", &rest); 1820 token = strtok_r (copy, ":", &rest);
1820 ret = malloc (2); 1821 tlen = strlen (token) + 1;
1821 memcpy (ret, token, 2); 1822 ret = malloc (tlen);
1823 memcpy (ret, token, tlen);
1822 GNUNET_free (copy); 1824 GNUNET_free (copy);
1823 return ret; 1825 return ret;
1824} 1826}
@@ -1911,6 +1913,7 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1911 char *rest = NULL; 1913 char *rest = NULL;
1912 char *rest2 = NULL; 1914 char *rest2 = NULL;
1913 struct GNUNET_TESTING_AddressPrefix *prefix; 1915 struct GNUNET_TESTING_AddressPrefix *prefix;
1916 unsigned int sscanf_ret;
1914 1917
1915 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection); 1918 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
1916 node_connection->node = node; 1919 node_connection->node = node;
@@ -1934,10 +1937,22 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1934 { 1937 {
1935 node_connection->node_type = GNUNET_TESTING_SUBNET_NODE; 1938 node_connection->node_type = GNUNET_TESTING_SUBNET_NODE;
1936 token = strtok_r (NULL, ":", &rest); 1939 token = strtok_r (NULL, ":", &rest);
1937 sscanf (token, "%u", &namespace_n); 1940 errno = 0;
1941 sscanf_ret = sscanf (token, "%u", &namespace_n);
1942 if (errno != 0)
1943 {
1944 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
1945 }
1946 GNUNET_assert (0 < sscanf_ret);
1938 node_connection->namespace_n = namespace_n; 1947 node_connection->namespace_n = namespace_n;
1939 token = strtok_r (NULL, ":", &rest); 1948 token = strtok_r (NULL, ":", &rest);
1940 sscanf (token, "%u", &node_n); 1949 errno = 0;
1950 sscanf_ret = sscanf (token, "%u", &node_n);
1951 if (errno != 0)
1952 {
1953 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
1954 }
1955 GNUNET_assert (0 < sscanf_ret);
1941 node_connection->node_n = node_n; 1956 node_connection->node_n = node_n;
1942 LOG (GNUNET_ERROR_TYPE_DEBUG, 1957 LOG (GNUNET_ERROR_TYPE_DEBUG,
1943 "node_n %u namespace_n %u node->node_n %u node->namespace_n %u\n", 1958 "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)
1946 node->node_n, 1961 node->node_n,
1947 node->namespace_n); 1962 node->namespace_n);
1948 } 1963 }
1964 else
1965 {
1966 GNUNET_free (node_connection);
1967 }
1968
1949 while (NULL != (token = strtok_r (NULL, ":", &rest))) 1969 while (NULL != (token = strtok_r (NULL, ":", &rest)))
1950 { 1970 {
1951 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix); 1971 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
@@ -2085,30 +2105,22 @@ log_topo (struct GNUNET_TESTING_NetjailTopology *topology)
2085 return GNUNET_YES; 2105 return GNUNET_YES;
2086} 2106}
2087 2107
2088 2108void
2089/** 2109get_node_info (unsigned int num,
2090 * Get the connections to other nodes for a specific node. 2110 struct GNUNET_TESTING_NetjailTopology *topology,
2091 * 2111 struct GNUNET_TESTING_NetjailNode **node_ex,
2092 * @param num The specific node we want the connections for. 2112 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
2093 * @param topology The topology we get the connections from. 2113 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
2094 * @return The connections of the node.
2095 */
2096struct GNUNET_TESTING_NodeConnection *
2097GNUNET_TESTING_get_connections (unsigned int num, struct
2098 GNUNET_TESTING_NetjailTopology *topology)
2099{ 2114{
2100 struct GNUNET_TESTING_NetjailNode *node;
2101 struct GNUNET_ShortHashCode *hkey; 2115 struct GNUNET_ShortHashCode *hkey;
2102 struct GNUNET_HashCode hc; 2116 struct GNUNET_HashCode hc;
2117 unsigned int namespace_n;
2118 unsigned int node_m;
2119 struct GNUNET_TESTING_NetjailNode *node;
2103 struct GNUNET_TESTING_NetjailNamespace *namespace; 2120 struct GNUNET_TESTING_NetjailNamespace *namespace;
2104 unsigned int namespace_n, node_m; 2121 struct GNUNET_TESTING_NodeConnection *node_connections;
2105 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
2106 2122
2107 LOG (GNUNET_ERROR_TYPE_DEBUG,
2108 "gaga 1\n");
2109 log_topo (topology); 2123 log_topo (topology);
2110 LOG (GNUNET_ERROR_TYPE_DEBUG,
2111 "gaga 2\n");
2112 hkey = GNUNET_new (struct GNUNET_ShortHashCode); 2124 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
2113 LOG (GNUNET_ERROR_TYPE_DEBUG, 2125 LOG (GNUNET_ERROR_TYPE_DEBUG,
2114 "num: %u \n", 2126 "num: %u \n",
@@ -2142,21 +2154,53 @@ GNUNET_TESTING_get_connections (unsigned int num, struct
2142 sizeof (*hkey)); 2154 sizeof (*hkey));
2143 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces, 2155 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
2144 hkey); 2156 hkey);
2145 if (NULL == namespace) 2157 if (NULL != namespace)
2146 return NULL; 2158 {
2147 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1); 2159 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
2148 hkey = GNUNET_new (struct GNUNET_ShortHashCode); 2160 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
2149 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc); 2161 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
2150 memcpy (hkey, 2162 memcpy (hkey,
2151 &hc, 2163 &hc,
2152 sizeof (*hkey)); 2164 sizeof (*hkey));
2153 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes, 2165 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
2154 hkey); 2166 hkey);
2155 if (NULL != node) 2167 if (NULL != node)
2156 node_connections = node->node_connections_head; 2168 {
2169 LOG (GNUNET_ERROR_TYPE_DEBUG,
2170 "node additional_connects: %u %p\n",
2171 node->additional_connects,
2172 node);
2173 node_connections = node->node_connections_head;
2174 }
2175 *node_ex = node;
2176 *namespace_ex = namespace;
2177 *node_connections_ex = node_connections;
2178 }
2179 GNUNET_free (hkey);
2157 } 2180 }
2181}
2182
2183
2184/**
2185 * Get the connections to other nodes for a specific node.
2186 *
2187 * @param num The specific node we want the connections for.
2188 * @param topology The topology we get the connections from.
2189 * @return The connections of the node.
2190 */
2191struct GNUNET_TESTING_NodeConnection *
2192GNUNET_TESTING_get_connections (unsigned int num,
2193 struct GNUNET_TESTING_NetjailTopology *topology)
2194{
2195 struct GNUNET_TESTING_NetjailNode *node;
2196 struct GNUNET_TESTING_NetjailNamespace *namespace;
2197 struct GNUNET_TESTING_NodeConnection *node_connections;
2198
2199 LOG (GNUNET_ERROR_TYPE_DEBUG,
2200 "get_connections\n");
2201
2202 get_node_info (num, topology, &node, &namespace, &node_connections);
2158 2203
2159 GNUNET_free (hkey);
2160 return node_connections; 2204 return node_connections;
2161} 2205}
2162 2206
@@ -2175,8 +2219,7 @@ GNUNET_TESTING_get_pub_key (unsigned int num,
2175 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); 2219 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
2176 struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct 2220 struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
2177 GNUNET_CRYPTO_EddsaPublicKey); 2221 GNUNET_CRYPTO_EddsaPublicKey);
2178 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct 2222 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
2179 GNUNET_CRYPTO_EddsaPrivateKey);
2180 2223
2181 priv_key = GNUNET_TESTING_hostkey_get (tl_system, 2224 priv_key = GNUNET_TESTING_hostkey_get (tl_system,
2182 num, 2225 num,
@@ -2199,25 +2242,17 @@ free_nodes_cb (void *cls,
2199 (void) cls; 2242 (void) cls;
2200 struct GNUNET_TESTING_NetjailNode *node = value; 2243 struct GNUNET_TESTING_NetjailNode *node = value;
2201 struct GNUNET_TESTING_NodeConnection *pos_connection; 2244 struct GNUNET_TESTING_NodeConnection *pos_connection;
2202 struct GNUNET_TESTING_NodeConnection *tmp_connection;
2203 struct GNUNET_TESTING_AddressPrefix *pos_prefix; 2245 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
2204 struct GNUNET_TESTING_AddressPrefix *tmp_prefix;
2205 2246
2206 pos_connection = node->node_connections_head; 2247 while (NULL != (pos_connection = node->node_connections_head))
2207
2208 while (NULL != pos_connection->next)
2209 { 2248 {
2210 pos_prefix = pos_connection->address_prefixes_head; 2249 while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
2211 while (NULL != pos_prefix->next)
2212 { 2250 {
2213 tmp_prefix = pos_prefix->next; 2251 GNUNET_free (pos_prefix->address_prefix);
2214 GNUNET_free (pos_prefix);
2215 pos_prefix = tmp_prefix;
2216 } 2252 }
2217 tmp_connection = pos_connection->next;
2218 GNUNET_free (pos_connection); 2253 GNUNET_free (pos_connection);
2219 pos_connection = tmp_connection;
2220 } 2254 }
2255
2221 GNUNET_free (node->plugin); 2256 GNUNET_free (node->plugin);
2222 GNUNET_free (node); 2257 GNUNET_free (node);
2223 return GNUNET_OK; 2258 return GNUNET_OK;
@@ -2348,6 +2383,34 @@ GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
2348 return addr; 2383 return addr;
2349} 2384}
2350 2385
2386/**
2387 * Get the number of unintentional additional connections the node waits for.
2388 *
2389 * @param num The specific node we want the additional connects for.
2390 * @return The number of additional connects
2391 */
2392unsigned int
2393GNUNET_TESTING_get_additional_connects (unsigned int num,
2394 struct GNUNET_TESTING_NetjailTopology *
2395 topology)
2396{
2397 struct GNUNET_TESTING_NetjailNode *node;
2398 struct GNUNET_TESTING_NetjailNamespace *namespace;
2399 struct GNUNET_TESTING_NodeConnection *node_connections;
2400
2401 LOG (GNUNET_ERROR_TYPE_DEBUG,
2402 "get_additional_connects\n");
2403
2404 get_node_info (num, topology, &node, &namespace, &node_connections);
2405
2406 LOG (GNUNET_ERROR_TYPE_DEBUG,
2407 "node additional_connects: %u %p\n",
2408 node->additional_connects,
2409 node);
2410
2411 return node->additional_connects;
2412}
2413
2351 2414
2352/** 2415/**
2353 * Create a GNUNET_CMDS_LOCAL_FINISHED message. 2416 * Create a GNUNET_CMDS_LOCAL_FINISHED message.
@@ -2389,9 +2452,9 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2389 char *rest = NULL; 2452 char *rest = NULL;
2390 char *value = NULL; 2453 char *value = NULL;
2391 char *value2; 2454 char *value2;
2455 char *ac_value;
2392 int ret; 2456 int ret;
2393 struct GNUNET_TESTING_NetjailTopology *topo; 2457 struct GNUNET_TESTING_NetjailTopology *topo;
2394 struct GNUNET_TESTING_NetjailNode *node;
2395 struct GNUNET_TESTING_NetjailRouter *router; 2458 struct GNUNET_TESTING_NetjailRouter *router;
2396 struct GNUNET_TESTING_NetjailNamespace *namespace; 2459 struct GNUNET_TESTING_NetjailNamespace *namespace;
2397 struct GNUNET_ShortHashCode *hkey; 2460 struct GNUNET_ShortHashCode *hkey;
@@ -2466,7 +2529,8 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2466 else if (0 == strcmp (key, "K")) 2529 else if (0 == strcmp (key, "K"))
2467 { 2530 {
2468 hkey = GNUNET_new (struct GNUNET_ShortHashCode); 2531 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
2469 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); 2532 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
2533 GNUNET_TESTING_NetjailNode);
2470 2534
2471 LOG (GNUNET_ERROR_TYPE_DEBUG, 2535 LOG (GNUNET_ERROR_TYPE_DEBUG,
2472 "Get first Value for K.\n"); 2536 "Get first Value for K.\n");
@@ -2474,12 +2538,12 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2474 LOG (GNUNET_ERROR_TYPE_DEBUG, 2538 LOG (GNUNET_ERROR_TYPE_DEBUG,
2475 "K: %u\n", 2539 "K: %u\n",
2476 out); 2540 out);
2477 node->node_n = out; 2541 k_node->node_n = out;
2478 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2542 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2479 memcpy (hkey, 2543 memcpy (hkey,
2480 &hc, 2544 &hc,
2481 sizeof (*hkey)); 2545 sizeof (*hkey));
2482 node->is_global = GNUNET_YES; 2546 k_node->is_global = GNUNET_YES;
2483 2547
2484 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2548 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2485 topo->map_globals, 2549 topo->map_globals,
@@ -2488,7 +2552,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2488 else 2552 else
2489 GNUNET_CONTAINER_multishortmap_put (topo->map_globals, 2553 GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
2490 hkey, 2554 hkey,
2491 node, 2555 k_node,
2492 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2556 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2493 LOG (GNUNET_ERROR_TYPE_DEBUG, 2557 LOG (GNUNET_ERROR_TYPE_DEBUG,
2494 "Get value for key value on K.\n"); 2558 "Get value for key value on K.\n");
@@ -2496,14 +2560,14 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2496 LOG (GNUNET_ERROR_TYPE_DEBUG, 2560 LOG (GNUNET_ERROR_TYPE_DEBUG,
2497 "value: %s\n", 2561 "value: %s\n",
2498 value); 2562 value);
2499 node->plugin = value; 2563 k_node->plugin = value;
2500 node_connections (token, node); 2564 node_connections (token, k_node);
2565 GNUNET_free (value);
2501 } 2566 }
2502 else if (0 == strcmp (key, "R")) 2567 else if (0 == strcmp (key, "R"))
2503 { 2568 {
2504 hkey = GNUNET_new (struct GNUNET_ShortHashCode); 2569 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
2505 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter); 2570 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
2506 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
2507 2571
2508 LOG (GNUNET_ERROR_TYPE_DEBUG, 2572 LOG (GNUNET_ERROR_TYPE_DEBUG,
2509 "Get first Value for R.\n"); 2573 "Get first Value for R.\n");
@@ -2511,7 +2575,6 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2511 LOG (GNUNET_ERROR_TYPE_DEBUG, 2575 LOG (GNUNET_ERROR_TYPE_DEBUG,
2512 "R: %u\n", 2576 "R: %u\n",
2513 out); 2577 out);
2514 node->node_n = out;
2515 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); 2578 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2516 memcpy (hkey, 2579 memcpy (hkey,
2517 &hc, 2580 &hc,
@@ -2523,18 +2586,19 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2523 "tcp_port: %s\n", 2586 "tcp_port: %s\n",
2524 value); 2587 value);
2525 ret = sscanf (value, "%u", &(router->tcp_port)); 2588 ret = sscanf (value, "%u", &(router->tcp_port));
2526 2589 GNUNET_free (value);
2527 GNUNET_break (0 != ret && 1 >= router->tcp_port); 2590 GNUNET_break (0 != ret && 1 >= router->tcp_port);
2528 2591
2529 LOG (GNUNET_ERROR_TYPE_DEBUG, 2592 LOG (GNUNET_ERROR_TYPE_DEBUG,
2530 "Get value for key udp_port on R.\n"); 2593 "Get value for key udp_port on R.\n");
2531 value2 = get_value ("udp_port", token); 2594 value2 = get_value ("udp_port", token);
2532 ret = sscanf (value2, "%u", &(router->udp_port)); 2595 ret = sscanf (value2, "%u", &(router->udp_port));
2596 GNUNET_free (value2);
2533 GNUNET_break (0 != ret && 1 >= router->udp_port); 2597 GNUNET_break (0 != ret && 1 >= router->udp_port);
2534 LOG (GNUNET_ERROR_TYPE_DEBUG, 2598 LOG (GNUNET_ERROR_TYPE_DEBUG,
2535 "udp_port: %s\n", 2599 "udp_port: %s\n",
2536 value2); 2600 value2);
2537 2601 GNUNET_free (value2);
2538 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( 2602 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2539 topo->map_namespaces, 2603 topo->map_namespaces,
2540 hkey)) 2604 hkey))
@@ -2557,8 +2621,8 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2557 } 2621 }
2558 else if (0 == strcmp (key, "P")) 2622 else if (0 == strcmp (key, "P"))
2559 { 2623 {
2560 hkey = GNUNET_new (struct GNUNET_ShortHashCode); 2624 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
2561 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); 2625 GNUNET_TESTING_NetjailNode);
2562 2626
2563 LOG (GNUNET_ERROR_TYPE_DEBUG, 2627 LOG (GNUNET_ERROR_TYPE_DEBUG,
2564 "Get first Value for P.\n"); 2628 "Get first Value for P.\n");
@@ -2606,10 +2670,10 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2606 } 2670 }
2607 else 2671 else
2608 { 2672 {
2609 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode); 2673
2610 GNUNET_CONTAINER_multishortmap_put (namespace->nodes, 2674 GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
2611 hkey, 2675 hkey,
2612 node, 2676 p_node,
2613 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2677 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2614 LOG (GNUNET_ERROR_TYPE_DEBUG, 2678 LOG (GNUNET_ERROR_TYPE_DEBUG,
2615 "Get value for key plugin on P.\n"); 2679 "Get value for key plugin on P.\n");
@@ -2617,11 +2681,23 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2617 LOG (GNUNET_ERROR_TYPE_DEBUG, 2681 LOG (GNUNET_ERROR_TYPE_DEBUG,
2618 "plugin: %s\n", 2682 "plugin: %s\n",
2619 value); 2683 value);
2620 node->plugin = value; 2684 memcpy (p_node->plugin, value, sizeof (*value));
2621 node->node_n = out; 2685 GNUNET_free (value);
2622 node->namespace_n = namespace->namespace_n; 2686 p_node->node_n = out;
2687 p_node->namespace_n = namespace->namespace_n;
2623 } 2688 }
2624 node_connections (token, node); 2689 LOG (GNUNET_ERROR_TYPE_DEBUG,
2690 "Get AC Value for P.\n");
2691 ac_value = get_value ("AC", token);
2692 LOG (GNUNET_ERROR_TYPE_DEBUG,
2693 "ac value: %s\n",
2694 ac_value);
2695 sscanf (ac_value, "%u", &p_node->additional_connects);
2696 LOG (GNUNET_ERROR_TYPE_DEBUG,
2697 "P:AC %u\n",
2698 p_node->additional_connects);
2699 node_connections (token, p_node);
2700 GNUNET_free (ac_value);
2625 } 2701 }
2626 token = strtok_r (NULL, "\n", &rest); 2702 token = strtok_r (NULL, "\n", &rest);
2627 if (NULL != token) 2703 if (NULL != token)
@@ -2631,8 +2707,6 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2631 } 2707 }
2632 if (NULL != key) 2708 if (NULL != key)
2633 GNUNET_free (key); 2709 GNUNET_free (key);
2634 /*if (NULL != value)
2635 GNUNET_free (value);*/
2636 2710
2637 return topo; 2711 return topo;
2638} 2712}
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 (
300 tbc); 300 tbc);
301 301
302 tbc->shandle = sh; 302 tbc->shandle = sh;
303 // GNUNET_array_append (tbc->shandle, tbc->n_shandle, sh);
304} 303}
305 304
306 305
@@ -319,6 +318,7 @@ send_all_local_tests_prepared (unsigned int i, unsigned int j, struct
319 reply->header.size = htons ((uint16_t) msg_length); 318 reply->header.size = htons ((uint16_t) msg_length);
320 319
321 send_message_to_locals (i, j, ns, &reply->header); 320 send_message_to_locals (i, j, ns, &reply->header);
321 GNUNET_free (reply);
322} 322}
323 323
324 324
@@ -337,6 +337,7 @@ send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState *ns)
337 reply->header.size = htons ((uint16_t) msg_length); 337 reply->header.size = htons ((uint16_t) msg_length);
338 338
339 send_message_to_locals (i, j, ns, &reply->header); 339 send_message_to_locals (i, j, ns, &reply->header);
340 GNUNET_free (reply);
340} 341}
341 342
342 343
@@ -702,10 +703,10 @@ start_helper (struct NetJailState *ns,
702 { 703 {
703 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 704 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
704 "Send handle is NULL!\n"); 705 "Send handle is NULL!\n");
705 GNUNET_free (msg);
706 GNUNET_TESTING_interpreter_fail (ns->is); 706 GNUNET_TESTING_interpreter_fail (ns->is);
707 } 707 }
708 GNUNET_free (hkey); 708 GNUNET_free (hkey);
709 GNUNET_free (msg);
709} 710}
710 711
711 712