summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-04-13 16:52:28 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-04-14 13:53:02 +0200
commitebc3f6636bd5a3c54350d9ed06c1785cb6cc37be (patch)
tree3a1e06a00ee077278f2000f9b62f7e53e86c8520
parent23a6c8ccdd293a2c3448e5e197cd0384bef767cb (diff)
Review raw payload allocation points
In parser_bison.y, call payload_init_raw() instead of assigning all fields manually. Also drop manual initialization of flags field: it is not touched in allocation path, so no need for that. In stmt_evaluate_payload(), setting dtype field is redundant since payload_init_raw() does that already. Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--src/evaluate.c1
-rw-r--r--src/parser_bison.y6
2 files changed, 1 insertions, 6 deletions
diff --git a/src/evaluate.c b/src/evaluate.c
index efdbb5e5..db63494c 100644
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -1951,7 +1951,6 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt)
payload_byte_size * BITS_PER_BYTE);
payload_bytes->payload.desc = payload->payload.desc;
- payload_bytes->dtype = &integer_type;
payload_bytes->byteorder = payload->byteorder;
payload->len = payload_bytes->len;
diff --git a/src/parser_bison.y b/src/parser_bison.y
index f1617eea..93346d76 100644
--- a/src/parser_bison.y
+++ b/src/parser_bison.y
@@ -3682,13 +3682,9 @@ payload_expr : payload_raw_expr
payload_raw_expr : AT payload_base_spec COMMA NUM COMMA NUM
{
$$ = payload_expr_alloc(&@$, NULL, 0);
- $$->payload.base = $2;
- $$->payload.offset = $4;
- $$->len = $6;
- $$->dtype = &integer_type;
+ payload_init_raw($$, $2, $4, $6);
$$->byteorder = BYTEORDER_BIG_ENDIAN;
$$->payload.is_raw = true;
- $$->flags = 0;
}
;