From a4eea61eb191e8151ec0e2be01e4ec41b88ad062 Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Fri, 17 May 2013 07:56:37 +0000 Subject: [PATCH] - fallback to using ip addresses for hosts --- src/testbed/testbed_api_hosts.c | 23 +++++++++++++++++++++++ src/testbed/testbed_api_hosts.h | 9 +++++++++ src/testbed/testbed_api_testbed.c | 3 +++ 3 files changed, 35 insertions(+) diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 99625cba0..4b9d12f80 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -1887,4 +1887,27 @@ GNUNET_TESTBED_host_handle_addhostconfirm_ (struct GNUNET_TESTBED_Controller *c, return GNUNET_OK; } + +/** + * Resolves the hostname of the host to an ip address + * + * @param host the host whose hostname is to be resolved + */ +void +GNUNET_TESTBED_host_resolve_ (struct GNUNET_TESTBED_Host *host) +{ + char *hostname; + + hostname = (char *) host->hostname; + host->hostname = simple_resolve (hostname); + if (NULL == host->hostname) + { + GNUNET_break (0); + host->hostname = hostname; + return; + } + GNUNET_free (hostname); + host->hostname = GNUNET_strdup (hostname); +} + /* end of testbed_api_hosts.c */ diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h index 3cef4412a..6c305c340 100644 --- a/src/testbed/testbed_api_hosts.h +++ b/src/testbed/testbed_api_hosts.h @@ -253,5 +253,14 @@ GNUNET_TESTBED_controller_destroy_ (struct GNUNET_TESTBED_ControllerProc *cproc); +/** + * Resolves the hostname of the host to an ip address + * + * @param host the host whose hostname is to be resolved + */ +void +GNUNET_TESTBED_host_resolve_ (struct GNUNET_TESTBED_Host *host); + + #endif /* end of testbed_api_hosts.h */ diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index ccef18a4b..7f7627858 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -1349,6 +1349,9 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, #if ENABLE_LL parse_islands (rc); #endif + GNUNET_TESTBED_host_resolve_ (rc->h); + for (nhost = 0; nhost < rc->num_hosts; nhost++) + GNUNET_TESTBED_host_resolve_ (rc->hosts[nhost]); GNUNET_OS_network_interfaces_list (netint_proc, rc); if (NULL == rc->trusted_ip) rc->trusted_ip = GNUNET_strdup ("127.0.0.1"); -- 2.25.1