Commit e37c8984 authored by Per Cederqvist's avatar Per Cederqvist

Tell svn to ignore core files.

* src/server/testsuite: Ignore core and vgcore.*.

Replaced the "Client host" and "Client port" configuration file
parameters with "Listen", and allow lyskomd to listen to more than
one port.
* doc/lyskomd.texi (Parameters): Replaced "Client host" and
"Client port" with "Listen".
* src/server/ramkomd.c (start_listen_sockets): New static
function.  Listen to all the ports specified by the "Listen:"
parameter.
(server_init): Use start_listen_sockets() instead of calling
isc_listentcp().  Removed the host and client_port arguments.  All
callers updated.
* src/server/testsuite/lyskomd.0/54.exp: New test suite.
* src/server/conf-file.c (ctor_ipport_list): New static function.
(dtor_ipport_list): New static function.
(assign_ipport_list): New static function.
(cf_ipport_list): New constant.
* src/server/conf-file.h (struct ipport_entry): New struct.
(struct ipport_list): New struct.
(cf_ipport_list): New constant.
* src/server/param.h (struct kom_par): Replaced "ip_client_host"
and "ip_client_port" with "listen".
* src/server/server-config.c (parameters): Ditto.
* src/server/prot-a-parse-arg-c.awk: Include "conf-file.h" from
the generated files.
* src/server/admin.c: Include "conf-file.h".
* src/server/aux-items.c: Ditto.
* src/server/checkkomspace.c: Ditto.
* src/server/conference.c: Ditto.
* src/server/connections.c: Ditto.
* src/server/dbck-cache.c: Ditto.
* src/server/dbck.c: Ditto.
* src/server/disk-end-of-atomic.c: Ditto.
* src/server/komrunning.c: Ditto.
* src/server/lockdb.c: Ditto.
* src/server/membership.c: Ditto.
* src/server/person.c: Ditto.
* src/server/prot-a-output.c: Ditto.
* src/server/prot-a-parse.c: Ditto.
* src/server/prot-a.c: Ditto.
* src/server/regex-match.c: Ditto.
* src/server/rfc931.c: Ditto.
* src/server/send-async.c: Ditto.
* src/server/session.c: Ditto.
* src/server/simple-cache.c: Ditto.
* src/server/splitkomdb.c: Ditto.
* src/server/text-garb.c: Ditto.
* src/server/text.c: Ditto.
* src/server/updateLysKOM.c: Ditto.
* run-support/config: Removed the "Client port" setting.

