[PATCH v1 0/6] netlink netfilter decoder
Dmitry V. Levin
ldv at strace.io
Mon Jun 23 16:08:34 UTC 2025
On Fri, Jun 20, 2025 at 01:20:13PM +0300, Dmitry V. Levin wrote:
> On Thu, Jun 19, 2025 at 04:12:40PM +0200, Mathis Marion wrote:
> [...]
> > I must admit that this has been manual work. nf_tables.h[1] is quite
> > well documented so I suppose it could be passed through some scripts
> > to extract data. At least the xlat tables could be generated using a
> > script. I see that there are already some scripts to generate some
> > tables, but I did not spend the time to understand them. I can look
> > into providing some automation for future xlat updates and missing
> > attributes. Do you suggest a starting point based on the existing
> > scripts?
>
> Unfortunately, we don't have scripts for updating xlat tables yet,
> although the enums defined in nf_tables.h look regular enough for
> an automated processing. For example:
>
> nf_tables_h=bundled/linux/include/uapi/linux/netfilter/nf_tables.h
> for t in $(sed -n 's/^enum \(nf[[:alnum:]_]*\).*/\1/p' "$nf_tables_h"); do {
> echo '#unconditional'
> sed -n '/^enum '"$t"' {/,/^};/p' "$nf_tables_h" |
> sed 's/= 0\>//' |
> grep -Fq = ||
> echo '#value_indexed'
> sed -n '/^enum '"$t"' {/,/^};/ s/^[[:space:]]*\([A-Z][[:alnum:]_]*\).*/\1/p' "$nf_tables_h" |
> grep -v '_MAX\>'
> } > src/xlat/"$t".in; done
The idea appeared to be useful, so I added a new maint script:
maint/enum2xlat.sh.
With its help, I found and updated a few xlat files that weren't
up to date. Feel free to use it for your new xlat files as well.
--
ldv
More information about the Strace-devel
mailing list