From 15001b39ef1d41c0535ef0d2384e074c6f85cefd Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 22 Feb 2024 18:17:41 +0100 Subject: conf: set the log level much earlier --quiet is supposed to silence the "No routable interface" message but it does not work because the log level was set long after conf_ip4/6() was called which means it uses the default level which logs everything. To address this move the log level logic directly after the option parsing in conf(). Signed-off-by: Paul Holzinger Reviewed-by: David Gibson Signed-off-by: Stefano Brivio --- conf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 9c99531..17cf279 100644 --- a/conf.c +++ b/conf.c @@ -1646,6 +1646,16 @@ void conf(struct ctx *c, int argc, char **argv) logfile, logsize); } + /* Once the log mask is not LOG_EARLY, we will no longer log to stderr + * if there was a log file specified. + */ + if (c->debug) + __setlogmask(LOG_UPTO(LOG_DEBUG)); + else if (c->quiet) + __setlogmask(LOG_UPTO(LOG_WARNING)); + else + __setlogmask(LOG_UPTO(LOG_INFO)); + nl_sock_init(c, false); if (!v6_only) c->ifi4 = conf_ip4(ifi4, &c->ip4, c->mac); -- cgit v1.2.3