aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2022-12-07 12:47:41 +0100
committert3sserakt <t3ss@posteo.de>2022-12-07 12:47:41 +0100
commitc3793434556c714ee34679ecf6d30de13e0d8758 (patch)
tree548c953ecf6b9e8ba8511830a6a1ddbd9afe8e46 /src/testing
parent34e1c58cb39a649c9a4c551681cedf19807b85f0 (diff)
parent6bebc94d2c7b6eac69b84fde39142d008a643d8d (diff)
downloadgnunet-c3793434556c714ee34679ecf6d30de13e0d8758.tar.gz
gnunet-c3793434556c714ee34679ecf6d30de13e0d8758.zip
Merge branch 'master' of ssh://git.gnunet.org/gnunet
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/gnunet-cmds-helper.c4
-rw-r--r--src/testing/testing.c197
2 files changed, 113 insertions, 88 deletions
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c
index 477c8c60f..624aa58eb 100644
--- a/src/testing/gnunet-cmds-helper.c
+++ b/src/testing/gnunet-cmds-helper.c
@@ -59,9 +59,9 @@
59 59
60#define NODE_BASE_IP "192.168.15." 60#define NODE_BASE_IP "192.168.15."
61 61
62#define KNOWN_BASE_IP "92.68.151." 62#define KNOWN_BASE_IP "172.168.151."
63 63
64#define ROUTER_BASE_IP "92.68.150." 64#define ROUTER_BASE_IP "172.16.150."
65 65
66struct GNUNET_SCHEDULER_Task *finished_task; 66struct GNUNET_SCHEDULER_Task *finished_task;
67 67
diff --git a/src/testing/testing.c b/src/testing/testing.c
index de6bc45f5..56dc4e92d 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -40,9 +40,9 @@
40 40
41#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u" 41#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
42 42
43#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u" 43#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-172.16.150.%u"
44 44
45#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u" 45#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-172.16.151.%u"
46 46
47#define PREFIX_TCP "tcp" 47#define PREFIX_TCP "tcp"
48 48
@@ -128,7 +128,7 @@ struct GNUNET_TESTING_System
128 */ 128 */
129 struct GNUNET_DISK_MapHandle *map; 129 struct GNUNET_DISK_MapHandle *map;
130 130
131 struct SharedService **shared_services; 131 struct SharedService *shared_services;
132 132
133 unsigned int n_shared_services; 133 unsigned int n_shared_services;
134 134
@@ -380,7 +380,7 @@ GNUNET_TESTING_system_create_with_portrange (
380{ 380{
381 struct GNUNET_TESTING_System *system; 381 struct GNUNET_TESTING_System *system;
382 struct GNUNET_TESTING_SharedService tss; 382 struct GNUNET_TESTING_SharedService tss;
383 struct SharedService *ss; 383 struct SharedService ss;
384 unsigned int cnt; 384 unsigned int cnt;
385 385
386 GNUNET_assert (NULL != testdir); 386 GNUNET_assert (NULL != testdir);
@@ -410,22 +410,22 @@ GNUNET_TESTING_system_create_with_portrange (
410 for (cnt = 0; NULL != shared_services[cnt].service; cnt++) 410 for (cnt = 0; NULL != shared_services[cnt].service; cnt++)
411 { 411 {
412 tss = shared_services[cnt]; 412 tss = shared_services[cnt];
413 ss = GNUNET_new (struct SharedService); 413 memset (&ss, 0, sizeof (ss));
414 ss->sname = GNUNET_strdup (tss.service); 414 ss.sname = GNUNET_strdup (tss.service);
415 ss->cfg = GNUNET_CONFIGURATION_create (); 415 ss.cfg = GNUNET_CONFIGURATION_create ();
416 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, 416 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
417 ss->sname, 417 ss.sname,
418 &cfg_copy_iterator, 418 &cfg_copy_iterator,
419 ss->cfg); 419 ss.cfg);
420 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, 420 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
421 "TESTING", 421 "TESTING",
422 &cfg_copy_iterator, 422 &cfg_copy_iterator,
423 ss->cfg); 423 ss.cfg);
424 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg, 424 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
425 "PATHS", 425 "PATHS",
426 &cfg_copy_iterator, 426 &cfg_copy_iterator,
427 ss->cfg); 427 ss.cfg);
428 ss->share = tss.share; 428 ss.share = tss.share;
429 GNUNET_array_append (system->shared_services, 429 GNUNET_array_append (system->shared_services,
430 system->n_shared_services, 430 system->n_shared_services,
431 ss); 431 ss);
@@ -547,7 +547,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
547 hostkeys_unload (system); 547 hostkeys_unload (system);
548 for (ss_cnt = 0; ss_cnt < system->n_shared_services; ss_cnt++) 548 for (ss_cnt = 0; ss_cnt < system->n_shared_services; ss_cnt++)
549 { 549 {
550 ss = system->shared_services[ss_cnt]; 550 ss = &system->shared_services[ss_cnt];
551 for (i_cnt = 0; i_cnt < ss->n_instances; i_cnt++) 551 for (i_cnt = 0; i_cnt < ss->n_instances; i_cnt++)
552 { 552 {
553 i = ss->instances[i_cnt]; 553 i = ss->instances[i_cnt];
@@ -558,7 +558,6 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
558 GNUNET_free (ss->instances); 558 GNUNET_free (ss->instances);
559 GNUNET_CONFIGURATION_destroy (ss->cfg); 559 GNUNET_CONFIGURATION_destroy (ss->cfg);
560 GNUNET_free (ss->sname); 560 GNUNET_free (ss->sname);
561 GNUNET_free (ss);
562 } 561 }
563 GNUNET_free (system->shared_services); 562 GNUNET_free (system->shared_services);
564 if (GNUNET_YES == remove_paths) 563 if (GNUNET_YES == remove_paths)
@@ -1221,7 +1220,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1221 /* Remove sections for shared services */ 1220 /* Remove sections for shared services */
1222 for (cnt = 0; cnt < system->n_shared_services; cnt++) 1221 for (cnt = 0; cnt < system->n_shared_services; cnt++)
1223 { 1222 {
1224 ss = system->shared_services[cnt]; 1223 ss = &system->shared_services[cnt];
1225 GNUNET_CONFIGURATION_remove_section (cfg, ss->sname); 1224 GNUNET_CONFIGURATION_remove_section (cfg, ss->sname);
1226 } 1225 }
1227 if (GNUNET_OK != 1226 if (GNUNET_OK !=
@@ -1269,7 +1268,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1269 * system->n_shared_services); 1268 * system->n_shared_services);
1270 for (cnt = 0; cnt < system->n_shared_services; cnt++) 1269 for (cnt = 0; cnt < system->n_shared_services; cnt++)
1271 { 1270 {
1272 ss = system->shared_services[cnt]; 1271 ss = &system->shared_services[cnt];
1273 ss_instances[cnt] = associate_shared_service (system, ss, cfg); 1272 ss_instances[cnt] = associate_shared_service (system, ss, cfg);
1274 if (NULL == ss_instances[cnt]) 1273 if (NULL == ss_instances[cnt])
1275 { 1274 {
@@ -1736,8 +1735,12 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0)
1736} 1735}
1737 1736
1738 1737
1738/**
1739 * FIXME: I'm just janitoring around here. I have no idea what this function
1740 * is supposed todo. Needs documentation.
1741 */
1739static unsigned int 1742static unsigned int
1740get_first_value (char *line) 1743get_first_value (const char *line)
1741{ 1744{
1742 char *copy; 1745 char *copy;
1743 size_t slen; 1746 size_t slen;
@@ -1756,8 +1759,12 @@ get_first_value (char *line)
1756} 1759}
1757 1760
1758 1761
1762/**
1763 * FIXME: I'm just janitoring around here. I have no idea what this function
1764 * is supposed todo. Needs documentation.
1765 */
1759static char * 1766static char *
1760get_key (char *line) 1767get_key (const char *line)
1761{ 1768{
1762 char *copy; 1769 char *copy;
1763 size_t slen; 1770 size_t slen;
@@ -1778,8 +1785,12 @@ get_key (char *line)
1778} 1785}
1779 1786
1780 1787
1788/**
1789 * FIXME: I'm just janitoring around here. I have no idea what this function
1790 * is supposed todo. Needs documentation.
1791 */
1781static char * 1792static char *
1782get_first_string_value (char *line) 1793get_first_string_value (const char *line)
1783{ 1794{
1784 char *copy; 1795 char *copy;
1785 size_t slen, slen_token; 1796 size_t slen, slen_token;
@@ -1803,61 +1814,71 @@ get_first_string_value (char *line)
1803} 1814}
1804 1815
1805 1816
1817/**
1818 * FIXME: I'm just janitoring around here. I have no idea what this function
1819 * is supposed todo. Needs documentation.
1820 */
1806static unsigned int 1821static unsigned int
1807get_second_value (char *line) 1822get_second_value (const char *line)
1808{ 1823{
1809 char *copy; 1824 char *copy;
1810 size_t slen;
1811 char *token; 1825 char *token;
1812 unsigned int ret; 1826 unsigned int ret;
1813 char *rest = NULL; 1827 char *rest = NULL;
1814 1828
1815 slen = strlen (line) + 1; 1829 copy = GNUNET_strdup (line);
1816 copy = malloc (slen);
1817 memcpy (copy, line, slen);
1818 token = strtok_r (copy, ":", &rest); 1830 token = strtok_r (copy, ":", &rest);
1819 token = strtok_r (NULL, ":", &rest); 1831 token = strtok_r (NULL, ":", &rest);
1820 token = strtok_r (NULL, ":", &rest); 1832 token = strtok_r (NULL, ":", &rest);
1833 /* FIXME: ASSERT??? Are we not parsing "user" input here? */
1821 GNUNET_assert (1 == sscanf (token, "%u", &ret)); 1834 GNUNET_assert (1 == sscanf (token, "%u", &ret));
1822 GNUNET_free (copy); 1835 GNUNET_free (copy);
1823 return ret; 1836 return ret;
1824} 1837}
1825 1838
1826 1839
1840/**
1841 * FIXME: I'm just janitoring around here. I have no idea what this function
1842 * is supposed todo. Needs documentation.
1843 */
1827static char * 1844static char *
1828get_value (char *key, char *line) 1845get_value (const char *key, const char *line)
1829{ 1846{
1830 char *copy; 1847 char copy[strlen (line) + 1];
1831 size_t slen, slen_token; 1848 size_t slen;
1832 char *token; 1849 char *token;
1833 char *token2; 1850 char *token2;
1834 char *temp; 1851 char *temp;
1835 char *rest = NULL; 1852 char *rest = NULL;
1836 char *ret;
1837 1853
1838 slen = strlen (line) + 1; 1854 slen = strlen (line) + 1;
1839 copy = malloc (slen);
1840 memcpy (copy, line, slen); 1855 memcpy (copy, line, slen);
1841 temp = strstr (copy, key); 1856 temp = strstr (copy, key);
1842 if (NULL == temp) 1857 if (NULL == temp)
1843 return NULL; 1858 return NULL;
1844 token = strtok_r (temp, ":", &rest); 1859 token = strtok_r (temp, ":", &rest);
1860 if (NULL == token)
1861 return NULL;
1845 token = strtok_r (NULL, ":", &rest); 1862 token = strtok_r (NULL, ":", &rest);
1863 if (NULL == token)
1864 return NULL;
1846 token2 = strtok_r (token, "}", &rest); 1865 token2 = strtok_r (token, "}", &rest);
1847 slen_token = strlen (token2); 1866 if (NULL == token2)
1848 ret = malloc (slen_token + 1); 1867 return NULL;
1849 memcpy (ret, token2, slen_token + 1); 1868 return GNUNET_strdup (token2);
1850 GNUNET_free (copy);
1851 return ret;
1852} 1869}
1853 1870
1854 1871
1872/**
1873 * FIXME: I'm just janitoring around here. I have no idea what this function
1874 * is supposed todo. Needs documentation.
1875 */
1855static struct GNUNET_TESTING_NodeConnection * 1876static struct GNUNET_TESTING_NodeConnection *
1856get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node) 1877get_connect_value (const char *line,
1878 struct GNUNET_TESTING_NetjailNode *node)
1857{ 1879{
1858 struct GNUNET_TESTING_NodeConnection *node_connection; 1880 struct GNUNET_TESTING_NodeConnection *node_connection;
1859 char *copy; 1881 char *copy;
1860 size_t slen;
1861 char *token; 1882 char *token;
1862 char *token2; 1883 char *token2;
1863 unsigned int node_n; 1884 unsigned int node_n;
@@ -1870,9 +1891,7 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1870 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection); 1891 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
1871 node_connection->node = node; 1892 node_connection->node = node;
1872 1893
1873 slen = strlen (line) + 1; 1894 copy = GNUNET_strdup (line);
1874 copy = malloc (slen);
1875 memcpy (copy, line, slen);
1876 token = strtok_r (copy, ":", &rest); 1895 token = strtok_r (copy, ":", &rest);
1877 if (0 == strcmp ("{K", token)) 1896 if (0 == strcmp ("{K", token))
1878 { 1897 {
@@ -1915,7 +1934,10 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1915 } 1934 }
1916 else 1935 else
1917 { 1936 {
1937 GNUNET_break (0);
1918 GNUNET_free (node_connection); 1938 GNUNET_free (node_connection);
1939 GNUNET_free (copy);
1940 return NULL;
1919 } 1941 }
1920 1942
1921 while (NULL != (token = strtok_r (NULL, ":", &rest))) 1943 while (NULL != (token = strtok_r (NULL, ":", &rest)))
@@ -1923,17 +1945,9 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1923 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix); 1945 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
1924 token2 = strtok_r (token, "}", &rest2); 1946 token2 = strtok_r (token, "}", &rest2);
1925 if (NULL != token2) 1947 if (NULL != token2)
1926 { 1948 prefix->address_prefix = GNUNET_strdup (token2);
1927 slen = strlen (token2) + 1;
1928 prefix->address_prefix = malloc (slen);
1929 memcpy (prefix->address_prefix, token2, slen);
1930 }
1931 else 1949 else
1932 { 1950 prefix->address_prefix = GNUNET_strdup (token);
1933 slen = strlen (token) + 1;
1934 prefix->address_prefix = malloc (slen);
1935 memcpy (prefix->address_prefix, token, slen);
1936 }
1937 1951
1938 LOG (GNUNET_ERROR_TYPE_DEBUG, 1952 LOG (GNUNET_ERROR_TYPE_DEBUG,
1939 "address_prefix %s\n", 1953 "address_prefix %s\n",
@@ -1952,13 +1966,16 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
1952} 1966}
1953 1967
1954 1968
1969/**
1970 * FIXME: I'm just janitoring around here. I have no idea what this function
1971 * is supposed todo. Needs documentation.
1972 */
1955static void 1973static void
1956node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node) 1974node_connections (const char *line, struct GNUNET_TESTING_NetjailNode *node)
1957{ 1975{
1958 char *value, *value2; 1976 char *value, *value2;
1959 char *temp; 1977 char *temp;
1960 char *copy; 1978 char *copy;
1961 size_t slen;
1962 char *rest = NULL; 1979 char *rest = NULL;
1963 char *rest2 = NULL; 1980 char *rest2 = NULL;
1964 struct GNUNET_TESTING_NodeConnection *node_connection; 1981 struct GNUNET_TESTING_NodeConnection *node_connection;
@@ -1967,9 +1984,7 @@ node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node)
1967 temp = strstr (line, "connect"); 1984 temp = strstr (line, "connect");
1968 if (NULL != temp) 1985 if (NULL != temp)
1969 { 1986 {
1970 slen = strlen (temp) + 1; 1987 copy = GNUNET_strdup (temp);
1971 copy = GNUNET_malloc (slen);
1972 memcpy (copy, temp, slen);
1973 strtok_r (copy, ":", &rest); 1988 strtok_r (copy, ":", &rest);
1974 value = strtok_r (rest, "|", &rest2); 1989 value = strtok_r (rest, "|", &rest2);
1975 1990
@@ -1979,6 +1994,8 @@ node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node)
1979 "node_connections value %s\n", 1994 "node_connections value %s\n",
1980 value); 1995 value);
1981 node_connection = get_connect_value (value, node); 1996 node_connection = get_connect_value (value, node);
1997 if (NULL == node_connection)
1998 break; /* FIXME: continue? */
1982 GNUNET_CONTAINER_DLL_insert (node->node_connections_head, 1999 GNUNET_CONTAINER_DLL_insert (node->node_connections_head,
1983 node->node_connections_tail, 2000 node->node_connections_tail,
1984 node_connection); 2001 node_connection);
@@ -1993,6 +2010,10 @@ node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node)
1993} 2010}
1994 2011
1995 2012
2013/**
2014 * FIXME: I'm just janitoring around here. I have no idea what this function
2015 * is supposed todo. Needs documentation.
2016 */
1996static int 2017static int
1997log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value) 2018log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
1998{ 2019{
@@ -2041,7 +2062,7 @@ log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
2041 2062
2042 2063
2043static int 2064static int
2044log_topo (struct GNUNET_TESTING_NetjailTopology *topology) 2065log_topo (const struct GNUNET_TESTING_NetjailTopology *topology)
2045{ 2066{
2046 LOG (GNUNET_ERROR_TYPE_DEBUG, 2067 LOG (GNUNET_ERROR_TYPE_DEBUG,
2047 "plugin: %s spaces: %u nodes: %u known: %u\n", 2068 "plugin: %s spaces: %u nodes: %u known: %u\n",
@@ -2057,15 +2078,18 @@ log_topo (struct GNUNET_TESTING_NetjailTopology *topology)
2057 return GNUNET_YES; 2078 return GNUNET_YES;
2058} 2079}
2059 2080
2060void 2081/**
2082 * FIXME: I'm just janitoring around here. I have no idea what this function
2083 * is supposed todo. Needs documentation.
2084 */
2085static void
2061get_node_info (unsigned int num, 2086get_node_info (unsigned int num,
2062 struct GNUNET_TESTING_NetjailTopology *topology, 2087 const struct GNUNET_TESTING_NetjailTopology *topology,
2063 struct GNUNET_TESTING_NetjailNode **node_ex, 2088 struct GNUNET_TESTING_NetjailNode **node_ex,
2064 struct GNUNET_TESTING_NetjailNamespace **namespace_ex, 2089 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
2065 struct GNUNET_TESTING_NodeConnection **node_connections_ex) 2090 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
2066{ 2091{
2067 struct GNUNET_ShortHashCode *hkey; 2092 struct GNUNET_ShortHashCode hkey;
2068 struct GNUNET_ShortHashCode *hkey_node;
2069 struct GNUNET_HashCode hc; 2093 struct GNUNET_HashCode hc;
2070 unsigned int namespace_n; 2094 unsigned int namespace_n;
2071 unsigned int node_m; 2095 unsigned int node_m;
@@ -2074,7 +2098,6 @@ get_node_info (unsigned int num,
2074 struct GNUNET_TESTING_NodeConnection *node_connections = NULL; 2098 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
2075 2099
2076 log_topo (topology); 2100 log_topo (topology);
2077 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
2078 LOG (GNUNET_ERROR_TYPE_DEBUG, 2101 LOG (GNUNET_ERROR_TYPE_DEBUG,
2079 "num: %u \n", 2102 "num: %u \n",
2080 num); 2103 num);
@@ -2082,11 +2105,11 @@ get_node_info (unsigned int num,
2082 { 2105 {
2083 2106
2084 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc); 2107 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
2085 memcpy (hkey, 2108 memcpy (&hkey,
2086 &hc, 2109 &hc,
2087 sizeof (*hkey)); 2110 sizeof (hkey));
2088 node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals, 2111 node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
2089 hkey); 2112 &hkey);
2090 if (NULL != node) 2113 if (NULL != node)
2091 { 2114 {
2092 *node_ex = node; 2115 *node_ex = node;
@@ -2104,21 +2127,20 @@ get_node_info (unsigned int num,
2104 topology->nodes_m, 2127 topology->nodes_m,
2105 namespace_n); 2128 namespace_n);
2106 GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc); 2129 GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
2107 memcpy (hkey, 2130 memcpy (&hkey,
2108 &hc, 2131 &hc,
2109 sizeof (*hkey)); 2132 sizeof (hkey));
2110 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces, 2133 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
2111 hkey); 2134 &hkey);
2112 if (NULL != namespace) 2135 if (NULL != namespace)
2113 { 2136 {
2114 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1); 2137 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
2115 hkey_node = GNUNET_new (struct GNUNET_ShortHashCode);
2116 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc); 2138 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
2117 memcpy (hkey, 2139 memcpy (&hkey,
2118 &hc, 2140 &hc,
2119 sizeof (*hkey)); 2141 sizeof (hkey));
2120 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes, 2142 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
2121 hkey); 2143 &hkey);
2122 if (NULL != node) 2144 if (NULL != node)
2123 { 2145 {
2124 LOG (GNUNET_ERROR_TYPE_DEBUG, 2146 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -2130,10 +2152,8 @@ get_node_info (unsigned int num,
2130 *node_ex = node; 2152 *node_ex = node;
2131 *namespace_ex = namespace; 2153 *namespace_ex = namespace;
2132 *node_connections_ex = node_connections; 2154 *node_connections_ex = node_connections;
2133 GNUNET_free (hkey_node);
2134 } 2155 }
2135 } 2156 }
2136 GNUNET_free (hkey);
2137} 2157}
2138 2158
2139/** 2159/**
@@ -2167,7 +2187,7 @@ GNUNET_TESTING_get_node (unsigned int num,
2167 */ 2187 */
2168struct GNUNET_TESTING_NodeConnection * 2188struct GNUNET_TESTING_NodeConnection *
2169GNUNET_TESTING_get_connections (unsigned int num, 2189GNUNET_TESTING_get_connections (unsigned int num,
2170 struct GNUNET_TESTING_NetjailTopology *topology) 2190 const struct GNUNET_TESTING_NetjailTopology *topology)
2171{ 2191{
2172 struct GNUNET_TESTING_NetjailNode *node; 2192 struct GNUNET_TESTING_NetjailNode *node;
2173 struct GNUNET_TESTING_NetjailNamespace *namespace; 2193 struct GNUNET_TESTING_NetjailNamespace *namespace;
@@ -2182,13 +2202,14 @@ GNUNET_TESTING_get_connections (unsigned int num,
2182} 2202}
2183 2203
2184 2204
2205/**
2206 * FIXME: Function named incorrectly IMO
2207 */
2185struct GNUNET_PeerIdentity * 2208struct GNUNET_PeerIdentity *
2186GNUNET_TESTING_get_pub_key (unsigned int num, 2209GNUNET_TESTING_get_pub_key (unsigned int num,
2187 const struct GNUNET_TESTING_System *tl_system) 2210 const struct GNUNET_TESTING_System *tl_system)
2188{ 2211{
2189 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); 2212 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
2190 struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
2191 GNUNET_CRYPTO_EddsaPublicKey);
2192 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key; 2213 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
2193 2214
2194 priv_key = GNUNET_TESTING_hostkey_get (tl_system, 2215 priv_key = GNUNET_TESTING_hostkey_get (tl_system,
@@ -2196,10 +2217,8 @@ GNUNET_TESTING_get_pub_key (unsigned int num,
2196 peer); 2217 peer);
2197 2218
2198 GNUNET_CRYPTO_eddsa_key_get_public (priv_key, 2219 GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
2199 pub_key); 2220 &peer->public_key);
2200 peer->public_key = *pub_key;
2201 GNUNET_free (priv_key); 2221 GNUNET_free (priv_key);
2202 GNUNET_free (pub_key);
2203 return peer; 2222 return peer;
2204} 2223}
2205 2224
@@ -2299,7 +2318,7 @@ GNUNET_TESTING_calculate_num (
2299 */ 2318 */
2300char * 2319char *
2301GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, 2320GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
2302 char *prefix) 2321 const char *prefix)
2303{ 2322{
2304 struct GNUNET_TESTING_NetjailNode *node; 2323 struct GNUNET_TESTING_NetjailNode *node;
2305 char *addr; 2324 char *addr;
@@ -2374,6 +2393,12 @@ GNUNET_TESTING_get_additional_connects (unsigned int num,
2374 2393
2375 get_node_info (num, topology, &node, &namespace, &node_connections); 2394 get_node_info (num, topology, &node, &namespace, &node_connections);
2376 2395
2396 if (NULL == node)
2397 {
2398 LOG (GNUNET_ERROR_TYPE_WARNING,
2399 "No info found for node %d\n", num);
2400 return 0;
2401 }
2377 LOG (GNUNET_ERROR_TYPE_DEBUG, 2402 LOG (GNUNET_ERROR_TYPE_DEBUG,
2378 "node additional_connects for node %p\n", 2403 "node additional_connects for node %p\n",
2379 node); 2404 node);
@@ -2401,7 +2426,7 @@ GNUNET_TESTING_send_local_test_finished_msg ()
2401 2426
2402 2427
2403static void 2428static void
2404parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, char *token) 2429parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const char *token)
2405{ 2430{
2406 char *ac_value; 2431 char *ac_value;
2407 int ret; 2432 int ret;
@@ -2438,7 +2463,7 @@ parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, char *token)
2438 * @return The GNUNET_TESTING_NetjailTopology 2463 * @return The GNUNET_TESTING_NetjailTopology
2439 */ 2464 */
2440struct GNUNET_TESTING_NetjailTopology * 2465struct GNUNET_TESTING_NetjailTopology *
2441GNUNET_TESTING_get_topo_from_string (char *data) 2466GNUNET_TESTING_get_topo_from_string (const char *input)
2442{ 2467{
2443 char *token; 2468 char *token;
2444 char *key = NULL; 2469 char *key = NULL;
@@ -2446,12 +2471,14 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2446 char *rest = NULL; 2471 char *rest = NULL;
2447 char *value = NULL; 2472 char *value = NULL;
2448 char *value2; 2473 char *value2;
2474 char *data;
2449 int ret; 2475 int ret;
2450 struct GNUNET_TESTING_NetjailTopology *topo; 2476 struct GNUNET_TESTING_NetjailTopology *topo;
2451 struct GNUNET_TESTING_NetjailRouter *router; 2477 struct GNUNET_TESTING_NetjailRouter *router;
2452 struct GNUNET_TESTING_NetjailNamespace *namespace; 2478 struct GNUNET_TESTING_NetjailNamespace *namespace;
2453 struct GNUNET_HashCode hc; 2479 struct GNUNET_HashCode hc;
2454 2480
2481 data = GNUNET_strdup (input);
2455 token = strtok_r (data, "\n", &rest); 2482 token = strtok_r (data, "\n", &rest);
2456 topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology); 2483 topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology);
2457 topo->map_namespaces = 2484 topo->map_namespaces =
@@ -2462,7 +2489,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2462 while (NULL != token) 2489 while (NULL != token)
2463 { 2490 {
2464 if (NULL != key) 2491 if (NULL != key)
2465 free (key); 2492 GNUNET_free (key);
2466 key = get_key (token); 2493 key = get_key (token);
2467 LOG (GNUNET_ERROR_TYPE_DEBUG, 2494 LOG (GNUNET_ERROR_TYPE_DEBUG,
2468 "In the loop with token: %s beginning with %s\n", 2495 "In the loop with token: %s beginning with %s\n",
@@ -2677,10 +2704,8 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2677 LOG (GNUNET_ERROR_TYPE_DEBUG, 2704 LOG (GNUNET_ERROR_TYPE_DEBUG,
2678 "plugin: %s\n", 2705 "plugin: %s\n",
2679 value); 2706 value);
2680 p_node->plugin = GNUNET_malloc (sizeof(*value)); 2707 p_node->plugin = value;
2681 memcpy (p_node->plugin, value, sizeof (*value));
2682 } 2708 }
2683 GNUNET_free (value);
2684 p_node->node_n = out; 2709 p_node->node_n = out;
2685 p_node->namespace_n = namespace->namespace_n; 2710 p_node->namespace_n = namespace->namespace_n;
2686 } 2711 }
@@ -2697,7 +2722,7 @@ GNUNET_TESTING_get_topo_from_string (char *data)
2697 } 2722 }
2698 if (NULL != key) 2723 if (NULL != key)
2699 GNUNET_free (key); 2724 GNUNET_free (key);
2700 2725 GNUNET_free (data);
2701 return topo; 2726 return topo;
2702} 2727}
2703 2728