[PATCH v1 0/6] netlink netfilter decoder
Mathis Marion
mathis.marion at silabs.com
Tue Jun 24 08:20:39 UTC 2025
On 23/06/2025 18:08, Dmitry V. Levin wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> 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.
>
I am happy to have sparked this idea! I will look into it for the
next version. I am struggling to find time to work on this at the
moment, I hope it is fine if this proposal stays stale for a bit,
I will come back to it eventually.
>
> --
> ldv
More information about the Strace-devel
mailing list