From a891ecfd9a6d9ed04f173cb790d1a18c4fd08d21 Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Tue, 30 Mar 2010 14:55:27 +0000 Subject: [PATCH] write control_host information to testing configs (for remote starting), hasn't been sufficiently tested --- src/testing/testing.c | 18 ++++++++++++++++-- src/testing/testing_group.c | 17 +++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/testing/testing.c b/src/testing/testing.c index a1bbb4f70..6c670e8d4 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -40,7 +40,7 @@ #include "gnunet_testing_lib.h" #include "gnunet_transport_service.h" -#define DEBUG_TESTING GNUNET_NO +#define DEBUG_TESTING GNUNET_YES /** * How long do we wait after starting gnunet-service-arm @@ -168,6 +168,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) /* start GNUnet on remote host */ if (NULL == d->hostname) { +#if DEBUG_TESTING + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting `%s', with command `%s %s %s %s %s %s'.\n", + "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, + "-L", "DEBUG", + "-s"); +#endif d->pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, @@ -182,6 +189,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_asprintf (&dst, "%s@%s", d->username, d->hostname); else dst = GNUNET_strdup (d->hostname); + +#if DEBUG_TESTING + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n", + "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile, + "-L", "DEBUG", "-s"); +#endif d->pid = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", dst, @@ -534,7 +548,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, #if DEBUG_TESTING "-L", "DEBUG", #endif - "-c", d->cfgfile, "-e", "-d", NULL); + "-c", d->cfgfile, "-e", NULL); /* Use -e to end arm, and -d to remove temp files */ GNUNET_free (arg); diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 96d2831d7..7281109f9 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -27,7 +27,7 @@ #include "gnunet_arm_service.h" #include "gnunet_testing_lib.h" -#define VERBOSE_TESTING GNUNET_NO +#define VERBOSE_TESTING GNUNET_YES /** * Lowest port used for GNUnet testing. Should be high enough to not @@ -44,7 +44,7 @@ */ #define HIGH_PORT 32000 -#define MAX_OUTSTANDING_CONNECTIONS 30 +#define MAX_OUTSTANDING_CONNECTIONS 50 #define CONNECT_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 180) @@ -225,10 +225,13 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port) { struct UpdateContext uc; uint16_t orig; + char *control_host; + char *allowed_hosts; orig = *port; uc.nport = *port; uc.ret = GNUNET_CONFIGURATION_create (); + GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc); if (uc.nport >= HIGH_PORT) { @@ -236,6 +239,15 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port) GNUNET_CONFIGURATION_destroy (uc.ret); return NULL; } + + if (GNUNET_CONFIGURATION_get_value_string(cfg, "testing", "control_host", &control_host) == GNUNET_OK) + { + GNUNET_asprintf(&allowed_hosts, "%s; 127.0.0.1;", control_host); + fprintf(stderr, "FOUND CONTROL_HOST OPTION %s, setting to %s\n", control_host, allowed_hosts); + GNUNET_CONFIGURATION_set_value_string(uc.ret, "core", "ACCEPT_FROM", allowed_hosts); + GNUNET_free(allowed_hosts); + } + *port = (uint16_t) uc.nport; return uc.ret; } @@ -1173,6 +1185,7 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, GNUNET_break (0); return NULL; } + pg = GNUNET_malloc (sizeof (struct GNUNET_TESTING_PeerGroup)); pg->sched = sched; pg->cfg = cfg; -- 2.25.1