* [PATCH bpf] net/bpfilter: specify the log level for the kmsg message @ 2021-06-23 4:09 Gary Lin 2021-06-23 4:38 ` Alexei Starovoitov 0 siblings, 1 reply; 6+ messages in thread From: Gary Lin @ 2021-06-23 4:09 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann; +Cc: bpf, netdev, Martin Loviska Per the kmsg document(*), if we don't specify the log level with a prefix "<N>" in the message string, the default log level will be applied to the message. Since the default level could be warning(4), this would make the log utility such as journalctl treat the message, "Started bpfilter", as a warning. To avoid confusion, this commit adds the prefix "<5>" to make the message always a notice. (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") Reported-by: Martin Loviska <mloviska@suse.com> Signed-off-by: Gary Lin <glin@suse.com> --- net/bpfilter/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c index 05e1cfc1e5cd..291a92546246 100644 --- a/net/bpfilter/main.c +++ b/net/bpfilter/main.c @@ -57,7 +57,7 @@ int main(void) { debug_f = fopen("/dev/kmsg", "w"); setvbuf(debug_f, 0, _IOLBF, 0); - fprintf(debug_f, "Started bpfilter\n"); + fprintf(debug_f, "<5>Started bpfilter\n"); loop(); fclose(debug_f); return 0; -- 2.31.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] net/bpfilter: specify the log level for the kmsg message 2021-06-23 4:09 [PATCH bpf] net/bpfilter: specify the log level for the kmsg message Gary Lin @ 2021-06-23 4:38 ` Alexei Starovoitov 2021-06-23 6:57 ` Dmitrii Banshchikov 0 siblings, 1 reply; 6+ messages in thread From: Alexei Starovoitov @ 2021-06-23 4:38 UTC (permalink / raw) To: Gary Lin, Dmitrii Banshchikov Cc: Alexei Starovoitov, Daniel Borkmann, bpf, Network Development, Martin Loviska On Tue, Jun 22, 2021 at 9:09 PM Gary Lin <glin@suse.com> wrote: > > Per the kmsg document(*), if we don't specify the log level with a > prefix "<N>" in the message string, the default log level will be > applied to the message. Since the default level could be warning(4), > this would make the log utility such as journalctl treat the message, > "Started bpfilter", as a warning. To avoid confusion, this commit adds > the prefix "<5>" to make the message always a notice. > > (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg > > Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") > Reported-by: Martin Loviska <mloviska@suse.com> > Signed-off-by: Gary Lin <glin@suse.com> > --- > net/bpfilter/main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c > index 05e1cfc1e5cd..291a92546246 100644 > --- a/net/bpfilter/main.c > +++ b/net/bpfilter/main.c > @@ -57,7 +57,7 @@ int main(void) > { > debug_f = fopen("/dev/kmsg", "w"); > setvbuf(debug_f, 0, _IOLBF, 0); > - fprintf(debug_f, "Started bpfilter\n"); > + fprintf(debug_f, "<5>Started bpfilter\n"); > loop(); > fclose(debug_f); > return 0; Adding Dmitrii who is redesigning the whole bpfilter. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] net/bpfilter: specify the log level for the kmsg message 2021-06-23 4:38 ` Alexei Starovoitov @ 2021-06-23 6:57 ` Dmitrii Banshchikov 2021-06-25 3:47 ` Alexei Starovoitov 0 siblings, 1 reply; 6+ messages in thread From: Dmitrii Banshchikov @ 2021-06-23 6:57 UTC (permalink / raw) To: Alexei Starovoitov Cc: Gary Lin, Alexei Starovoitov, Daniel Borkmann, bpf, Network Development, Martin Loviska On Tue, Jun 22, 2021 at 09:38:38PM -0700, Alexei Starovoitov wrote: > On Tue, Jun 22, 2021 at 9:09 PM Gary Lin <glin@suse.com> wrote: > > > > Per the kmsg document(*), if we don't specify the log level with a > > prefix "<N>" in the message string, the default log level will be > > applied to the message. Since the default level could be warning(4), > > this would make the log utility such as journalctl treat the message, > > "Started bpfilter", as a warning. To avoid confusion, this commit adds > > the prefix "<5>" to make the message always a notice. > > > > (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg > > > > Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") > > Reported-by: Martin Loviska <mloviska@suse.com> > > Signed-off-by: Gary Lin <glin@suse.com> > > --- > > net/bpfilter/main.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c > > index 05e1cfc1e5cd..291a92546246 100644 > > --- a/net/bpfilter/main.c > > +++ b/net/bpfilter/main.c > > @@ -57,7 +57,7 @@ int main(void) > > { > > debug_f = fopen("/dev/kmsg", "w"); > > setvbuf(debug_f, 0, _IOLBF, 0); > > - fprintf(debug_f, "Started bpfilter\n"); > > + fprintf(debug_f, "<5>Started bpfilter\n"); > > loop(); > > fclose(debug_f); > > return 0; > > Adding Dmitrii who is redesigning the whole bpfilter. Thanks. The same logic already exists in the bpfilter v1 patchset - [1]. 1. https://lore.kernel.org/bpf/c72bac57-84a0-ac4c-8bd8-08758715118e@fb.com/T/#mb36e20c4e5e4a70746bd50a109b1630687990214 -- Dmitrii Banshchikov ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] net/bpfilter: specify the log level for the kmsg message 2021-06-23 6:57 ` Dmitrii Banshchikov @ 2021-06-25 3:47 ` Alexei Starovoitov 2021-06-25 7:36 ` Dmitrii Banshchikov 0 siblings, 1 reply; 6+ messages in thread From: Alexei Starovoitov @ 2021-06-25 3:47 UTC (permalink / raw) To: Dmitrii Banshchikov Cc: Gary Lin, Alexei Starovoitov, Daniel Borkmann, bpf, Network Development, Martin Loviska On Tue, Jun 22, 2021 at 11:57 PM Dmitrii Banshchikov <me@ubique.spb.ru> wrote: > > On Tue, Jun 22, 2021 at 09:38:38PM -0700, Alexei Starovoitov wrote: > > On Tue, Jun 22, 2021 at 9:09 PM Gary Lin <glin@suse.com> wrote: > > > > > > Per the kmsg document(*), if we don't specify the log level with a > > > prefix "<N>" in the message string, the default log level will be > > > applied to the message. Since the default level could be warning(4), > > > this would make the log utility such as journalctl treat the message, > > > "Started bpfilter", as a warning. To avoid confusion, this commit adds > > > the prefix "<5>" to make the message always a notice. > > > > > > (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg > > > > > > Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") > > > Reported-by: Martin Loviska <mloviska@suse.com> > > > Signed-off-by: Gary Lin <glin@suse.com> > > > --- > > > net/bpfilter/main.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c > > > index 05e1cfc1e5cd..291a92546246 100644 > > > --- a/net/bpfilter/main.c > > > +++ b/net/bpfilter/main.c > > > @@ -57,7 +57,7 @@ int main(void) > > > { > > > debug_f = fopen("/dev/kmsg", "w"); > > > setvbuf(debug_f, 0, _IOLBF, 0); > > > - fprintf(debug_f, "Started bpfilter\n"); > > > + fprintf(debug_f, "<5>Started bpfilter\n"); > > > loop(); > > > fclose(debug_f); > > > return 0; > > > > Adding Dmitrii who is redesigning the whole bpfilter. > > Thanks. The same logic already exists in the bpfilter v1 patchset > - [1]. > > 1. https://lore.kernel.org/bpf/c72bac57-84a0-ac4c-8bd8-08758715118e@fb.com/T/#mb36e20c4e5e4a70746bd50a109b1630687990214 Dmitrii, what do you prefer we should do with this patch then? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] net/bpfilter: specify the log level for the kmsg message 2021-06-25 3:47 ` Alexei Starovoitov @ 2021-06-25 7:36 ` Dmitrii Banshchikov 2021-06-25 11:16 ` Daniel Borkmann 0 siblings, 1 reply; 6+ messages in thread From: Dmitrii Banshchikov @ 2021-06-25 7:36 UTC (permalink / raw) To: Alexei Starovoitov Cc: Gary Lin, Alexei Starovoitov, Daniel Borkmann, bpf, Network Development, Martin Loviska On Thu, Jun 24, 2021 at 08:47:06PM -0700, Alexei Starovoitov wrote: > On Tue, Jun 22, 2021 at 11:57 PM Dmitrii Banshchikov <me@ubique.spb.ru> wrote: > > > > On Tue, Jun 22, 2021 at 09:38:38PM -0700, Alexei Starovoitov wrote: > > > On Tue, Jun 22, 2021 at 9:09 PM Gary Lin <glin@suse.com> wrote: > > > > > > > > Per the kmsg document(*), if we don't specify the log level with a > > > > prefix "<N>" in the message string, the default log level will be > > > > applied to the message. Since the default level could be warning(4), > > > > this would make the log utility such as journalctl treat the message, > > > > "Started bpfilter", as a warning. To avoid confusion, this commit adds > > > > the prefix "<5>" to make the message always a notice. > > > > > > > > (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg > > > > > > > > Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") > > > > Reported-by: Martin Loviska <mloviska@suse.com> > > > > Signed-off-by: Gary Lin <glin@suse.com> > > > > --- > > > > net/bpfilter/main.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c > > > > index 05e1cfc1e5cd..291a92546246 100644 > > > > --- a/net/bpfilter/main.c > > > > +++ b/net/bpfilter/main.c > > > > @@ -57,7 +57,7 @@ int main(void) > > > > { > > > > debug_f = fopen("/dev/kmsg", "w"); > > > > setvbuf(debug_f, 0, _IOLBF, 0); > > > > - fprintf(debug_f, "Started bpfilter\n"); > > > > + fprintf(debug_f, "<5>Started bpfilter\n"); > > > > loop(); > > > > fclose(debug_f); > > > > return 0; > > > > > > Adding Dmitrii who is redesigning the whole bpfilter. > > > > Thanks. The same logic already exists in the bpfilter v1 patchset > > - [1]. > > > > 1. https://lore.kernel.org/bpf/c72bac57-84a0-ac4c-8bd8-08758715118e@fb.com/T/#mb36e20c4e5e4a70746bd50a109b1630687990214 > > Dmitrii, > > what do you prefer we should do with this patch then? There was an explicit request to make an event of loading a UMH visible - [1]. Given that the default for MaxLevelConsole is info and the patch makes the behavior slightly more accurate - ack from me. 1. https://lore.kernel.org/netdev/CA+55aFx5Q8D3cmuoXJFV9Ok_vc3fd3rNP-5onqFTPTtfZgi=HQ@mail.gmail.com/ -- Dmitrii Banshchikov ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH bpf] net/bpfilter: specify the log level for the kmsg message 2021-06-25 7:36 ` Dmitrii Banshchikov @ 2021-06-25 11:16 ` Daniel Borkmann 0 siblings, 0 replies; 6+ messages in thread From: Daniel Borkmann @ 2021-06-25 11:16 UTC (permalink / raw) To: Dmitrii Banshchikov, Alexei Starovoitov Cc: Gary Lin, Alexei Starovoitov, bpf, Network Development, Martin Loviska On 6/25/21 9:36 AM, Dmitrii Banshchikov wrote: > On Thu, Jun 24, 2021 at 08:47:06PM -0700, Alexei Starovoitov wrote: >> On Tue, Jun 22, 2021 at 11:57 PM Dmitrii Banshchikov <me@ubique.spb.ru> wrote: >>> On Tue, Jun 22, 2021 at 09:38:38PM -0700, Alexei Starovoitov wrote: >>>> On Tue, Jun 22, 2021 at 9:09 PM Gary Lin <glin@suse.com> wrote: >>>>> >>>>> Per the kmsg document(*), if we don't specify the log level with a >>>>> prefix "<N>" in the message string, the default log level will be >>>>> applied to the message. Since the default level could be warning(4), >>>>> this would make the log utility such as journalctl treat the message, >>>>> "Started bpfilter", as a warning. To avoid confusion, this commit adds >>>>> the prefix "<5>" to make the message always a notice. >>>>> >>>>> (*) https://www.kernel.org/doc/Documentation/ABI/testing/dev-kmsg >>>>> >>>>> Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg") >>>>> Reported-by: Martin Loviska <mloviska@suse.com> >>>>> Signed-off-by: Gary Lin <glin@suse.com> >>>>> --- >>>>> net/bpfilter/main.c | 2 +- >>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>> >>>>> diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c >>>>> index 05e1cfc1e5cd..291a92546246 100644 >>>>> --- a/net/bpfilter/main.c >>>>> +++ b/net/bpfilter/main.c >>>>> @@ -57,7 +57,7 @@ int main(void) >>>>> { >>>>> debug_f = fopen("/dev/kmsg", "w"); >>>>> setvbuf(debug_f, 0, _IOLBF, 0); >>>>> - fprintf(debug_f, "Started bpfilter\n"); >>>>> + fprintf(debug_f, "<5>Started bpfilter\n"); >>>>> loop(); >>>>> fclose(debug_f); >>>>> return 0; >>>> >>>> Adding Dmitrii who is redesigning the whole bpfilter. >>> >>> Thanks. The same logic already exists in the bpfilter v1 patchset >>> - [1]. >>> >>> 1. https://lore.kernel.org/bpf/c72bac57-84a0-ac4c-8bd8-08758715118e@fb.com/T/#mb36e20c4e5e4a70746bd50a109b1630687990214 >> >> Dmitrii, >> >> what do you prefer we should do with this patch then? > > There was an explicit request to make an event of loading a UMH > visible - [1]. Given that the default for MaxLevelConsole is info > and the patch makes the behavior slightly more accurate - ack > from me. Ok, sounds good, applied, thanks! ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-06-25 11:16 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-06-23 4:09 [PATCH bpf] net/bpfilter: specify the log level for the kmsg message Gary Lin 2021-06-23 4:38 ` Alexei Starovoitov 2021-06-23 6:57 ` Dmitrii Banshchikov 2021-06-25 3:47 ` Alexei Starovoitov 2021-06-25 7:36 ` Dmitrii Banshchikov 2021-06-25 11:16 ` Daniel Borkmann
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 NNTP newsgroup(s).