summaryrefslogtreecommitdiff
path: root/src
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
parentd7fa0579995790840199ec86cb4d518f9d372fcd (diff)
fixed unset port forwarding variable bug in netjail script, fixed end cmd without shutdown bug, smaller fixes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/testing/netjail_start_v2.sh4
-rw-r--r--src/testing/testing_api_loop.c33
-rwxr-xr-xsrc/testing/topo.sh8
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_v2.c6
-rw-r--r--src/transport/test_transport_simple_send_v2.c8
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c6
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
# 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)
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
handle_test (void *cls,
const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Message received\n");
message_received = GNUNET_YES;
}
@@ -203,7 +205,7 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
* @return the exported block API
*/
void *
-libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls)
+libgnunet_test_transport_plugin_cmd_simple_send_v2_init (void *cls)
{
struct GNUNET_TESTING_PluginFunctions *api;
@@ -221,7 +223,7 @@ libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls)
* @return NULL
*/
void *
-libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls)
+libgnunet_test_transport_plugin_cmd_simple_send_v2_done (void *cls)
{
struct GNUNET_TESTING_PluginFunctions *api = cls;
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;
static void
run (void *cls)
{
+ struct GNUNET_TESTING_Command cmd = GNUNET_TESTING_cmd_end ();
+
+ if (GNUNET_YES == cmd.shutdown_on_end)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "gaga %p\n",
+ cmd);
struct GNUNET_TESTING_Command commands[] = {
GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start",
TOPOLOGY_CONFIG),
@@ -58,7 +64,7 @@ run (void *cls)
TOPOLOGY_CONFIG),
GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop",
TOPOLOGY_CONFIG),
- GNUNET_TESTING_cmd_end ()
+ cmd
};
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)
strcmp (
"Delivering backchannel message from 4TTC to F7B5 of type 1460 to udp",
cs->search_string[i]));
- if (NULL != strstr (line,
- cs->search_string[i]))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "gaga\n");
- }
cs->finished = GNUNET_YES;
fclose (cs->stream);
return;