fix automatic guessing of `listen on'

default_host needs to be NULL for getaddrinfo(3) to listen on
everything.
This commit is contained in:
Omar Polo 2023-08-25 12:19:00 +00:00
parent 3cb7e8d7ac
commit c2c051f28e
1 changed files with 5 additions and 4 deletions

View File

@ -38,7 +38,7 @@
struct conf *conf;
static const char *default_host = "*";
static const char *default_host = NULL;
static uint16_t default_port = 1965;
TAILQ_HEAD(files, file) files = TAILQ_HEAD_INITIALIZER(files);
@ -229,7 +229,7 @@ option : CHROOT string {
yywarn("option `ipv6' is deprecated,"
" please use `listen on'");
if ($2)
default_host = "*";
default_host = NULL;
else
default_host = "0.0.0.0";
}
@ -354,7 +354,8 @@ vhost : SERVER string {
fatal("snprintf");
yywarn("missing `listen on' in server %s,"
" assuming %s port %d", $2, default_host,
" assuming %s port %d", $2,
default_host ? default_host : "*",
default_port);
listen_on(default_host, portno);
}
@ -1072,7 +1073,7 @@ parse_conf(struct conf *c, const char *filename)
{
struct sym *sym, *next;
default_host = "*";
default_host = NULL;
default_port = 1965;
conf = c;