diff options
author | t3sserakt <t3ss@posteo.de> | 2021-11-19 15:18:24 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-11-19 15:18:24 +0100 |
commit | 6a043a9228022fcce97fd50739db74abdabde055 (patch) | |
tree | 8cba6d9a87731cce5d20a3f8f2cf0cb2cb8ef37d /src/transport | |
parent | 154d13fcb10205edf5fb56c12ac47e65abfec5a6 (diff) | |
download | gnunet-6a043a9228022fcce97fd50739db74abdabde055.tar.gz gnunet-6a043a9228022fcce97fd50739db74abdabde055.zip |
- Fixed header, fixed log level, changed block until connect logic, fixed memory issues.
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/Makefile.am | 3 | ||||
-rw-r--r-- | src/transport/gnunet-communicator-tcp.c | 17 | ||||
-rw-r--r-- | src/transport/test_communicator_tcp_basic_peer1.conf | 2 | ||||
-rw-r--r-- | src/transport/test_transport_api2_tcp_node1.conf | 1 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send.c | 22 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | 56 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_udp_backchannel.c | 17 | ||||
-rwxr-xr-x | src/transport/test_transport_simple_send.sh | 5 | ||||
-rwxr-xr-x | src/transport/test_transport_simple_send_broadcast.sh | 6 | ||||
-rwxr-xr-x | src/transport/test_transport_simple_send_string.sh | 7 | ||||
-rwxr-xr-x | src/transport/test_transport_udp_backchannel.sh | 5 | ||||
-rw-r--r-- | src/transport/transport-testing-cmds.h | 11 | ||||
-rw-r--r-- | src/transport/transport_api_cmd_connecting_peers.c | 13 | ||||
-rw-r--r-- | src/transport/transport_api_cmd_start_peer.c | 17 |
14 files changed, 120 insertions, 62 deletions
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index f17be359e..a53f17fe6 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -123,6 +123,7 @@ endif | |||
123 | 123 | ||
124 | 124 | ||
125 | noinst_PROGRAMS = \ | 125 | noinst_PROGRAMS = \ |
126 | test_transport_start_with_config \ | ||
126 | gnunet-transport-profiler \ | 127 | gnunet-transport-profiler \ |
127 | gnunet-communicator-udp \ | 128 | gnunet-communicator-udp \ |
128 | $(WLAN_BIN_SENDER) \ | 129 | $(WLAN_BIN_SENDER) \ |
@@ -589,7 +590,6 @@ libgnunet_plugin_transport_https_server_la_CFLAGS = \ | |||
589 | $(MHD_CFLAGS) $(AM_CFLAGS) -DBUILD_HTTPS | 590 | $(MHD_CFLAGS) $(AM_CFLAGS) -DBUILD_HTTPS |
590 | 591 | ||
591 | check_PROGRAMS = \ | 592 | check_PROGRAMS = \ |
592 | test_transport_start_with_config \ | ||
593 | test_transport_address_switch_tcp \ | 593 | test_transport_address_switch_tcp \ |
594 | test_transport_testing_startstop \ | 594 | test_transport_testing_startstop \ |
595 | test_transport_testing_restart \ | 595 | test_transport_testing_restart \ |
@@ -766,7 +766,6 @@ test_transport_start_with_config_SOURCES = \ | |||
766 | test_transport_start_with_config_LDADD = \ | 766 | test_transport_start_with_config_LDADD = \ |
767 | $(top_builddir)/src/testing/libgnunettesting.la \ | 767 | $(top_builddir)/src/testing/libgnunettesting.la \ |
768 | $(top_builddir)/src/util/libgnunetutil.la \ | 768 | $(top_builddir)/src/util/libgnunetutil.la \ |
769 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
770 | $(top_builddir)/src/hello/libgnunethello.la \ | 769 | $(top_builddir)/src/hello/libgnunethello.la \ |
771 | libgnunettransportcore.la \ | 770 | libgnunettransportcore.la \ |
772 | libgnunettransporttesting2.la | 771 | libgnunettransporttesting2.la |
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 0bf919787..07eb6db3a 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -3264,7 +3264,7 @@ init_socket (struct sockaddr *addr, | |||
3264 | return GNUNET_SYSERR; | 3264 | return GNUNET_SYSERR; |
3265 | } | 3265 | } |
3266 | 3266 | ||
3267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 3267 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3268 | "address %s\n", | 3268 | "address %s\n", |
3269 | GNUNET_a2s (addr, in_len)); | 3269 | GNUNET_a2s (addr, in_len)); |
3270 | 3270 | ||
@@ -3403,15 +3403,17 @@ nat_register () | |||
3403 | socklen_t *saddr_lens; | 3403 | socklen_t *saddr_lens; |
3404 | int i; | 3404 | int i; |
3405 | struct Addresses *pos; | 3405 | struct Addresses *pos; |
3406 | size_t len; | ||
3406 | 3407 | ||
3407 | 3408 | ||
3408 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3409 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3409 | "starting nat register!\n"); | 3410 | "starting nat register!\n"); |
3410 | 3411 | ||
3412 | len = 0; | ||
3411 | i = 0; | 3413 | i = 0; |
3412 | saddrs = GNUNET_malloc ((addrs_lens + 1) * sizeof(struct sockaddr *)); | 3414 | saddrs = GNUNET_malloc ((addrs_lens) * sizeof(struct sockaddr *)); |
3413 | 3415 | ||
3414 | saddr_lens = GNUNET_malloc ((addrs_lens + 1) * sizeof(socklen_t)); | 3416 | saddr_lens = GNUNET_malloc ((addrs_lens) * sizeof(socklen_t)); |
3415 | 3417 | ||
3416 | for (pos = addrs_head; NULL != pos; pos = pos->next) | 3418 | for (pos = addrs_head; NULL != pos; pos = pos->next) |
3417 | { | 3419 | { |
@@ -3421,12 +3423,19 @@ nat_register () | |||
3421 | GNUNET_a2s (addrs_head->addr, addrs_head->addr_len)); | 3423 | GNUNET_a2s (addrs_head->addr, addrs_head->addr_len)); |
3422 | 3424 | ||
3423 | saddr_lens[i] = addrs_head->addr_len; | 3425 | saddr_lens[i] = addrs_head->addr_len; |
3426 | len += saddr_lens[i]; | ||
3424 | saddrs[i] = GNUNET_memdup (addrs_head->addr, saddr_lens[i]); | 3427 | saddrs[i] = GNUNET_memdup (addrs_head->addr, saddr_lens[i]); |
3425 | 3428 | ||
3426 | i++; | 3429 | i++; |
3427 | 3430 | ||
3428 | } | 3431 | } |
3429 | 3432 | ||
3433 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3434 | "registering addresses %lu %lu %lu %lu\n", | ||
3435 | (addrs_lens) * sizeof(struct sockaddr *), | ||
3436 | (addrs_lens) * sizeof(socklen_t), | ||
3437 | len, | ||
3438 | sizeof(COMMUNICATOR_CONFIG_SECTION)); | ||
3430 | nat = GNUNET_NAT_register (cfg, | 3439 | nat = GNUNET_NAT_register (cfg, |
3431 | COMMUNICATOR_CONFIG_SECTION, | 3440 | COMMUNICATOR_CONFIG_SECTION, |
3432 | IPPROTO_TCP, | 3441 | IPPROTO_TCP, |
@@ -3437,7 +3446,7 @@ nat_register () | |||
3437 | NULL /* FIXME: support reversal: #5529 */, | 3446 | NULL /* FIXME: support reversal: #5529 */, |
3438 | NULL /* closure */); | 3447 | NULL /* closure */); |
3439 | 3448 | ||
3440 | i = 0; | 3449 | // i = 0; |
3441 | 3450 | ||
3442 | for (i = addrs_lens - 1; i >= 0; i--) | 3451 | for (i = addrs_lens - 1; i >= 0; i--) |
3443 | GNUNET_free (saddrs[i]); | 3452 | GNUNET_free (saddrs[i]); |
diff --git a/src/transport/test_communicator_tcp_basic_peer1.conf b/src/transport/test_communicator_tcp_basic_peer1.conf index dbc227ac6..d9fff8bbb 100644 --- a/src/transport/test_communicator_tcp_basic_peer1.conf +++ b/src/transport/test_communicator_tcp_basic_peer1.conf | |||
@@ -36,7 +36,7 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock | |||
36 | 36 | ||
37 | [communicator-tcp] | 37 | [communicator-tcp] |
38 | #PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args | 38 | #PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args |
39 | #PREFIX = valgrind --leak-check=full --track-origins=yes | 39 | PREFIX = valgrind --leak-check=full --track-origins=yes |
40 | BINDTO = 60002 | 40 | BINDTO = 60002 |
41 | DISABLE_V6 = YES | 41 | DISABLE_V6 = YES |
42 | 42 | ||
diff --git a/src/transport/test_transport_api2_tcp_node1.conf b/src/transport/test_transport_api2_tcp_node1.conf index 807a9360a..d6932b1b9 100644 --- a/src/transport/test_transport_api2_tcp_node1.conf +++ b/src/transport/test_transport_api2_tcp_node1.conf | |||
@@ -15,6 +15,7 @@ DISABLE_V6 = YES | |||
15 | IMMEDIATE_START = YES | 15 | IMMEDIATE_START = YES |
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock |
17 | #PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p | 17 | #PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p |
18 | PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args | ||
18 | 19 | ||
19 | [communicator-udp] | 20 | [communicator-udp] |
20 | BINARY = gnunet-communicator-udp | 21 | BINARY = gnunet-communicator-udp |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c index 6829daf84..476fbdf4f 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send.c +++ b/src/transport/test_transport_plugin_cmd_simple_send.c | |||
@@ -164,19 +164,20 @@ handle_result (void *cls, | |||
164 | * | 164 | * |
165 | */ | 165 | */ |
166 | static void * | 166 | static void * |
167 | notify_connect (void *cls, | 167 | notify_connect (struct GNUNET_TESTING_Interpreter *is, |
168 | const struct GNUNET_PeerIdentity *peer, | 168 | const struct GNUNET_PeerIdentity *peer) |
169 | struct GNUNET_MQ_Handle *mq) | ||
170 | { | 169 | { |
171 | struct ConnectPeersState *cps; | 170 | struct ConnectPeersState *cps; |
171 | const struct GNUNET_TESTING_Command *cmd; | ||
172 | 172 | ||
173 | GNUNET_TRANSPORT_get_trait_connect_peer_state (&connect_peers, | 173 | cmd = GNUNET_TESTING_interpreter_lookup_command (is, |
174 | "connect-peers"); | ||
175 | GNUNET_TRANSPORT_get_trait_connect_peer_state (cmd, | ||
174 | &cps); | 176 | &cps); |
175 | void *ret = NULL; | 177 | void *ret = NULL; |
176 | 178 | ||
177 | cps->notify_connect (cps, | 179 | cps->notify_connect (is, |
178 | peer, | 180 | peer); |
179 | mq); | ||
180 | return ret; | 181 | return ret; |
181 | } | 182 | } |
182 | 183 | ||
@@ -246,7 +247,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
246 | else | 247 | else |
247 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; | 248 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; |
248 | 249 | ||
249 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); | 250 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ( |
251 | "block"); | ||
250 | block_receive = GNUNET_TESTING_cmd_block_until_external_trigger ( | 252 | block_receive = GNUNET_TESTING_cmd_block_until_external_trigger ( |
251 | "block-receive"); | 253 | "block-receive"); |
252 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", | 254 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", |
@@ -262,11 +264,11 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
262 | GNUNET_asprintf (&ts->cfgname, | 264 | GNUNET_asprintf (&ts->cfgname, |
263 | "test_transport_api2_tcp_node1.conf"); | 265 | "test_transport_api2_tcp_node1.conf"); |
264 | 266 | ||
265 | LOG (GNUNET_ERROR_TYPE_ERROR, | 267 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
266 | "plugin cfgname: %s\n", | 268 | "plugin cfgname: %s\n", |
267 | ts->cfgname); | 269 | ts->cfgname); |
268 | 270 | ||
269 | LOG (GNUNET_ERROR_TYPE_ERROR, | 271 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
270 | "node ip: %s\n", | 272 | "node ip: %s\n", |
271 | node_ip); | 273 | node_ip); |
272 | 274 | ||
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c index 986fe6014..e2757671b 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_broadcast.c | |||
@@ -74,7 +74,6 @@ static struct GNUNET_TESTING_Command connect_peers; | |||
74 | 74 | ||
75 | static struct GNUNET_TESTING_Command local_prepared; | 75 | static struct GNUNET_TESTING_Command local_prepared; |
76 | 76 | ||
77 | |||
78 | /** | 77 | /** |
79 | * Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being | 78 | * Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being |
80 | * received. | 79 | * received. |
@@ -164,25 +163,50 @@ handle_result (void *cls, | |||
164 | * | 163 | * |
165 | */ | 164 | */ |
166 | static void * | 165 | static void * |
167 | notify_connect (void *cls, | 166 | notify_connect (struct GNUNET_TESTING_Interpreter *is, |
168 | const struct GNUNET_PeerIdentity *peer, | 167 | const struct GNUNET_PeerIdentity *peer) |
169 | struct GNUNET_MQ_Handle *mq) | ||
170 | { | 168 | { |
171 | struct GNUNET_TESTING_AsyncContext *ac; | 169 | struct GNUNET_TESTING_AsyncContext *ac; |
170 | void *ret = NULL; | ||
171 | const struct GNUNET_TESTING_Command *cmd; | ||
172 | struct BlockState *bs; | ||
173 | |||
172 | 174 | ||
173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 175 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
174 | "notify_connect\n"); | 176 | "notify_connect\n"); |
175 | 177 | ||
176 | GNUNET_TESTING_get_trait_async_context (&connect_peers, | 178 | GNUNET_TESTING_get_trait_async_context (&connect_peers, |
177 | &ac); | 179 | &ac); |
178 | void *ret = NULL; | ||
179 | 180 | ||
180 | GNUNET_assert (NULL != ac); | 181 | if (NULL != ac->is) |
181 | if (NULL == ac->cont) | 182 | { |
182 | GNUNET_TESTING_async_fail (ac); | 183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
184 | "notify_connect running\n"); | ||
185 | GNUNET_assert (NULL != ac); | ||
186 | if (NULL == ac->cont) | ||
187 | GNUNET_TESTING_async_fail (ac); | ||
188 | else | ||
189 | GNUNET_TESTING_async_finish (ac); | ||
190 | } | ||
183 | else | 191 | else |
184 | GNUNET_TESTING_async_finish (ac); | 192 | { |
185 | 193 | cmd = GNUNET_TESTING_interpreter_lookup_future_command (is, | |
194 | "connect-peers"); | ||
195 | |||
196 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
197 | "block state %s\n", | ||
198 | cmd->label); | ||
199 | GNUNET_TESTING_get_trait_block_state (cmd,&bs); | ||
200 | |||
201 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
202 | "block state %u\n", | ||
203 | bs->asynchronous_finish); | ||
204 | bs->asynchronous_finish = GNUNET_YES; | ||
205 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
206 | "block state %u\n", | ||
207 | bs->asynchronous_finish); | ||
208 | } | ||
209 | |||
186 | return ret; | 210 | return ret; |
187 | } | 211 | } |
188 | 212 | ||
@@ -224,7 +248,6 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
224 | char *topology_data, | 248 | char *topology_data, |
225 | unsigned int *read_file) | 249 | unsigned int *read_file) |
226 | { | 250 | { |
227 | |||
228 | unsigned int n_int; | 251 | unsigned int n_int; |
229 | unsigned int m_int; | 252 | unsigned int m_int; |
230 | unsigned int local_m_int; | 253 | unsigned int local_m_int; |
@@ -232,6 +255,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
232 | struct TestState *ts = GNUNET_new (struct TestState); | 255 | struct TestState *ts = GNUNET_new (struct TestState); |
233 | struct GNUNET_TESTING_NetjailTopology *topology; | 256 | struct GNUNET_TESTING_NetjailTopology *topology; |
234 | 257 | ||
258 | |||
259 | |||
235 | if (GNUNET_YES == *read_file) | 260 | if (GNUNET_YES == *read_file) |
236 | { | 261 | { |
237 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 262 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -255,7 +280,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
255 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); | 280 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); |
256 | block_receive = GNUNET_TESTING_cmd_block_until_external_trigger ( | 281 | block_receive = GNUNET_TESTING_cmd_block_until_external_trigger ( |
257 | "block-receive"); | 282 | "block-receive"); |
258 | connect_peers = GNUNET_TESTING_cmd_block_until_external_trigger ("connect-peers"); | 283 | connect_peers = GNUNET_TESTING_cmd_block_until_external_trigger ( |
284 | "connect-peers"); | ||
259 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( | 285 | local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( |
260 | "local-test-prepared", | 286 | "local-test-prepared", |
261 | write_message); | 287 | write_message); |
@@ -264,11 +290,11 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
264 | GNUNET_asprintf (&ts->cfgname, | 290 | GNUNET_asprintf (&ts->cfgname, |
265 | "test_transport_api2_tcp_node1.conf"); | 291 | "test_transport_api2_tcp_node1.conf"); |
266 | 292 | ||
267 | LOG (GNUNET_ERROR_TYPE_ERROR, | 293 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
268 | "plugin cfgname: %s\n", | 294 | "plugin cfgname: %s\n", |
269 | ts->cfgname); | 295 | ts->cfgname); |
270 | 296 | ||
271 | LOG (GNUNET_ERROR_TYPE_ERROR, | 297 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
272 | "node ip: %s\n", | 298 | "node ip: %s\n", |
273 | node_ip); | 299 | node_ip); |
274 | 300 | ||
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c index 11cd177c4..c98a3075d 100644 --- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c +++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c | |||
@@ -160,9 +160,8 @@ handle_result (void *cls, | |||
160 | * | 160 | * |
161 | */ | 161 | */ |
162 | static void * | 162 | static void * |
163 | notify_connect (void *cls, | 163 | notify_connect (struct GNUNET_TESTING_Interpreter *is, |
164 | const struct GNUNET_PeerIdentity *peer, | 164 | const struct GNUNET_PeerIdentity *peer) |
165 | struct GNUNET_MQ_Handle *mq) | ||
166 | { | 165 | { |
167 | struct ConnectPeersState *cps; | 166 | struct ConnectPeersState *cps; |
168 | 167 | ||
@@ -170,9 +169,8 @@ notify_connect (void *cls, | |||
170 | &cps); | 169 | &cps); |
171 | void *ret = NULL; | 170 | void *ret = NULL; |
172 | 171 | ||
173 | cps->notify_connect (cps, | 172 | cps->notify_connect (is, |
174 | peer, | 173 | peer); |
175 | mq); | ||
176 | return ret; | 174 | return ret; |
177 | } | 175 | } |
178 | 176 | ||
@@ -238,7 +236,8 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
238 | else | 236 | else |
239 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; | 237 | num = (n_int - 1) * local_m_int + m_int + topology->nodes_x; |
240 | 238 | ||
241 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block"); | 239 | block_send = GNUNET_TESTING_cmd_block_until_external_trigger ( |
240 | "block"); | ||
242 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", | 241 | connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers", |
243 | "start-peer", | 242 | "start-peer", |
244 | "system-create", | 243 | "system-create", |
@@ -251,11 +250,11 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
251 | GNUNET_asprintf (&ts->cfgname, | 250 | GNUNET_asprintf (&ts->cfgname, |
252 | "test_transport_api2_tcp_node1.conf"); | 251 | "test_transport_api2_tcp_node1.conf"); |
253 | 252 | ||
254 | LOG (GNUNET_ERROR_TYPE_ERROR, | 253 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
255 | "plugin cfgname: %s\n", | 254 | "plugin cfgname: %s\n", |
256 | ts->cfgname); | 255 | ts->cfgname); |
257 | 256 | ||
258 | LOG (GNUNET_ERROR_TYPE_ERROR, | 257 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
259 | "node ip: %s\n", | 258 | "node ip: %s\n", |
260 | node_ip); | 259 | node_ip); |
261 | 260 | ||
diff --git a/src/transport/test_transport_simple_send.sh b/src/transport/test_transport_simple_send.sh index 7e3ee032f..e7da65ff7 100755 --- a/src/transport/test_transport_simple_send.sh +++ b/src/transport/test_transport_simple_send.sh | |||
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | if [ "$(sysctl -n kernel.unprivileged_userns_clone)" == 1 ]; then | 2 | if ! [ -d "/run/netns" ]; then |
3 | echo You have to create the directory /run/netns. | ||
4 | fi | ||
5 | if [ "$(cat /proc/sys/kernel/core_uses_pid)" == 1 ]; then | ||
3 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_topo.conf" | 6 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_topo.conf" |
4 | else | 7 | else |
5 | 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" | 8 | 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" |
diff --git a/src/transport/test_transport_simple_send_broadcast.sh b/src/transport/test_transport_simple_send_broadcast.sh index 6e455f0d5..93572327b 100755 --- a/src/transport/test_transport_simple_send_broadcast.sh +++ b/src/transport/test_transport_simple_send_broadcast.sh | |||
@@ -1,5 +1,9 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | if [ "$(sysctl -n kernel.unprivileged_userns_clone)" == 1 ]; then | 2 | if ! [ -d "/run/netns" ]; then |
3 | echo You have to create the directory /run/netns. | ||
4 | fi | ||
5 | if [ "$(cat /proc/sys/kernel/core_uses_pid)" == 1 ]; then | ||
6 | # exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip/sed/bash ./test_transport_start_with_config test_transport_simple_send_broadcast_topo.conf" | ||
3 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_broadcast_topo.conf" | 7 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_broadcast_topo.conf" |
4 | else | 8 | else |
5 | 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" | 9 | echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n" |
diff --git a/src/transport/test_transport_simple_send_string.sh b/src/transport/test_transport_simple_send_string.sh index 018ea55e8..f9510e6b6 100755 --- a/src/transport/test_transport_simple_send_string.sh +++ b/src/transport/test_transport_simple_send_string.sh | |||
@@ -7,8 +7,11 @@ T:libgnunet_test_transport_plugin_cmd_simple_send | |||
7 | P:1:1|{connect:{P:1:2:tcp}} | 7 | P:1:1|{connect:{P:1:2:tcp}} |
8 | P:1:2|{connect:{P:1:1:tcp}} | 8 | P:1:2|{connect:{P:1:1:tcp}} |
9 | EOF | 9 | EOF |
10 | ) | 10 | ) |
11 | if [ "$(sysctl -n kernel.unprivileged_userns_clone)" == 1 ]; then | 11 | if ! [ -d "/run/netns" ]; then |
12 | echo You have to create the directory /run/netns. | ||
13 | fi | ||
14 | if [ "$(cat /proc/sys/kernel/core_uses_pid)" == 1 ]; then | ||
12 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config -s '$string'" | 15 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config -s '$string'" |
13 | else | 16 | else |
14 | 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" | 17 | 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" |
diff --git a/src/transport/test_transport_udp_backchannel.sh b/src/transport/test_transport_udp_backchannel.sh index 9c0b11fad..f93aef7ff 100755 --- a/src/transport/test_transport_udp_backchannel.sh +++ b/src/transport/test_transport_udp_backchannel.sh | |||
@@ -1,5 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | if [ "$(sysctl -n kernel.unprivileged_userns_clone)" == 1 ]; then | 2 | if ! [ -d "/run/netns" ]; then |
3 | echo You have to create the directory /run/netns. | ||
4 | fi | ||
5 | if [ "$(cat /proc/sys/kernel/core_uses_pid)" == 1 ]; then | ||
3 | #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 ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" | 6 | #exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes --trace-children=yes --trace-children-skip=/usr/bin/awk,/usr/bin/cut,/usr/bin/seq,/sbin/ip ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" |
4 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" | 7 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" |
5 | # exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" | 8 | # exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; valgrind --leak-check=full --track-origins=yes ./test_transport_start_with_config test_transport_udp_backchannel_topo.conf" |
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index 5d0b902f6..d2e49c0d3 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h | |||
@@ -29,6 +29,10 @@ | |||
29 | #include "gnunet_testing_lib.h" | 29 | #include "gnunet_testing_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | typedef void * | ||
33 | (*GNUNET_TRANSPORT_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is, | ||
34 | const struct GNUNET_PeerIdentity *peer); | ||
35 | |||
32 | /** | 36 | /** |
33 | * Struct to store information needed in callbacks. | 37 | * Struct to store information needed in callbacks. |
34 | * | 38 | * |
@@ -40,7 +44,7 @@ struct ConnectPeersState | |||
40 | */ | 44 | */ |
41 | struct GNUNET_TESTING_AsyncContext ac; | 45 | struct GNUNET_TESTING_AsyncContext ac; |
42 | 46 | ||
43 | GNUNET_TRANSPORT_NotifyConnect notify_connect; | 47 | GNUNET_TRANSPORT_notify_connect_cb notify_connect; |
44 | 48 | ||
45 | /** | 49 | /** |
46 | * The testing system of this node. | 50 | * The testing system of this node. |
@@ -163,7 +167,7 @@ struct StartPeerState | |||
163 | 167 | ||
164 | struct GNUNET_TESTING_System *tl_system; | 168 | struct GNUNET_TESTING_System *tl_system; |
165 | 169 | ||
166 | GNUNET_TRANSPORT_NotifyConnect notify_connect; | 170 | GNUNET_TRANSPORT_notify_connect_cb notify_connect; |
167 | 171 | ||
168 | /** | 172 | /** |
169 | * Flag indicating, if udp broadcast should be switched on. | 173 | * Flag indicating, if udp broadcast should be switched on. |
@@ -213,7 +217,8 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, | |||
213 | char *node_ip, | 217 | char *node_ip, |
214 | struct GNUNET_MQ_MessageHandler *handlers, | 218 | struct GNUNET_MQ_MessageHandler *handlers, |
215 | const char *cfgname, | 219 | const char *cfgname, |
216 | GNUNET_TRANSPORT_NotifyConnect notify_connect, | 220 | GNUNET_TRANSPORT_notify_connect_cb |
221 | notify_connect, | ||
217 | unsigned int broadcast); | 222 | unsigned int broadcast); |
218 | 223 | ||
219 | 224 | ||
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index b50b63c62..3fef7d687 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c | |||
@@ -113,17 +113,20 @@ connect_peers_run (void *cls, | |||
113 | * | 113 | * |
114 | */ | 114 | */ |
115 | static void * | 115 | static void * |
116 | notify_connect (void *cls, | 116 | notify_connect (struct GNUNET_TESTING_Interpreter *is, |
117 | const struct GNUNET_PeerIdentity *peer, | 117 | const struct GNUNET_PeerIdentity *peer) |
118 | struct GNUNET_MQ_Handle *mq) | ||
119 | { | 118 | { |
120 | struct ConnectPeersState *cps = cls; | 119 | const struct GNUNET_TESTING_Command *cmd; |
120 | struct ConnectPeersState *cps; | ||
121 | struct GNUNET_PeerIdentity *peer_connection; | 121 | struct GNUNET_PeerIdentity *peer_connection; |
122 | unsigned int con_num = 0; | 122 | unsigned int con_num = 0; |
123 | struct GNUNET_TESTING_NodeConnection *pos_connection; | 123 | struct GNUNET_TESTING_NodeConnection *pos_connection; |
124 | unsigned int num; | 124 | unsigned int num; |
125 | void *ret = NULL; | 125 | void *ret = NULL; |
126 | 126 | ||
127 | cmd = GNUNET_TESTING_interpreter_lookup_command (is, | ||
128 | "connect-peers"); | ||
129 | cps = cmd->cls; | ||
127 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; | 130 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; |
128 | pos_connection = pos_connection->next) | 131 | pos_connection = pos_connection->next) |
129 | { | 132 | { |
@@ -217,7 +220,7 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | |||
217 | cps->num = num; | 220 | cps->num = num; |
218 | cps->create_label = create_label; | 221 | cps->create_label = create_label; |
219 | cps->topology = topology; | 222 | cps->topology = topology; |
220 | cps->notify_connect = ¬ify_connect; | 223 | cps->notify_connect = notify_connect; |
221 | 224 | ||
222 | { | 225 | { |
223 | struct GNUNET_TESTING_Command cmd = { | 226 | struct GNUNET_TESTING_Command cmd = { |
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c index da833f1b1..52eacabb2 100644 --- a/src/transport/transport_api_cmd_start_peer.c +++ b/src/transport/transport_api_cmd_start_peer.c | |||
@@ -147,9 +147,8 @@ notify_connect (void *cls, | |||
147 | 147 | ||
148 | GNUNET_free (key); | 148 | GNUNET_free (key); |
149 | 149 | ||
150 | sps->notify_connect (cls, | 150 | sps->notify_connect (sps->ac.is, |
151 | peer, | 151 | peer); |
152 | mq); | ||
153 | 152 | ||
154 | // TODO what does the handler function need? | 153 | // TODO what does the handler function need? |
155 | return ret; | 154 | return ret; |
@@ -213,11 +212,11 @@ start_peer_run (void *cls, | |||
213 | GNUNET_asprintf (&bindto_udp, | 212 | GNUNET_asprintf (&bindto_udp, |
214 | "2086"); | 213 | "2086"); |
215 | 214 | ||
216 | LOG (GNUNET_ERROR_TYPE_ERROR, | 215 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
217 | "node_ip %s\n", | 216 | "node_ip %s\n", |
218 | bindto); | 217 | bindto); |
219 | 218 | ||
220 | LOG (GNUNET_ERROR_TYPE_ERROR, | 219 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
221 | "bind_udp %s\n", | 220 | "bind_udp %s\n", |
222 | GNUNET_YES == sps->broadcast ? | 221 | GNUNET_YES == sps->broadcast ? |
223 | bindto_udp : bindto); | 222 | bindto_udp : bindto); |
@@ -247,7 +246,7 @@ start_peer_run (void *cls, | |||
247 | 246 | ||
248 | sps->tl_system = tl_system; | 247 | sps->tl_system = tl_system; |
249 | 248 | ||
250 | LOG (GNUNET_ERROR_TYPE_ERROR, | 249 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
251 | "Creating testing library with key number %u\n", | 250 | "Creating testing library with key number %u\n", |
252 | sps->no); | 251 | sps->no); |
253 | 252 | ||
@@ -255,7 +254,7 @@ start_peer_run (void *cls, | |||
255 | GNUNET_TESTING_configuration_create (tl_system, | 254 | GNUNET_TESTING_configuration_create (tl_system, |
256 | sps->cfg)) | 255 | sps->cfg)) |
257 | { | 256 | { |
258 | LOG (GNUNET_ERROR_TYPE_ERROR, | 257 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
259 | "Testing library failed to create unique configuration based on `%s'\n", | 258 | "Testing library failed to create unique configuration based on `%s'\n", |
260 | sps->cfgname); | 259 | sps->cfgname); |
261 | GNUNET_CONFIGURATION_destroy (sps->cfg); | 260 | GNUNET_CONFIGURATION_destroy (sps->cfg); |
@@ -359,6 +358,7 @@ start_peer_run (void *cls, | |||
359 | GNUNET_free (tcp_communicator_unix_path); | 358 | GNUNET_free (tcp_communicator_unix_path); |
360 | GNUNET_free (udp_communicator_unix_path); | 359 | GNUNET_free (udp_communicator_unix_path); |
361 | GNUNET_free (bindto); | 360 | GNUNET_free (bindto); |
361 | GNUNET_free (bindto_udp); | ||
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
@@ -589,7 +589,8 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, | |||
589 | char *node_ip, | 589 | char *node_ip, |
590 | struct GNUNET_MQ_MessageHandler *handlers, | 590 | struct GNUNET_MQ_MessageHandler *handlers, |
591 | const char *cfgname, | 591 | const char *cfgname, |
592 | GNUNET_TRANSPORT_NotifyConnect notify_connect, | 592 | GNUNET_TRANSPORT_notify_connect_cb |
593 | notify_connect, | ||
593 | unsigned int broadcast) | 594 | unsigned int broadcast) |
594 | { | 595 | { |
595 | struct StartPeerState *sps; | 596 | struct StartPeerState *sps; |