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/statement.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/statement.c')
-rw-r--r-- | src/statement.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/statement.c b/src/statement.c index 07e17461..b9324fd7 100644 --- a/src/statement.c +++ b/src/statement.c @@ -573,12 +573,12 @@ static void nat_stmt_print(const struct stmt *stmt, struct output_ctx *octx) if (stmt->nat.addr) { nft_print(octx, " "); if (stmt->nat.proto) { - if (stmt->nat.addr->ops->type == EXPR_VALUE && + if (stmt->nat.addr->etype == EXPR_VALUE && stmt->nat.addr->dtype->type == TYPE_IP6ADDR) { nft_print(octx, "["); expr_print(stmt->nat.addr, octx); nft_print(octx, "]"); - } else if (stmt->nat.addr->ops->type == EXPR_RANGE && + } else if (stmt->nat.addr->etype == EXPR_RANGE && stmt->nat.addr->left->dtype->type == TYPE_IP6ADDR) { nft_print(octx, "["); expr_print(stmt->nat.addr->left, octx); @@ -794,7 +794,7 @@ static void tproxy_stmt_print(const struct stmt *stmt, struct output_ctx *octx) nft_print(octx, " to"); if (stmt->tproxy.addr) { nft_print(octx, " "); - if (stmt->tproxy.addr->ops->type == EXPR_VALUE && + if (stmt->tproxy.addr->etype == EXPR_VALUE && stmt->tproxy.addr->dtype->type == TYPE_IP6ADDR) { nft_print(octx, "["); expr_print(stmt->tproxy.addr, octx); @@ -803,7 +803,7 @@ static void tproxy_stmt_print(const struct stmt *stmt, struct output_ctx *octx) expr_print(stmt->tproxy.addr, octx); } } - if (stmt->tproxy.port && stmt->tproxy.port->ops->type == EXPR_VALUE) { + if (stmt->tproxy.port && stmt->tproxy.port->etype == EXPR_VALUE) { if (!stmt->tproxy.addr) nft_print(octx, " "); nft_print(octx, ":"); |