[PATCH v1 0/6] netlink netfilter decoder

Dmitry V. Levin ldv at strace.io
Fri Jun 20 10:20:13 UTC 2025


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


-- 
ldv


More information about the Strace-devel mailing list