From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id AF4B75A0278 for ; Fri, 23 Feb 2024 09:12:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1708675925; bh=KtikUq2EBAs6U5tNWP8GnnLa+FViWIhECiCQvhmxstA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CMAzf/Mh3fVQU/ShaHAeNHRL1oQNkP8D4v8QoQdqGRLMx0zb8bOWLpDtQsG9Xd8wD NOnixST6Cnpuh8tK1qROKcNt5zTXMA3g+j+TvFiCnnRlz03TrOTkWIXwKVj4OHmHPU q7bC4llxPffBv0bK0E2x9sTe572rjH3JXoAPagWUgK0+/ss85N/zxDRbRqN2yrBO28 nI9gcvNBcsm65W9ptNy5yz6qENzeGXTItv2xDezzfyQq3DcNtNSijZAwQihv/Nd+zg nqBYLtvdmD+DuYTVji/72sGL+Iv7lv5uOJ7f/S8zdilnvQTpqvYDvZmNRsgJHP/Kp5 Gyt/5t4yYn62w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Th2mP4b2Qz4wnr; Fri, 23 Feb 2024 19:12:05 +1100 (AEDT) Date: Fri, 23 Feb 2024 19:10:55 +1100 From: David Gibson To: Paul Holzinger Subject: Re: [PATCH 2/2] conf: set the log level much earlier Message-ID: References: <20240222171739.141623-2-pholzing@redhat.com> <20240222171739.141623-4-pholzing@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qhNGjt80xxQF1yke" Content-Disposition: inline In-Reply-To: <20240222171739.141623-4-pholzing@redhat.com> Message-ID-Hash: ZAYQSG43PI3Z5OIWUPVKD5VNS5DQRCB4 X-Message-ID-Hash: ZAYQSG43PI3Z5OIWUPVKD5VNS5DQRCB4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --qhNGjt80xxQF1yke Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > To address this move the log level logic directly after the option > parsing in conf(). >=20 > Signed-off-by: Paul Holzinger Reviewed-by: David Gibson > --- > conf.c | 10 ++++++++++ > passt.c | 10 ---------- > 2 files changed, 10 insertions(+), 10 deletions(-) >=20 > 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); > } > =20 > + /* 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 =3D 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"); > =20 > - /* 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 --=20 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 --qhNGjt80xxQF1yke Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXYUwIACgkQzQJF27ox 2Gd1tA//ZO8I2wxAGbHuDCUvSjJe5BuFsBGWE60OuEASMVl/qXohHmVLtLRkmOhb WmfnILPEFU+LZ+N4PCc7datXAjam9TVZAzpqZMISuaCwtwNGMjyvPRwx9X6AvTr+ yI07pGcvU8HO8SSBvTrIJ45ygm5x11Z12btZIqTs1JAaEOrykbIDFxf/UAFpUj8I ZbHY3aVqokk4PC1TxD+p79iSOkHlJDOF6OamJ9QELO5qfpyVMAt9uGgS6Ro4lL6c yhM9MWFz87t9AtUC5DmeEYbnmQhdvJ46WqUyVqOkhzLyjJMU7DKpMtjsGIjWZPo6 hDPUrgNrsscxP3vB3lkdYoXtAFULSy8lEcKi0f1aXoErmz++u2d5vEOvMl7DCNaN e31opPaOMHpIkdTL+STForjXMpyE9a4wff4B/EwXKqHgRV2LTuGqSb6JTv6/MrbY Wzc9Z2Xag4lP010rEyMqrx5KQfbjcKrMPc2wg3Ug4CB8RfbJdOoiHo2Dxkdu44G3 ayD806OalTyWrY06KjTfTjoot5iTaba8s2IevidJa3+y6P55RcqPd3DT0dHJXOAf VqEK0OBxIkJ9xsznebYY8A71aA03j8K4VkkTSuMf+a6q8mcg5wm09ol9s2hQICx2 bOGo57WjMko90Xt8nUezz1yv3BQ45SZHCxQiO5ZCDNjjnBQ9MMo= =0hzO -----END PGP SIGNATURE----- --qhNGjt80xxQF1yke--