From 058246016188c8418cae1b3db70b16b935b1fe7c Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Fri, 25 Oct 2024 09:47:25 +0200 Subject: src: allow to map key to nfqueue number Allow to specify a numeric queue id as part of a map. The parser side is easy, but the reverse direction (listing) is not. 'queue' is a statement, it doesn't have an expression. Add a generic 'queue_type' datatype as a shim to the real basetype with constant expressions, this is used only for udata build/parse, it stores the "key" (the parser token, here "queue") as udata in kernel and can then restore the original key. Add a dumpfile to validate parser & output. JSON support is missing because JSON allow typeof only since quite recently. Joint work with Pablo. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1455 Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- include/datatype.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/datatype.h b/include/datatype.h index 75d6d6b8..8b950f91 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -140,7 +140,8 @@ struct parse_ctx; struct datatype { uint32_t type; enum byteorder byteorder:8; - uint32_t alloc:1; + uint32_t alloc:1, + is_typeof:1; unsigned int size; unsigned int subtypes; const char *name; @@ -271,6 +272,7 @@ extern const struct datatype boolean_type; extern const struct datatype priority_type; extern const struct datatype policy_type; extern const struct datatype cgroupv2_type; +extern const struct datatype queue_type; /* private datatypes for reject statement. */ extern const struct datatype reject_icmp_code_type; -- cgit v1.2.3