Adjust the test suite for the above change.
* src/server/testsuite/lyskomd.0/bug-64.exp: Expect memory leaks
due to bug 1599.
* src/server/testsuite/lyskomd.0/53.exp: Expect a more informative
error message when isc_listentcp fails.
* src/server/testsuite/lyskomd.0/11.exp: Expect an IP address in
the "Listening for clients" log message.
* src/server/testsuite/config/unix.exp (clientport_2): New
constant.
(clientport_3): New constant.
(lyskomd_start): New argument: listen_messages.  Use "Listen:"
instead of "Client port:".
(lyskomd_fail_start): Use "Listen:" instead of "Client port:".
(client_start): New optional argument: port.
parent 4c6723a9
2006-04-24 Per Cederqvist <ceder@lysator.liu.se>
Tell svn to ignore core files.
* src/server/testsuite: Ignore core and vgcore.*.
Replaced the "Client host" and "Client port" configuration file
parameters with "Listen", and allow lyskomd to listen to more than
one port.
* doc/lyskomd.texi (Parameters): Replaced "Client host" and
"Client port" with "Listen".
* src/server/ramkomd.c (start_listen_sockets): New static
function. Listen to all the ports specified by the "Listen:"
parameter.
(server_init): Use start_listen_sockets() instead of calling
isc_listentcp(). Removed the host and client_port arguments. All
callers updated.
* src/server/testsuite/lyskomd.0/54.exp: New test suite.
* src/server/conf-file.c (ctor_ipport_list): New static function.
(dtor_ipport_list): New static function.
(assign_ipport_list): New static function.
(cf_ipport_list): New constant.
* src/server/conf-file.h (struct ipport_entry): New struct.
(struct ipport_list): New struct.
(cf_ipport_list): New constant.
* src/server/param.h (struct kom_par): Replaced "ip_client_host"
and "ip_client_port" with "listen".
* src/server/server-config.c (parameters): Ditto.
* src/server/prot-a-parse-arg-c.awk: Include "conf-file.h" from
the generated files.
* src/server/admin.c: Include "conf-file.h".
* src/server/aux-items.c: Ditto.
* src/server/checkkomspace.c: Ditto.
* src/server/conference.c: Ditto.
* src/server/connections.c: Ditto.
* src/server/dbck-cache.c: Ditto.
* src/server/dbck.c: Ditto.
* src/server/disk-end-of-atomic.c: Ditto.
* src/server/komrunning.c: Ditto.
* src/server/lockdb.c: Ditto.
* src/server/membership.c: Ditto.
* src/server/person.c: Ditto.
* src/server/prot-a-output.c: Ditto.
* src/server/prot-a-parse.c: Ditto.
* src/server/prot-a.c: Ditto.
* src/server/regex-match.c: Ditto.
* src/server/rfc931.c: Ditto.
* src/server/send-async.c: Ditto.
* src/server/session.c: Ditto.
* src/server/simple-cache.c: Ditto.
* src/server/splitkomdb.c: Ditto.
* src/server/text-garb.c: Ditto.
* src/server/text.c: Ditto.
* src/server/updateLysKOM.c: Ditto.
* run-support/config: Removed the "Client port" setting.
Adjust the test suite for the above change.
* src/server/testsuite/lyskomd.0/bug-64.exp: Expect memory leaks
due to bug 1599.
* src/server/testsuite/lyskomd.0/53.exp: Expect a more informative
error message when isc_listentcp fails.
* src/server/testsuite/lyskomd.0/11.exp: Expect an IP address in
the "Listening for clients" log message.
* src/server/testsuite/config/unix.exp (clientport_2): New
constant.
(clientport_3): New constant.
(lyskomd_start): New argument: listen_messages. Use "Listen:"
instead of "Client port:".
(lyskomd_fail_start): Use "Listen:" instead of "Client port:".
(client_start): New optional argument: port.
2006-02-09 Per Cederqvist <ceder@lysator.liu.se>
Added valgrind suppressions for optimised code.
......
......@@ -282,17 +282,24 @@ Do not send any non-requested messages. This disables the sending of
messages about events in the server to all connections. Use of this
parameter is not recommended. Default is on.
@item Client host: @var{hostname}
Specify which IP number the server should use when listening for new
clients. @var{hostname} may be a FQDN (such as
@samp{kom.lysator.liu.se}) or an IP number (such as @samp{10.0.0.1}).
Default is to bind @code{INADDR_ANY}, which means that the server will
listen to all IP numbers of the computer it is running on.
@item Client port: @var{portname}
Listen for new clients on port @var{portname}. The default is 4894, which
is what all clients expect. Do not change this parameter without really
good reason.
@item Listen: @var{portname}
@itemx Listen: @var{hostname}:@var{portname}
Specify which IP number and port the server should use when listening
for new clients. @var{hostname} may be a FQDN (such as
@samp{kom.lysator.liu.se}), an IPv4 address (such as @samp{10.0.0.1}),
or an IPv6 address enclosed in brackets (such as
@samp{[2001:db8::a00:20ff:fea7:ccea]}. If a FQDN resolves to several
IP addresses, it is undefined if the server will listen to all of them
or just pick one of them, so avoid that situation. If the
@var{portname} is the empty string, the default value of @code{4894}
will be used.
The default is @code{4894} (listen to port 4894 on all interfaces).
These parameters can be specified several times to cause the server to
listen to many ports and/or interfaces. The default is removed if
this parameter is specified at least once.
@item Presentation of conferences: @var{int}
The number of the conference where presentations should be sent.
......
......@@ -5,7 +5,6 @@
# the lyskom.info file.
# Mandatory options:
Client port: 4894
Max conferences: 4765
Max texts: 2000000
......
2006-04-24 Per Cederqvist <ceder@lysator.liu.se>
* src/isc_tcp.c (isc_listentcp): Make a single attempt to bind the
port. Don't retry if we get EADDRINUSE. The old code could leak
memory.
* src/isc_master.c (isc_initialize): Don't set openretries.
* src/intern.h (ISC_DEFAULT_MAX_OPEN_RETRIES): Removed.
(struct isc_session_cfg): Removed openretries.
(FOR_EACH_AF): Made the documentation slightly more readable.
2006-02-09 Per Cederqvist <ceder@lysator.liu.se>
Fixed a memory leak.
......
......@@ -33,7 +33,6 @@
#define ISC_DEFAULT_MAX_MSG_SIZE 8176
#define ISC_DEFAULT_MAX_QUEUED_SIZE 50
#define ISC_DEFAULT_MAX_DEQUEUE_LEN 30
#define ISC_DEFAULT_MAX_OPEN_RETRIES 10
#define ISC_DEFAULT_MAX_BACKLOG 50
/*
......@@ -138,7 +137,6 @@ struct isc_session_cfg
int queuedsize; /* Number of messages. */
int queuedsize_bytes; /* Total number of bytes. */
int dequeuelen; /* Number of messages to write at once. */
int openretries;
int backlog;
} max;
int fd_relocate;
......@@ -303,16 +301,19 @@ typedef unsigned long uint32_t;
* evaluates to second arg if first arg (of type
* enum sockaddrs) contains an AF_INET address or
* IPv6 is not used, otherwise to third arg.
* FOR_EACH_AF: Takes 2 args; first is an int lvalue, second
* an int expression. For each available address
* family (from most preferred to last preferred),
* the second arg is evaluated with the address
* family assigned to the first arg, until it
* evaluates to false (in which case the entire
* macro expansion evaluates to false), or until
* there are no more address families, in which
* case the entire macro expansion evaluates to
* true.
* FOR_EACH_AF: Takes 2 args; an int lvalue that will be bound to
* an address family, and a an expression
* returning int. The expression should return
* zero on success. The int lvalue will be bound
* to each available address family in turn (from
* most preferred to least preferred) and the
* expression evaluated, until the expression
* indicates success by returning 0.
*
* The entire macro expansion evaluates to 0 if
* an expression succeded, or a true value if no
* expression succeeded.
*
* FOR_EACH_PF: As FOR_EACH_AF, but for protocol families
* instead of address families.
* STORE_ADDR: First arg (enum sockaddrs) is checked for
......
......@@ -82,7 +82,6 @@ isc_initialize(oop_source *event_source,
mcb->scfg->max.msgsize = ISC_DEFAULT_MAX_MSG_SIZE;
mcb->scfg->max.queuedsize = ISC_DEFAULT_MAX_QUEUED_SIZE;
mcb->scfg->max.dequeuelen = ISC_DEFAULT_MAX_DEQUEUE_LEN;
mcb->scfg->max.openretries = ISC_DEFAULT_MAX_OPEN_RETRIES;
mcb->scfg->max.backlog = ISC_DEFAULT_MAX_BACKLOG;
mcb->scfg->fd_relocate = 0;
mcb->scfg->stale_timeout = timeval_ctor(3600, 0);
......
......@@ -381,7 +381,6 @@ isc_listentcp(struct isc_mcb *mcb,
isc_accept_callback *cb)
{
struct isc_scb_internal *scb;
int retries;
int errcode;
......@@ -389,14 +388,8 @@ isc_listentcp(struct isc_mcb *mcb,
if (!scb)
return NULL;
for (retries = 0; retries < scb->cfg->max.openretries; sleep(1), retries++)
{
errno = 0;
if (isc_bindtcp(scb, address, service) >= 0 || errno != EADDRINUSE)
break;
}
if (retries >= scb->cfg->max.openretries || errno != 0)
errno = 0;
if (isc_bindtcp(scb, address, service) < 0)
{
errcode = errno;
isc_destroy(NULL, &scb->pub);
......
......@@ -52,6 +52,7 @@
#include "kom-config.h"
#include "log.h"
#include "send-async.h"
#include "conf-file.h"
#include "param.h"
#include "string-malloc.h"
#include "services.h"
......
......@@ -57,6 +57,7 @@
#include "log.h"
#include "services.h"
#include "admin.h"
#include "conf-file.h"
#include "param.h"
#include "server-time.h"
#include "string-malloc.h"
......
......@@ -49,6 +49,7 @@
#include "kom-config.h"
#include "misc-types.h"
#include "kom-types.h"
#include "conf-file.h"
#include "param.h"
#include "version-info.h"
#include "log.h"
......
......@@ -525,6 +525,99 @@ assign_timeval(const char *val,
}
static void
ctor_ipport_list(const struct parameter *par)
{
struct ipport_list *val = par->value;
val->size = 0;
val->entries = NULL;
}
static void
dtor_ipport_list(const struct parameter *par)
{
int i;
struct ipport_list *val = par->value;
for (i = 0; i < val->size; i++)
{
sfree(val->entries[i].ipaddr);
sfree(val->entries[i].port);
}
sfree(val->entries);
val->entries = NULL;
val->size = 0;
}
static Success
assign_ipport_list(const char *val,
const struct parameter *par)
{
struct ipport_list *list = par->value;
struct ipport_entry *entry;
const char *host_start = NULL;
const char *host_end = NULL;
const char *port_start = val;
if (val[0] == '[')
{
/* IPv6 address. */
#ifndef USE_INET6
kom_log("IPv6 address found in \"Listen:\" directive, but"
"IPv6 support not enabled in this build.\n");
return FAILURE;
#else
host_start = val + 1;
host_end = strchr(val, ']');
if (host_end == NULL)
{
kom_log("Unterminated IPv6 address: %s\n", val);
return FAILURE;
}
if (*(host_end+1) != ':')
{
kom_log("IPv6 address not followed by colon and port: %s\n", val);
return FAILURE;
}
port_start = host_end + 2;
#endif
}
else if ((host_end = strchr(val, ':')) != NULL)
{
/* IPv4 address or DNS name. */
host_start = val;
port_start = host_end + 1;
}
list->entries = srealloc(list->entries,
(list->size + 1) * sizeof(*list->entries));
entry = &list->entries[list->size];
list->size++;
if (host_start == NULL)
entry->ipaddr = NULL;
else
{
entry->ipaddr = smalloc(host_end - host_start + 1);
memcpy(entry->ipaddr, host_start, host_end - host_start);
entry->ipaddr[host_end - host_start] = '\0';
}
if (*port_start == '\0')
{
entry->port = smalloc(strlen(par->default_suffix) + 1);
strcpy(entry->port, par->default_suffix);
}
else
{
entry->port = smalloc(strlen(port_start) + 1);
strcpy(entry->port, port_start);
}
return OK;
}
const struct datatype cf_text_no = {
assign_text_no, NULL, NULL,
};
......@@ -560,3 +653,7 @@ const struct datatype cf_double = {
const struct datatype cf_timeval = {
assign_timeval, NULL, NULL,
};
const struct datatype cf_ipport_list = {
assign_ipport_list, ctor_ipport_list, dtor_ipport_list,
};
......@@ -70,4 +70,18 @@ extern const struct datatype cf_bool;
extern const struct datatype cf_double;
extern const struct datatype cf_timeval;
struct ipport_entry
{
char *ipaddr;
char *port;
};
struct ipport_list
{
int size;
struct ipport_entry *entries;
};
extern const struct datatype cf_ipport_list;
#endif
......@@ -59,6 +59,7 @@
#include "lyskomd.h"
#include "debug.h"
#include "send-async.h"
#include "conf-file.h"
#include "param.h"
#include "aux-items.h"
#include "local-to-global.h"
......
......@@ -76,6 +76,7 @@
#include "send-async.h"
#include "cache.h"
#include "rfc931.h"
#include "conf-file.h"
#include "param.h"
#include "kom-config.h"
#include "kom-errno.h"
......
......@@ -71,6 +71,7 @@
#include "kom-memory.h"
#include "ram-parse.h"
#include "ram-output.h"
#include "conf-file.h"
#include "param.h"
#include "dbck-cache.h"
#include "local-to-global.h"
......
......@@ -67,6 +67,7 @@
#include "kom-config.h"
#include "debug.h"
#include "dbck-cache.h"
#include "conf-file.h"
#include "param.h"
#include "server-config.h"
#include "async.h"
......
......@@ -54,6 +54,7 @@
#include "cache.h"
#include "server/smalloc.h"
#include "kom-config.h"
#include "conf-file.h"
#include "param.h"
#include "timeval-util.h"
......
......@@ -44,6 +44,7 @@
#include "server/smalloc.h"
#include "kom-config.h"
#include "server-config.h"
#include "conf-file.h"
#include "param.h"
#include "pidfile.h"
#include "linkansi.h"
......
......@@ -48,6 +48,7 @@
#include "lockdb.h"
#include "log.h"
#include "kom-types.h"
#include "conf-file.h"
#include "param.h"
#include "lyskomd.h"
......
......@@ -63,6 +63,7 @@
#include "send-async.h"
#include "minmax.h"
#include "kom-memory.h"
#include "conf-file.h"
#include "param.h"
#include "local-to-global.h"
#include "server-time.h"
......
......@@ -38,8 +38,7 @@ struct kom_par
Bool garb_enable;
Bool never_save;
char *logaccess_file;
char *ip_client_host; /* IP to listen to (default: INADDR_ANY) */
char *ip_client_port; /* Port to listen to for clients */
struct ipport_list listen;
Bool use_dns;
double dns_log_threshold;
Conf_no conf_pres_conf;
......
......@@ -69,6 +69,7 @@
#include "log.h"
#include "minmax.h"
#include "lyskomd.h"
#include "conf-file.h"
#include "param.h"
#include "aux-items.h"
#include "local-to-global.h"
......
......@@ -53,6 +53,7 @@
#include "connections.h"
#include "prot-a-output.h"
#include "lyskomd.h"
#include "conf-file.h"
#include "param.h"
#include "local-to-global.h"
......
......@@ -49,6 +49,7 @@ BEGIN {
printf("#include \"prot-a-parse.h\"\n");
printf("#include \"prot-a-parse-arg.h\"\n");
printf("#include \"kom-config.h\"\n");
printf("#include \"conf-file.h\"\n\n");
printf("#include \"param.h\"\n\n");
}
$1 == "#ifdef" {
......
......@@ -59,6 +59,7 @@
#include "isc-interface.h"
#include "log.h"
#include "minmax.h"
#include "conf-file.h"
#include "param.h"
#include "kom-memory.h"
......
......@@ -58,6 +58,7 @@
#include "prot-a-output.h"
#include "prot-a-parse.h"
#include "isc-parse.h"
#include "conf-file.h"
#include "param.h"
#include "kom-memory.h"
......
......@@ -68,6 +68,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <assert.h>
#include "oop.h"
......@@ -137,6 +138,9 @@ static oop_call_signal sighandler_quit;
static oop_call_signal sighandler_usr1;
static oop_call_signal sighandler_usr2;
static oop_call_signal sighandler_winch;
/* handle_accept_event is declared in connections.h. We redeclare it
once more here, just to make sure that its signature matches the
isc_accept_callback typedef. */
isc_accept_callback handle_accept_event;
......@@ -167,9 +171,34 @@ write_queue_change_callback(int delta)
static void
server_init(const char *host, const char * client_port)
start_listen_sockets(void)
{
struct isc_scb *listen_client;
int i;
for (i = 0; i < param.listen.size; ++i)
{
struct ipport_entry *port = &param.listen.entries[i];
listen_client = isc_listentcp(kom_server_mcb,
port->ipaddr,
port->port,
handle_accept_event);
if (listen_client == NULL)
restart_kom("server_init: can't isc_listentcp(%s, %s)\n",
port->ipaddr ? port->ipaddr : "*", port->port);
assert(listen_client->laddr != NULL);
kom_log("Listening for clients on %s:%d.\n",
isc_getipnum(listen_client->laddr, NULL, 0),
isc_getportnum(listen_client->laddr));
}
}
static void
server_init(void)
{
oop_source *src;
#ifdef HAVE_STRUCT_SIGACTION
struct sigaction act;
......@@ -243,14 +272,8 @@ server_init(const char *host, const char * client_port)
param.maxqueuedsize,
param.maxdequeuelen);
listen_client = isc_listentcp(kom_server_mcb, host, client_port,
handle_accept_event);
if (listen_client == NULL)
restart_kom("server_init: can't isc_listentcp(CLIENT)\n");
kom_log("Listening for clients on %d.\n",
isc_getportnum(listen_client->laddr));
start_listen_sockets();
/*
* Ignore SIGPIPE, which the server gets if it tries to write to a
* socket and the client has died. The server will anyhow handle
......@@ -266,6 +289,7 @@ server_init(const char *host, const char * client_port)
#endif
}
static void
init_data_base(void)
{
......@@ -554,7 +578,7 @@ initialize(const char *config_file)
exit(1);
}
server_init(param.ip_client_host, param.ip_client_port);
server_init();
init_data_base();
}
......
......@@ -57,6 +57,7 @@
#include "manipulate.h"
#include "log.h"
#include "kom-config.h"
#include "conf-file.h"
#include "param.h"
static Success
......
......@@ -52,6 +52,7 @@
#include "isc-interface.h"
#include "misc-types.h"
#include "kom-types.h"
#include "conf-file.h"
#include "param.h"
#include "rfc931.h"
#include "unused.h"
......
......@@ -50,6 +50,7 @@
#include "prot-a-send-async.h"
#include "lyskomd.h"
#include "log.h"
#include "conf-file.h"
#include "param.h"
#include "ldifftime.h"
#include "kom-errno.h"
......
......@@ -56,8 +56,8 @@
#include "misc-types.h"
#include "s-string.h"
#include "kom-types.h"
#include "param.h"
#include "conf-file.h"
#include "param.h"
#include "admin.h"
#include "log.h"
#include "lyskomd.h"
......@@ -113,12 +113,9 @@ static const struct parameter parameters[] = {
&cf_bool, 0, 1, "1",
&param.send_async_messages,