struct table *table;
struct set *set;
struct expr *new;
+ int ret;
switch ((*expr)->symtype) {
case SYMBOL_VALUE:
new = expr_clone(sym->expr);
break;
case SYMBOL_SET:
+ ret = cache_update(ctx->cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
table = table_lookup(&ctx->cmd->handle);
if (table == NULL)
return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
static int cmd_evaluate_add(struct eval_ctx *ctx, struct cmd *cmd)
{
- struct table *table;
+ int ret;
switch (cmd->obj) {
case CMD_OBJ_SETELEM:
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
return setelem_evaluate(ctx, &cmd->expr);
case CMD_OBJ_SET:
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
handle_merge(&cmd->set->handle, &cmd->handle);
return set_evaluate(ctx, cmd->set);
case CMD_OBJ_RULE:
handle_merge(&cmd->rule->handle, &cmd->handle);
- table = table_lookup_global(ctx);
- if (table == NULL)
- return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
- ctx->cmd->handle.table);
-
- if (chain_lookup(table, &ctx->cmd->handle) == NULL)
- return cmd_error(ctx, "Could not process rule: Chain '%s' does not exist",
- ctx->cmd->handle.chain);
-
return rule_evaluate(ctx, cmd->rule);
case CMD_OBJ_CHAIN:
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
return chain_evaluate(ctx, cmd->chain);
case CMD_OBJ_TABLE:
return table_evaluate(ctx, cmd->table);
static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)
{
+ int ret;
+
switch (cmd->obj) {
case CMD_OBJ_SETELEM:
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
return setelem_evaluate(ctx, &cmd->expr);
case CMD_OBJ_SET:
case CMD_OBJ_RULE:
static int cmd_evaluate_list(struct eval_ctx *ctx, struct cmd *cmd)
{
struct table *table;
+ int ret;
+
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
switch (cmd->obj) {
case CMD_OBJ_TABLE:
static int cmd_evaluate_rename(struct eval_ctx *ctx, struct cmd *cmd)
{
struct table *table;
+ int ret;
switch (cmd->obj) {
case CMD_OBJ_CHAIN:
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
+
table = table_lookup(&ctx->cmd->handle);
if (table == NULL)
return cmd_error(ctx, "Could not process rule: Table '%s' does not exist",
static int cmd_evaluate_monitor(struct eval_ctx *ctx, struct cmd *cmd)
{
uint32_t event;
+ int ret;
+
+ ret = cache_update(cmd->op, ctx->msgs);
+ if (ret < 0)
+ return ret;
if (cmd->monitor->event == NULL)
event = CMD_MONITOR_EVENT_ANY;
return 0;
}
-int cmd_evaluate(struct eval_ctx *ctx, struct cmd *cmd)
+static int cmd_evaluate_export(struct eval_ctx *ctx, struct cmd *cmd)
{
- int ret;
-
- ret = cache_update(cmd->op, ctx->msgs);
- if (ret < 0)
- return ret;
+ return cache_update(cmd->op, ctx->msgs);
+}
+int cmd_evaluate(struct eval_ctx *ctx, struct cmd *cmd)
+{
#ifdef DEBUG
if (debug_level & DEBUG_EVALUATION) {
struct error_record *erec;
case CMD_RENAME:
return cmd_evaluate_rename(ctx, cmd);
case CMD_EXPORT:
+ return cmd_evaluate_export(ctx, cmd);
case CMD_DESCRIBE:
return 0;
case CMD_MONITOR: