* notation. The netmask must be given in CIDR notation (/16) or
* can be omitted to specify a single host.
* <p>
- * @param routeList a string specifying the forbidden networks
+ * @param routeListX a string specifying the forbidden networks
* @return the converted list, NULL if the synatx is flawed
*/
static struct IPv6NetworkSet *
* Check if the given IP address is in the list of IP addresses.
*
* @param list a list of networks
- * @param ip the IP to check (in network byte order)
+ * @param add the IP to check (in network byte order)
* @return GNUNET_NO if the IP is not in the list, GNUNET_YES if it it is
*/
static int
struct addrinfo *pos;
int ret;
int tolerant;
+ struct GNUNET_NETWORK_Handle *desc;
if (GNUNET_CONFIGURATION_have_value (sctx->cfg,
sctx->serviceName, "TIMEOUT"))
if (!disablev6)
{
- struct GNUNET_NETWORK_Handle *desc;
-
/* probe IPv6 support */
desc = GNUNET_NETWORK_socket_socket (PF_INET6, SOCK_STREAM, 0);
if (NULL == desc)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket");
return GNUNET_SYSERR;
}
- desc = GNUNET_NETWORK_socket_socket (PF_INET, SOCK_STREAM, 0);
- if (NULL == desc)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _
- ("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"),
- sctx->serviceName, STRERROR (errno));
- disablev6 = GNUNET_YES;
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Disabling IPv6 support for service `%s', failed to create IPv6 socket: %s\n"),
+ sctx->serviceName,
+ STRERROR (errno));
+ disablev6 = GNUNET_YES;
}
- if (NULL != desc)
- GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
+ else
+ {
+ GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (desc));
+ }
}
if (disablev6)
{
/* V4-only */
- sctx->addrlen = sizeof (struct sockaddr_in6);
+ sctx->addrlen = sizeof (struct sockaddr_in);
sctx->addr = GNUNET_malloc (sctx->addrlen);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ ((struct sockaddr_in *) sctx->addr)->sin_len = sctx->addrlen;
+#endif
((struct sockaddr_in *) sctx->addr)->sin_family = AF_INET;
((struct sockaddr_in *) sctx->addr)->sin_port = htons (port);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
/* dual stack */
sctx->addrlen = sizeof (struct sockaddr_in6);
sctx->addr = GNUNET_malloc (sctx->addrlen);
+#if HAVE_SOCKADDR_IN_SIN_LEN
+ ((struct sockaddr_in6 *) sctx->addr)->sin6_len = sctx->addrlen;
+#endif
((struct sockaddr_in6 *) sctx->addr)->sin6_family = AF_INET6;
((struct sockaddr_in6 *) sctx->addr)->sin6_port = htons (port);
}
sctx->timeout, sctx->require_found);
if (sctx->server == NULL)
{
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Failed to start `%s' at `%s'\n"),
+ sctx->serviceName,
+ GNUNET_a2s (sctx->addr,
+ sctx->addrlen));
sctx->ret = GNUNET_SYSERR;
return;
}
sctx->ready_confirm_fd = -1;
write_pid_file (sctx, getpid ());
}
-
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ _("Service `%s' runs at %s\n"),
+ sctx->serviceName,
+ GNUNET_a2s (sctx->addr,
+ sctx->addrlen));
sctx->task (sctx->task_cls, tc->sched, sctx->server, sctx->cfg);
}
static int
detach_terminal (struct GNUNET_SERVICE_Context *sctx)
{
+#ifndef MINGW
pid_t pid;
int nullfd;
int filedes[2];
-#ifndef MINGW
if (0 != PIPE (filedes))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pipe");
/**
* Stop a service that was started with "GNUNET_SERVICE_start".
*
- * @param ctx the service context returned from the start function
+ * @param sctx the service context returned from the start function
*/
void
GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Context *sctx)