public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Paul Holzinger <pholzing@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 2/2] conf: set the log level much earlier
Date: Fri, 23 Feb 2024 19:10:55 +1100	[thread overview]
Message-ID: <ZdhTDwmQgwA3dS_a@zatzit> (raw)
In-Reply-To: <20240222171739.141623-4-pholzing@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2066 bytes --]

On Thu, Feb 22, 2024 at 06:17:41PM +0100, Paul Holzinger wrote:
> --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 <pholzing@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  conf.c  | 10 ++++++++++
>  passt.c | 10 ----------
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> 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);
> diff --git a/passt.c b/passt.c
> index 5d7e7c4..a061f2b 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -320,16 +320,6 @@ int main(int argc, char **argv)
>  	if (isolate_prefork(&c))
>  		die("Failed to sandbox process, exiting");
>  
> -	/* 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));
> -
>  	if (!c.foreground)
>  		__daemon(pidfile_fd, devnull_fd);
>  	else

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-02-23  8:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 17:17 [PATCH 1/2] passt: make --quiet set the log level to warning Paul Holzinger
2024-02-22 17:17 ` [PATCH 2/2] conf: set the log level much earlier Paul Holzinger
2024-02-23  8:10   ` David Gibson [this message]
2024-02-27 14:27   ` Stefano Brivio
2024-02-23  8:12 ` [PATCH 1/2] passt: make --quiet set the log level to warning David Gibson
2024-02-27 14:27   ` Stefano Brivio
2024-02-27 14:27 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZdhTDwmQgwA3dS_a@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=pholzing@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).