aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-10-11 17:08:46 +0200
committert3sserakt <t3ss@posteo.de>2021-10-11 17:08:46 +0200
commitd190d23831dae1a77075557f2ff6e0c713d747d5 (patch)
tree6b135d2081f3b1ebdef94f1b11f3ac48aaddeaaa /src/testing
parentd7fa0579995790840199ec86cb4d518f9d372fcd (diff)
downloadgnunet-d190d23831dae1a77075557f2ff6e0c713d747d5.tar.gz
gnunet-d190d23831dae1a77075557f2ff6e0c713d747d5.zip
fixed unset port forwarding variable bug in netjail script, fixed end cmd without shutdown bug, smaller fixes
Diffstat (limited to 'src/testing')
-rwxr-xr-xsrc/testing/netjail_start_v2.sh4
-rw-r--r--src/testing/testing_api_loop.c33
-rwxr-xr-xsrc/testing/topo.sh8
3 files changed, 36 insertions, 9 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)