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 /src/testing | |
parent | d7fa0579995790840199ec86cb4d518f9d372fcd (diff) |
fixed unset port forwarding variable bug in netjail script, fixed end cmd without shutdown bug, smaller fixes
Diffstat (limited to 'src/testing')
-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 |
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 # TODO Topology configuration must be enhanced to configure forwarding to more than one subnet node via different ports. - if [ "1" == "${R_TCP[$N]}" ] + if [ -z "${R_TCP[$N]}" -a "1" == "${R_TCP[$N]}" ] then ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT fi - if [ "1" == "${R_UDP[$N]}" ] + if [ -z "${R_UDP[$N]}" -a "1" == "${R_UDP[$N]}" ] then ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1 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) struct FinishTaskClosure *ftc; struct GNUNET_TESTING_Interpreter *is = cls; struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; + bool shutdown_on_end = cmd->shutdown_on_end; is->task = NULL; @@ -460,11 +461,16 @@ interpreter_run (void *cls) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Running command END %p\n", - is); + "Running command END %p %u\n", + is, + shutdown_on_end); is->result = GNUNET_OK; - if (GNUNET_YES == cmd->shutdown_on_end) + if (GNUNET_YES == shutdown_on_end) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Running command END with shutdown\n"); GNUNET_SCHEDULER_shutdown (); + } return; } else if (NULL != cmd) @@ -596,13 +602,30 @@ GNUNET_TESTING_run (const char *cfg_filename, } /* get the number of commands */ for (i = 0; NULL != commands[i].label; i++) - ; + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "on end %u\n", + commands[i].shutdown_on_end); + } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "on end %u\n", + commands[i].shutdown_on_end); + // ; is->commands = GNUNET_new_array (i + 1, struct GNUNET_TESTING_Command); memcpy (is->commands, commands, - sizeof (struct GNUNET_TESTING_Command) * i); + sizeof (struct GNUNET_TESTING_Command) * (i + 1)); + for (i = 0; NULL != is->commands[i].label; i++) + { + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "on end %u\n", + is->commands[i].shutdown_on_end); + } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "on end %u\n", + is->commands[i].shutdown_on_end); is->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout, &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() number=$(echo $line|cut -d \| -f 1| cut -c 2-|cut -d : -f 2 ) echo $number fi - - + nf=$(echo $line|awk -F: '{print NF}') for ((i=2;i<=$nf;i++)) do @@ -67,6 +66,11 @@ while read line; do then GLOBAL_N=$(cut -d : -f 2 <<< $line) echo $GLOBAL_N + for ((i=1;i<=$GLOBAL_N;i++)) + do + R_TCP[$i]=0 + R_UDP[$i]=0 + done elif [ "$key" = "X" ] then KNOWN=$(cut -d : -f 2 <<< $line) |