diff options
author | t3sserakt <t3ss@posteo.de> | 2021-10-11 17:08:46 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-10-11 17:08:46 +0200 |
commit | d190d23831dae1a77075557f2ff6e0c713d747d5 (patch) | |
tree | 6b135d2081f3b1ebdef94f1b11f3ac48aaddeaaa | |
parent | d7fa0579995790840199ec86cb4d518f9d372fcd (diff) | |
download | gnunet-d190d23831dae1a77075557f2ff6e0c713d747d5.tar.gz gnunet-d190d23831dae1a77075557f2ff6e0c713d747d5.zip |
fixed unset port forwarding variable bug in netjail script, fixed end cmd without shutdown bug, smaller fixes
-rwxr-xr-x | src/testing/netjail_start_v2.sh | 4 | ||||
-rw-r--r-- | src/testing/testing_api_loop.c | 33 | ||||
-rwxr-xr-x | src/testing/topo.sh | 8 | ||||
-rw-r--r-- | src/transport/test_transport_plugin_cmd_simple_send_v2.c | 6 | ||||
-rw-r--r-- | src/transport/test_transport_simple_send_v2.c | 8 | ||||
-rw-r--r-- | src/transport/transport_api_cmd_backchannel_check.c | 6 |
6 files changed, 47 insertions, 18 deletions
diff --git a/src/testing/netjail_start_v2.sh b/src/testing/netjail_start_v2.sh index dd1f2ad93..81196d53d 100755 --- a/src/testing/netjail_start_v2.sh +++ b/src/testing/netjail_start_v2.sh | |||
@@ -61,12 +61,12 @@ for N in $(seq $GLOBAL_N); do | |||
61 | 61 | ||
62 | # TODO Topology configuration must be enhanced to configure forwarding to more than one subnet node via different ports. | 62 | # TODO Topology configuration must be enhanced to configure forwarding to more than one subnet node via different ports. |
63 | 63 | ||
64 | if [ "1" == "${R_TCP[$N]}" ] | 64 | if [ -z "${R_TCP[$N]}" -a "1" == "${R_TCP[$N]}" ] |
65 | then | 65 | then |
66 | ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 | 66 | ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 |
67 | ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT | 67 | ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT |
68 | fi | 68 | fi |
69 | if [ "1" == "${R_UDP[$N]}" ] | 69 | if [ -z "${R_UDP[$N]}" -a "1" == "${R_UDP[$N]}" ] |
70 | then | 70 | then |
71 | ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 | 71 | ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 |
72 | ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT | 72 | ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT |
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c index ab095aafa..bb04280a9 100644 --- a/src/testing/testing_api_loop.c +++ b/src/testing/testing_api_loop.c | |||
@@ -453,6 +453,7 @@ interpreter_run (void *cls) | |||
453 | struct FinishTaskClosure *ftc; | 453 | struct FinishTaskClosure *ftc; |
454 | struct GNUNET_TESTING_Interpreter *is = cls; | 454 | struct GNUNET_TESTING_Interpreter *is = cls; |
455 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; | 455 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; |
456 | bool shutdown_on_end = cmd->shutdown_on_end; | ||
456 | 457 | ||
457 | is->task = NULL; | 458 | is->task = NULL; |
458 | 459 | ||
@@ -460,11 +461,16 @@ interpreter_run (void *cls) | |||
460 | { | 461 | { |
461 | 462 | ||
462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 463 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
463 | "Running command END %p\n", | 464 | "Running command END %p %u\n", |
464 | is); | 465 | is, |
466 | shutdown_on_end); | ||
465 | is->result = GNUNET_OK; | 467 | is->result = GNUNET_OK; |
466 | if (GNUNET_YES == cmd->shutdown_on_end) | 468 | if (GNUNET_YES == shutdown_on_end) |
469 | { | ||
470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
471 | "Running command END with shutdown\n"); | ||
467 | GNUNET_SCHEDULER_shutdown (); | 472 | GNUNET_SCHEDULER_shutdown (); |
473 | } | ||
468 | return; | 474 | return; |
469 | } | 475 | } |
470 | else if (NULL != cmd) | 476 | else if (NULL != cmd) |
@@ -596,13 +602,30 @@ GNUNET_TESTING_run (const char *cfg_filename, | |||
596 | } | 602 | } |
597 | /* get the number of commands */ | 603 | /* get the number of commands */ |
598 | for (i = 0; NULL != commands[i].label; i++) | 604 | for (i = 0; NULL != commands[i].label; i++) |
599 | ; | 605 | { |
606 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
607 | "on end %u\n", | ||
608 | commands[i].shutdown_on_end); | ||
609 | } | ||
610 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
611 | "on end %u\n", | ||
612 | commands[i].shutdown_on_end); | ||
613 | // ; | ||
600 | is->commands = GNUNET_new_array (i + 1, | 614 | is->commands = GNUNET_new_array (i + 1, |
601 | struct GNUNET_TESTING_Command); | 615 | struct GNUNET_TESTING_Command); |
602 | memcpy (is->commands, | 616 | memcpy (is->commands, |
603 | commands, | 617 | commands, |
604 | sizeof (struct GNUNET_TESTING_Command) * i); | 618 | sizeof (struct GNUNET_TESTING_Command) * (i + 1)); |
605 | 619 | ||
620 | for (i = 0; NULL != is->commands[i].label; i++) | ||
621 | { | ||
622 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
623 | "on end %u\n", | ||
624 | is->commands[i].shutdown_on_end); | ||
625 | } | ||
626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
627 | "on end %u\n", | ||
628 | is->commands[i].shutdown_on_end); | ||
606 | is->timeout_task = GNUNET_SCHEDULER_add_delayed | 629 | is->timeout_task = GNUNET_SCHEDULER_add_delayed |
607 | (timeout, | 630 | (timeout, |
608 | &do_timeout, | 631 | &do_timeout, |
diff --git a/src/testing/topo.sh b/src/testing/topo.sh index 090c3053f..0046622b6 100755 --- a/src/testing/topo.sh +++ b/src/testing/topo.sh | |||
@@ -20,8 +20,7 @@ extract_attributes() | |||
20 | number=$(echo $line|cut -d \| -f 1| cut -c 2-|cut -d : -f 2 ) | 20 | number=$(echo $line|cut -d \| -f 1| cut -c 2-|cut -d : -f 2 ) |
21 | echo $number | 21 | echo $number |
22 | fi | 22 | fi |
23 | 23 | ||
24 | |||
25 | nf=$(echo $line|awk -F: '{print NF}') | 24 | nf=$(echo $line|awk -F: '{print NF}') |
26 | for ((i=2;i<=$nf;i++)) | 25 | for ((i=2;i<=$nf;i++)) |
27 | do | 26 | do |
@@ -67,6 +66,11 @@ while read line; do | |||
67 | then | 66 | then |
68 | GLOBAL_N=$(cut -d : -f 2 <<< $line) | 67 | GLOBAL_N=$(cut -d : -f 2 <<< $line) |
69 | echo $GLOBAL_N | 68 | echo $GLOBAL_N |
69 | for ((i=1;i<=$GLOBAL_N;i++)) | ||
70 | do | ||
71 | R_TCP[$i]=0 | ||
72 | R_UDP[$i]=0 | ||
73 | done | ||
70 | elif [ "$key" = "X" ] | 74 | elif [ "$key" = "X" ] |
71 | then | 75 | then |
72 | KNOWN=$(cut -d : -f 2 <<< $line) | 76 | KNOWN=$(cut -d : -f 2 <<< $line) |
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_v2.c b/src/transport/test_transport_plugin_cmd_simple_send_v2.c index acfe784d6..c308d9a29 100644 --- a/src/transport/test_transport_plugin_cmd_simple_send_v2.c +++ b/src/transport/test_transport_plugin_cmd_simple_send_v2.c | |||
@@ -85,6 +85,8 @@ static void | |||
85 | handle_test (void *cls, | 85 | handle_test (void *cls, |
86 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) | 86 | const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
87 | { | 87 | { |
88 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
89 | "Message received\n"); | ||
88 | message_received = GNUNET_YES; | 90 | message_received = GNUNET_YES; |
89 | } | 91 | } |
90 | 92 | ||
@@ -203,7 +205,7 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip, | |||
203 | * @return the exported block API | 205 | * @return the exported block API |
204 | */ | 206 | */ |
205 | void * | 207 | void * |
206 | libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls) | 208 | libgnunet_test_transport_plugin_cmd_simple_send_v2_init (void *cls) |
207 | { | 209 | { |
208 | struct GNUNET_TESTING_PluginFunctions *api; | 210 | struct GNUNET_TESTING_PluginFunctions *api; |
209 | 211 | ||
@@ -221,7 +223,7 @@ libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls) | |||
221 | * @return NULL | 223 | * @return NULL |
222 | */ | 224 | */ |
223 | void * | 225 | void * |
224 | libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls) | 226 | libgnunet_test_transport_plugin_cmd_simple_send_v2_done (void *cls) |
225 | { | 227 | { |
226 | struct GNUNET_TESTING_PluginFunctions *api = cls; | 228 | struct GNUNET_TESTING_PluginFunctions *api = cls; |
227 | 229 | ||
diff --git a/src/transport/test_transport_simple_send_v2.c b/src/transport/test_transport_simple_send_v2.c index aeac1bfb6..feb65468a 100644 --- a/src/transport/test_transport_simple_send_v2.c +++ b/src/transport/test_transport_simple_send_v2.c | |||
@@ -47,6 +47,12 @@ static unsigned int rv = 0; | |||
47 | static void | 47 | static void |
48 | run (void *cls) | 48 | run (void *cls) |
49 | { | 49 | { |
50 | struct GNUNET_TESTING_Command cmd = GNUNET_TESTING_cmd_end (); | ||
51 | |||
52 | if (GNUNET_YES == cmd.shutdown_on_end) | ||
53 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
54 | "gaga %p\n", | ||
55 | cmd); | ||
50 | struct GNUNET_TESTING_Command commands[] = { | 56 | struct GNUNET_TESTING_Command commands[] = { |
51 | GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start", | 57 | GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start", |
52 | TOPOLOGY_CONFIG), | 58 | TOPOLOGY_CONFIG), |
@@ -58,7 +64,7 @@ run (void *cls) | |||
58 | TOPOLOGY_CONFIG), | 64 | TOPOLOGY_CONFIG), |
59 | GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop", | 65 | GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop", |
60 | TOPOLOGY_CONFIG), | 66 | TOPOLOGY_CONFIG), |
61 | GNUNET_TESTING_cmd_end () | 67 | cmd |
62 | }; | 68 | }; |
63 | 69 | ||
64 | GNUNET_TESTING_run (NULL, | 70 | GNUNET_TESTING_run (NULL, |
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c index da44e91ca..5cc13dbfa 100644 --- a/src/transport/transport_api_cmd_backchannel_check.c +++ b/src/transport/transport_api_cmd_backchannel_check.c | |||
@@ -195,12 +195,6 @@ read_from_log (void *cls) | |||
195 | strcmp ( | 195 | strcmp ( |
196 | "Delivering backchannel message from 4TTC to F7B5 of type 1460 to udp", | 196 | "Delivering backchannel message from 4TTC to F7B5 of type 1460 to udp", |
197 | cs->search_string[i])); | 197 | cs->search_string[i])); |
198 | if (NULL != strstr (line, | ||
199 | cs->search_string[i])) | ||
200 | { | ||
201 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
202 | "gaga\n"); | ||
203 | } | ||
204 | cs->finished = GNUNET_YES; | 198 | cs->finished = GNUNET_YES; |
205 | fclose (cs->stream); | 199 | fclose (cs->stream); |
206 | return; | 200 | return; |