summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-11-30 21:11:23 +0100
committerFlorian Westphal <fw@strlen.de>2021-12-09 11:12:32 +0100
commit9f204f7da605b9b41c3bef4533230e4cd52bba07 (patch)
treed36df9abc268f7caf456163b155c6a8ce27414a9 /src/payload.c
parenteb813692a3068a89748b568a98aa926ad83c1a61 (diff)
payload: skip templates with meta key set
meta templates are only there for ease of use (input/parsing). When listing, they should be ignored: set s4 { typeof ip version elements = { 1, } } chain c4 { ip version @s4 accept } gets listed as 'ip l4proto ...' which is nonsensical. after this patch we get: in: ip version @s4 out: (@nh,0,8 & 0xf0) >> 4 == @s4 .. which is (marginally) better. Next patch adds support for payload decoding. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/payload.c b/src/payload.c
index d9e0d425..79008762 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -811,6 +811,9 @@ void payload_expr_complete(struct expr *expr, const struct proto_ctx *ctx)
tmpl->len != expr->len)
continue;
+ if (tmpl->meta_key && i == 0)
+ continue;
+
if (tmpl->icmp_dep && ctx->th_dep.icmp.type &&
ctx->th_dep.icmp.type != icmp_dep_to_type(tmpl->icmp_dep))
continue;