diff options
author | Florian Westphal <fw@strlen.de> | 2019-02-08 17:02:22 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2019-02-08 21:22:51 +0100 |
commit | 72931553828af0ce85f0562b9ff8ec7f4d28e050 (patch) | |
tree | 6fe42e2a99febc3ff783f63b8219de81215cf0d3 /src/payload.c | |
parent | 2cc91e6198e7ee8b9d0f8727c67a849fec393cd0 (diff) |
src: expr: add expression etype
Temporary kludge to remove all the expr->ops->type == ... patterns.
Followup patch will remove expr->ops, and make expr_ops() lookup
the correct expr_ops struct instead to reduce struct expr size.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/payload.c')
-rw-r--r-- | src/payload.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/payload.c b/src/payload.c index 5fd2a07b..b459b1bf 100644 --- a/src/payload.c +++ b/src/payload.c @@ -406,7 +406,7 @@ bool payload_is_stacked(const struct proto_desc *desc, const struct expr *expr) { const struct proto_desc *next; - if (expr->left->ops->type != EXPR_PAYLOAD || + if (expr->left->etype != EXPR_PAYLOAD || !(expr->left->flags & EXPR_F_PROTOCOL) || expr->op != OP_EQ) return false; @@ -475,7 +475,7 @@ static bool payload_may_dependency_kill(struct payload_dep_ctx *ctx, case NFPROTO_BRIDGE: case NFPROTO_NETDEV: case NFPROTO_INET: - if (dep->left->ops->type == EXPR_PAYLOAD && + if (dep->left->etype == EXPR_PAYLOAD && dep->left->payload.base == PROTO_BASE_NETWORK_HDR && (dep->left->payload.desc == &proto_ip || dep->left->payload.desc == &proto_ip6) && @@ -537,7 +537,7 @@ void payload_expr_complete(struct expr *expr, const struct proto_ctx *ctx) const struct proto_hdr_template *tmpl; unsigned int i; - assert(expr->ops->type == EXPR_PAYLOAD); + assert(expr->etype == EXPR_PAYLOAD); desc = ctx->protocol[expr->payload.base].desc; if (desc == NULL || desc == &proto_inet) @@ -596,7 +596,7 @@ bool payload_expr_trim(struct expr *expr, struct expr *mask, const struct proto_desc *desc; unsigned int off, i, len = 0; - assert(expr->ops->type == EXPR_PAYLOAD); + assert(expr->etype == EXPR_PAYLOAD); desc = ctx->protocol[expr->payload.base].desc; if (desc == NULL) @@ -659,7 +659,7 @@ void payload_expr_expand(struct list_head *list, struct expr *expr, struct expr *new; unsigned int i; - assert(expr->ops->type == EXPR_PAYLOAD); + assert(expr->etype == EXPR_PAYLOAD); desc = ctx->protocol[expr->payload.base].desc; if (desc == NULL) |