1
0
Fork 0
mirror of https://passt.top/passt synced 2025-05-23 01:35:35 +02:00

conf, log: Instead of abusing log levels, add log_conf_parsed flag

We currently use a LOG_EMERG log mask to represent the fact that we
don't know yet what the mask resulting from configuration should be,
before the command line is parsed.

However, we have the necessity of representing another phase as well,
that is, configuration is parsed but we didn't daemonise yet, or
we're not ready for operation yet. The next patch will add that
notion explicitly.

Mapping these cases to further log levels isn't really practical.
Introduce boolean log flags to represent them, instead of abusing
log priorities.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2024-06-14 19:00:27 +02:00
parent bca0fefa32
commit 8c2f24a560
3 changed files with 10 additions and 10 deletions

5
conf.c
View file

@ -1626,9 +1626,6 @@ 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)
@ -1636,6 +1633,8 @@ void conf(struct ctx *c, int argc, char **argv)
else
__setlogmask(LOG_UPTO(LOG_INFO));
log_conf_parsed = true; /* Stop printing everything */
nl_sock_init(c, false);
if (!v6_only)
c->ifi4 = conf_ip4(ifi4, &c->ip4, c->mac);