diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-17 16:02:32 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-17 16:02:32 +0000 |
commit | c408abb9b9069c9eee62f1ca78ee3a815b491f14 (patch) | |
tree | 64610e0f1e625ef51319ef85cd703a7ae658bf69 /src/testing | |
parent | 69f4cbdda8969ba3325f831d93b6e21660f1a276 (diff) | |
download | gnunet-c408abb9b9069c9eee62f1ca78ee3a815b491f14.tar.gz gnunet-c408abb9b9069c9eee62f1ca78ee3a815b491f14.zip |
- rename controller_ip to trusted_ip
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index 2f4a75a18..cac81b28b 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -75,9 +75,10 @@ struct GNUNET_TESTING_System | |||
75 | char *tmppath; | 75 | char *tmppath; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * The hostname of the controller | 78 | * The trusted ip. Can either be a single ip address or a network address in |
79 | * CIDR notation. | ||
79 | */ | 80 | */ |
80 | char *controller; | 81 | char *trusted_ip; |
81 | 82 | ||
82 | /** | 83 | /** |
83 | * our hostname | 84 | * our hostname |
@@ -271,9 +272,10 @@ hostkeys_unload (struct GNUNET_TESTING_System *system) | |||
271 | * @param testdir only the directory name without any path. This is used for | 272 | * @param testdir only the directory name without any path. This is used for |
272 | * all service homes; the directory will be created in a temporary | 273 | * all service homes; the directory will be created in a temporary |
273 | * location depending on the underlying OS | 274 | * location depending on the underlying OS |
274 | * @param controller hostname of the controlling host, | 275 | * @param trusted_ip the ip address which will be set as TRUSTED HOST in all |
275 | * service configurations are modified to allow | 276 | * service configurations generated to allow control connections from |
276 | * control connections from this host; can be NULL | 277 | * this ip. This can either be a single ip address or a network address |
278 | * in CIDR notation. | ||
277 | * @param hostname the hostname of the system we are using for testing; NULL for | 279 | * @param hostname the hostname of the system we are using for testing; NULL for |
278 | * localhost | 280 | * localhost |
279 | * @param lowport lowest port number this system is allowed to allocate (inclusive) | 281 | * @param lowport lowest port number this system is allowed to allocate (inclusive) |
@@ -282,7 +284,7 @@ hostkeys_unload (struct GNUNET_TESTING_System *system) | |||
282 | */ | 284 | */ |
283 | struct GNUNET_TESTING_System * | 285 | struct GNUNET_TESTING_System * |
284 | GNUNET_TESTING_system_create_with_portrange (const char *testdir, | 286 | GNUNET_TESTING_system_create_with_portrange (const char *testdir, |
285 | const char *controller, | 287 | const char *trusted_ip, |
286 | const char *hostname, | 288 | const char *hostname, |
287 | uint16_t lowport, | 289 | uint16_t lowport, |
288 | uint16_t highport) | 290 | uint16_t highport) |
@@ -299,8 +301,8 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir, | |||
299 | GNUNET_free (system); | 301 | GNUNET_free (system); |
300 | return NULL; | 302 | return NULL; |
301 | } | 303 | } |
302 | if (NULL != controller) | 304 | if (NULL != trusted_ip) |
303 | system->controller = GNUNET_strdup (controller); | 305 | system->trusted_ip = GNUNET_strdup (trusted_ip); |
304 | if (NULL != hostname) | 306 | if (NULL != hostname) |
305 | system->hostname = GNUNET_strdup (hostname); | 307 | system->hostname = GNUNET_strdup (hostname); |
306 | if (GNUNET_OK != hostkeys_load (system)) | 308 | if (GNUNET_OK != hostkeys_load (system)) |
@@ -320,19 +322,21 @@ GNUNET_TESTING_system_create_with_portrange (const char *testdir, | |||
320 | * @param testdir only the directory name without any path. This is used for all | 322 | * @param testdir only the directory name without any path. This is used for all |
321 | * service homes; the directory will be created in a temporary location | 323 | * service homes; the directory will be created in a temporary location |
322 | * depending on the underlying OS | 324 | * depending on the underlying OS |
323 | * @param controller hostname of the controlling host, service configurations | 325 | * @param trusted_ip the ip address which will be set as TRUSTED HOST in all |
324 | * are modified to allow control connections from this host; can be NULL | 326 | * service configurations generated to allow control connections from |
327 | * this ip. This can either be a single ip address or a network address | ||
328 | * in CIDR notation. | ||
325 | * @param hostname the hostname of the system we are using for testing; NULL for | 329 | * @param hostname the hostname of the system we are using for testing; NULL for |
326 | * localhost | 330 | * localhost |
327 | * @return handle to this system, NULL on error | 331 | * @return handle to this system, NULL on error |
328 | */ | 332 | */ |
329 | struct GNUNET_TESTING_System * | 333 | struct GNUNET_TESTING_System * |
330 | GNUNET_TESTING_system_create (const char *testdir, | 334 | GNUNET_TESTING_system_create (const char *testdir, |
331 | const char *controller, | 335 | const char *trusted_ip, |
332 | const char *hostname) | 336 | const char *hostname) |
333 | { | 337 | { |
334 | return GNUNET_TESTING_system_create_with_portrange (testdir, | 338 | return GNUNET_TESTING_system_create_with_portrange (testdir, |
335 | controller, | 339 | trusted_ip, |
336 | hostname, | 340 | hostname, |
337 | LOW_PORT, | 341 | LOW_PORT, |
338 | HIGH_PORT); | 342 | HIGH_PORT); |
@@ -355,7 +359,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, | |||
355 | if (GNUNET_YES == remove_paths) | 359 | if (GNUNET_YES == remove_paths) |
356 | GNUNET_DISK_directory_remove (system->tmppath); | 360 | GNUNET_DISK_directory_remove (system->tmppath); |
357 | GNUNET_free (system->tmppath); | 361 | GNUNET_free (system->tmppath); |
358 | GNUNET_free_non_null (system->controller); | 362 | GNUNET_free_non_null (system->trusted_ip); |
359 | GNUNET_free_non_null (system->hostname); | 363 | GNUNET_free_non_null (system->hostname); |
360 | GNUNET_free (system); | 364 | GNUNET_free (system); |
361 | } | 365 | } |
@@ -677,8 +681,8 @@ update_config (void *cls, const char *section, const char *option, | |||
677 | 681 | ||
678 | 682 | ||
679 | /** | 683 | /** |
680 | * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 depending on the ip of the | 684 | * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 to include the address of |
681 | * controller in all sections | 685 | * 'trusted_hosts' in all sections |
682 | * | 686 | * |
683 | * @param cls the UpdateContext | 687 | * @param cls the UpdateContext |
684 | * @param section name of the section | 688 | * @param section name of the section |
@@ -756,8 +760,8 @@ update_config_sections (void *cls, | |||
756 | } | 760 | } |
757 | GNUNET_free_non_null (val); | 761 | GNUNET_free_non_null (val); |
758 | ACCEPT_FROM_key = "ACCEPT_FROM"; | 762 | ACCEPT_FROM_key = "ACCEPT_FROM"; |
759 | if ((NULL != uc->system->controller) && | 763 | if ((NULL != uc->system->trusted_ip) && |
760 | (NULL != strstr (uc->system->controller, ":"))) /* IPv6 in use */ | 764 | (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */ |
761 | ACCEPT_FROM_key = "ACCEPT_FROM6"; | 765 | ACCEPT_FROM_key = "ACCEPT_FROM6"; |
762 | if (GNUNET_OK != | 766 | if (GNUNET_OK != |
763 | GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key, | 767 | GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, ACCEPT_FROM_key, |
@@ -765,11 +769,11 @@ update_config_sections (void *cls, | |||
765 | { | 769 | { |
766 | orig_allowed_hosts = GNUNET_strdup ("127.0.0.1;"); | 770 | orig_allowed_hosts = GNUNET_strdup ("127.0.0.1;"); |
767 | } | 771 | } |
768 | if (NULL == uc->system->controller) | 772 | if (NULL == uc->system->trusted_ip) |
769 | allowed_hosts = GNUNET_strdup (orig_allowed_hosts); | 773 | allowed_hosts = GNUNET_strdup (orig_allowed_hosts); |
770 | else | 774 | else |
771 | GNUNET_asprintf (&allowed_hosts, "%s%s;", orig_allowed_hosts, | 775 | GNUNET_asprintf (&allowed_hosts, "%s%s;", orig_allowed_hosts, |
772 | uc->system->controller); | 776 | uc->system->trusted_ip); |
773 | GNUNET_free (orig_allowed_hosts); | 777 | GNUNET_free (orig_allowed_hosts); |
774 | GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key, | 778 | GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, ACCEPT_FROM_key, |
775 | allowed_hosts); | 779 | allowed_hosts); |
@@ -813,7 +817,7 @@ GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, | |||
813 | uc.service_home); | 817 | uc.service_home); |
814 | /* make PORTs and UNIXPATHs unique */ | 818 | /* make PORTs and UNIXPATHs unique */ |
815 | GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc); | 819 | GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc); |
816 | /* allow connections to services from system controller host */ | 820 | /* allow connections to services from system trusted_ip host */ |
817 | GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc); | 821 | GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc); |
818 | /* enable loopback-based connections between peers */ | 822 | /* enable loopback-based connections between peers */ |
819 | GNUNET_CONFIGURATION_set_value_string (cfg, | 823 | GNUNET_CONFIGURATION_set_value_string (cfg, |