Suppress logging of listen addresses during startup.

The initial call to enumerate_interfaces() happens before the
logging subsystem in initialised and the startup banner logged.
It's not intended that syslog be written at this point.
This commit is contained in:
Simon Kelley
2020-04-29 00:09:58 +01:00
parent 1c1b925052
commit 619000a3c5

View File

@@ -1034,17 +1034,22 @@ void create_bound_listeners(int dienow)
}
else if ((new = create_listeners(&iface->addr, iface->tftp_ok, dienow)))
{
int port;
new->iface = iface;
new->next = daemon->listeners;
daemon->listeners = new;
iface->done = 1;
port = prettyprint_addr(&iface->addr, daemon->addrbuff);
/* Don't log the initial set of listen addresses created
at startup, since this is happening before the logging
system is initialised and the sign-on printed. */
if (!dienow)
{
int port = prettyprint_addr(&iface->addr, daemon->addrbuff);
my_syslog(LOG_DEBUG, _("listening on %s(#%d): %s port %d"),
iface->name, iface->index, daemon->addrbuff, port);
}
}
}
/* Check for --listen-address options that haven't been used because there's
no interface with a matching address. These may be valid: eg it's possible
@@ -1061,13 +1066,15 @@ void create_bound_listeners(int dienow)
if (!if_tmp->used &&
(new = create_listeners(&if_tmp->addr, !!option_bool(OPT_TFTP), dienow)))
{
int port;
new->next = daemon->listeners;
daemon->listeners = new;
port = prettyprint_addr(&if_tmp->addr, daemon->addrbuff);
if (!dienow)
{
int port = prettyprint_addr(&if_tmp->addr, daemon->addrbuff);
my_syslog(LOG_DEBUG, _("listening on %s port %d"), daemon->addrbuff, port);
}
}
}
/* In --bind-interfaces, the only access control is the addresses we're listening on.