summaryrefslogtreecommitdiffstats
path: root/src/evaluate.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2018-02-25 19:46:04 +0100
committerFlorian Westphal <fw@strlen.de>2018-02-26 18:29:39 +0100
commite277fa7d015bd3f5d5d20be2c5adc4723f1867b2 (patch)
treeebf8fd2891d3dec70185980cbb17feac867c47d8 /src/evaluate.c
parentd3b6a35d20040e62b1d88aeedccbe2184f06408e (diff)
src: make raw payloads work
make syntax consistent between print and parse. No dependency handling -- once you use raw expression, you need to make sure the raw expression only sees the packets that you'd want it to see. based on an earlier patch from Laurent Fasnacht <l@libres.ch>. Laurents patch added a different syntax: @<protocol>,<base>,<data type>,<offset>,<length> data_type is useful to make nftables not err when asking for "@payload,32,32 192.168.0.1", this patch still requires manual convsersion to an integer type (hex or decimal notation). data_type should probably be added later by adding an explicit cast expression, independent of the raw payload syntax. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r--src/evaluate.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index c98749d9..6be3bf03 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -609,6 +609,9 @@ static int __expr_evaluate_payload(struct eval_ctx *ctx, struct expr *expr)
struct stmt *nstmt;
int err;
+ if (expr->ops->type == EXPR_PAYLOAD && expr->payload.is_raw)
+ return 0;
+
desc = ctx->pctx.protocol[base].desc;
if (desc == NULL) {
if (payload_gen_dependency(ctx, payload, &nstmt) < 0)