h->server_stdout = NULL;
h->server_stdout_handle = NULL;
/* now try to restart it */
- h->server_retry_delay =
- GNUNET_TIME_relative_multiply (h->server_retry_delay, 2);
- h->server_retry_delay =
- GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_HOURS,
- h->server_retry_delay);
+ h->server_retry_delay = GNUNET_TIME_STD_BACKOFF (h->server_retry_delay);
h->server_read_task =
GNUNET_SCHEDULER_add_delayed (h->server_retry_delay,
&restart_nat_server, h);
static void
start_gnunet_nat_server (struct GNUNET_NAT_Handle *h)
{
+ char *binary;
+
if ((h->behind_nat == GNUNET_YES) && (h->enable_nat_server == GNUNET_YES) &&
(h->internal_address != NULL) &&
(NULL !=
LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting `%s' at `%s'\n",
"gnunet-helper-nat-server", h->internal_address);
/* Start the server process */
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server");
h->server_proc =
GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout,
- "gnunet-helper-nat-server",
+ binary,
"gnunet-helper-nat-server",
h->internal_address, NULL);
+ GNUNET_free (binary);
if (h->server_proc == NULL)
{
LOG (GNUNET_ERROR_TYPE_WARNING, "nat", _("Failed to start %s\n"),
struct GNUNET_NAT_Handle *h;
struct in_addr in_addr;
unsigned int i;
+ char *binary;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Registered with NAT service at port %u with %u IP bound local addresses\n",
}
/* Test for SUID binaries */
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-server");
if ((h->behind_nat == GNUNET_YES) && (GNUNET_YES == h->enable_nat_server) &&
(GNUNET_YES !=
- GNUNET_OS_check_helper_binary ("gnunet-helper-nat-server")))
+ GNUNET_OS_check_helper_binary (binary)))
{
h->enable_nat_server = GNUNET_NO;
LOG (GNUNET_ERROR_TYPE_WARNING,
("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"),
"gnunet-helper-nat-server");
}
+ GNUNET_free (binary);
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client");
if ((GNUNET_YES == h->enable_nat_client) &&
(GNUNET_YES !=
- GNUNET_OS_check_helper_binary ("gnunet-helper-nat-client")))
+ GNUNET_OS_check_helper_binary (binary)))
{
h->enable_nat_client = GNUNET_NO;
LOG (GNUNET_ERROR_TYPE_WARNING,
("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"),
"gnunet-helper-nat-client");
}
-
+ GNUNET_free (binary);
start_gnunet_nat_server (h);
/* FIXME: add support for UPnP, etc */
char inet4[INET_ADDRSTRLEN];
char port_as_string[6];
struct GNUNET_OS_Process *proc;
+ char *binary;
if (GNUNET_YES != h->enable_nat_client)
return GNUNET_NO; /* not permitted / possible */
LOG (GNUNET_ERROR_TYPE_DEBUG,
_("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address,
inet4, (unsigned int) h->adv_port);
+ binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-nat-client");
proc =
GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL,
- "gnunet-helper-nat-client",
+ binary,
"gnunet-helper-nat-client", h->internal_address,
inet4, port_as_string, NULL);
+ GNUNET_free (binary);
if (NULL == proc)
return GNUNET_SYSERR;
/* we know that the gnunet-helper-nat-client will terminate virtually