diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-08 13:02:15 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2014-01-08 13:02:15 +0000 |
commit | 77ef4d83c8d030b183ff763605b2c3026545fc9c (patch) | |
tree | 8ad321d7a8d5f285d84f3873c75f65c408ec11be /src/evaluate.c | |
parent | 8f86606efe82489945db1706bd1d1a4d524afcad (diff) |
expr: add protocol context update callback
Add a callback function to the expression ops to update the protocol
context for relational protocol expressions (EXPR_F_PROTOCOL).
Also set the EXPR_F_PROTOCOL flag for IIFTYPE meta expressions to make
sure the callback is invoked when necessary.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 112fc944..3fe9da4f 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -919,18 +919,14 @@ static int expr_evaluate_relational(struct eval_ctx *ctx, struct expr **expr) * Update protocol context for payload and meta iiftype * equality expressions. */ - switch (left->ops->type) { - case EXPR_PAYLOAD: - payload_expr_pctx_update(&ctx->pctx, rel); - break; - case EXPR_META: - meta_expr_pctx_update(&ctx->pctx, rel); - break; - case EXPR_CONCAT: + if (left->flags & EXPR_F_PROTOCOL && + left->ops->pctx_update) + left->ops->pctx_update(&ctx->pctx, rel); + + if (left->ops->type == EXPR_CONCAT) return 0; - default: - break; - } + + /* fall through */ case OP_NEQ: case OP_FLAGCMP: if (!datatype_equal(left->dtype, right->dtype)) |