*/
static cf_mode_item_t cf_mode_list[] =
{
+ /*
{"Server", NULL, MODE_CLIENT },
{"Port", NULL, MODE_CLIENT | MODE_SERVER },
+ */
{"PIDFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
{"DataDir", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL},
{"LogFile", NULL, MODE_CLIENT | MODE_SERVER | MODE_LOCAL}
};
-static int cf_mode_num = 5;
+static int cf_mode_num = 3;
static int nesting_depth = 0;
static char *current_module = NULL;
ret = 0;
- if (network_create_socket (NET_DEFAULT_V4_ADDR, NET_DEFAULT_PORT) > 0)
+ if (network_create_socket (NET_DEFAULT_V6_ADDR, NET_DEFAULT_PORT) > 0)
ret++;
- if (network_create_socket (NET_DEFAULT_V6_ADDR, NET_DEFAULT_PORT) > 0)
+ /* Don't use IPv4 and IPv6 in parallel by default.. */
+ if ((operating_mode == MODE_CLIENT) && (ret != 0))
+ return (ret);
+
+ if (network_create_socket (NET_DEFAULT_V4_ADDR, NET_DEFAULT_PORT) > 0)
ret++;
if (ret == 0)
if (socklist_head == NULL)
network_connect_default ();
- while (1)
+ FD_ZERO (&readfds);
+ max_fd = -1;
+ for (se = socklist_head; se != NULL; se = se->next)
{
- FD_ZERO (&readfds);
- max_fd = -1;
- for (se = socklist_head; se != NULL; se = se->next)
- {
- if (se->mode != operating_mode)
- continue;
+ if (se->mode != operating_mode)
+ continue;
- FD_SET (se->fd, &readfds);
- if (se->fd >= max_fd)
- max_fd = se->fd + 1;
- }
+ FD_SET (se->fd, &readfds);
+ if (se->fd >= max_fd)
+ max_fd = se->fd + 1;
+ }
- if (max_fd == -1)
- {
- syslog (LOG_WARNING, "No listen sockets found!");
- return (-1);
- }
+ if (max_fd == -1)
+ {
+ syslog (LOG_WARNING, "No listen sockets found!");
+ return (-1);
+ }
- status = select (max_fd, &readfds, NULL, NULL, NULL);
+ status = select (max_fd, &readfds, NULL, NULL, NULL);
- if ((status == -1) && (errno == EINTR))
- continue;
- else if (status == -1)
- {
+ if (status == -1)
+ {
+ if (errno != EINTR)
syslog (LOG_ERR, "select: %s", strerror (errno));
- return (-1);
- }
- else
- break;
- } /* while (true) */
+ return (-1);
+ }
fd = -1;
for (se = socklist_head; se != NULL; se = se->next)
else
{
syslog (LOG_ERR, "sendto: %s", strerror (errno));
+ ret = -1;
break;
}
}