lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3YJKOmxmZPvqAJGS_WHUv5i+Cb0MSwu583wK+G6BO0MOw@mail.gmail.com>
Date:   Sat, 28 May 2022 12:26:43 +0800
From:   Menglong Dong <menglong8.dong@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Ingo Molnar <mingo@...hat.com>,
        David Miller <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Neil Horman <nhorman@...driver.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Menglong Dong <imagedong@...cent.com>,
        David Ahern <dsahern@...nel.org>,
        Talal Ahmad <talalahmad@...gle.com>,
        Kees Cook <keescook@...omium.org>,
        LKML <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH net-next 2/3] net: skb: use auto-generation to convert skb
 drop reason to string

On Sat, May 28, 2022 at 9:14 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Fri, 27 May 2022 15:15:21 +0800 menglong8.dong@...il.com wrote:
> > +clean-files := dropreason_str.h
> > +
> > +quiet_cmd_dropreason_str = GEN     $@
> > +cmd_dropreason_str = echo '\n\#define __DEFINE_SKB_DROP_REASON(FN) \' > $@;\
>
> echo -n
>
> > +     sed -e '/enum skb_drop_reason {/,/}/!d' $< | \
> > +     awk -F ',' '/SKB_DROP_REASON_/{printf " FN(%s) \\\n", substr($$1, 18)}' >> $@;\
> > +     echo '' >> $@
>
> Trying to figure out when we're in the enum could be more robust
> in case more stuff gets added to the header:
>
>  | awk -F ',' '/^enum skb_drop/ { dr=1; }
>                /\}\;/           { dr=0; }
>                /^\tSKB_DROP/    { if (dr) {print $1;}}'
>
> > +$(obj)/dropreason_str.h: $(srctree)/include/linux/dropreason.h
> > +     $(call cmd,dropreason_str)
> > +
> > +$(obj)/skbuff.o: $(obj)/dropreason_str.h
>
> Since we just generate the array directly now should we generate
> a source file with it directly instead of generating a header with
> the huge define?

This seems to be a good idea, which is able to decouple the
definition of the array with skbuff.c. I'll try this.

Thanks!
Menglong Dong

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