summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2014-01-08 13:02:16 +0000
committerPatrick McHardy <kaber@trash.net>2014-01-08 13:03:19 +0000
commitb90667a2ae941d2b79630d0344ef489c2bf9d9aa (patch)
tree39484a0b038b6db9509b18d6585e9da590213629 /src/payload.c
parent1249b7b0b47bca67cf3adac4143b4bda43e4c582 (diff)
proto: add support for meta templates
The following two patches will add two new meta expression types that are used as dependencies in the inet table. To reuse the existing dependency generation code, add a slightly hackish way to specify meta expressions as payload dependencies. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/payload.c b/src/payload.c
index 0ef3c791..04a3455e 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -187,7 +187,11 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
desc->name, expr->payload.desc->name);
tmpl = &desc->templates[desc->protocol_key];
- left = payload_expr_alloc(&expr->location, desc, desc->protocol_key);
+ if (tmpl->meta_key)
+ left = meta_expr_alloc(&expr->location, tmpl->meta_key);
+ else
+ left = payload_expr_alloc(&expr->location, desc, desc->protocol_key);
+
right = constant_expr_alloc(&expr->location, tmpl->dtype,
BYTEORDER_HOST_ENDIAN,
tmpl->len, &protocol);