evaluate: permit get element on maps
Florian Westphal
maintainerPATCH 1/1 evaluate: permit get element on maps
Its possible to add an element to a map, but you can't read it back:
before:
nft add element inet filter test "{ 18.51.100.17 . ad:c1:ac:c0:ce:c0 . 3761 : 0x42 }" nft get element inet filter test "{ 18.51.100.17 . ad:c1:ac:c0:ce:c0 . 3761 : 0x42 }"
Error: No such file or directory; did you mean map ‘test’ in table inet ‘filter’? get element inet filter test { 18.51.100.17 . ad:c1:ac:c0:ce:c0 . 3761 : 0x42 }
^^^^
after:
nft get element inet filter test "{ 18.51.100.17 . ad:c1:ac:c0:ce:c0 . 3761 : 0x42 }"
table inet filter {
map test {
type ipv4_addr . ether_addr . inet_service : mark
flags interval,timeout
elements = { 18.51.100.17 . ad:c1:ac:c0:ce:c0 . 3761 : 0x00000042 }
}
}Signed-off-by Florian Westphal <[email protected]>
--- src/evaluate.c | 12 ------------ 1 file changed, 12 deletions(-)
src/evaluate.c +0 -12
@@ -4136,20 +4136,8 @@ static int cmd_evaluate_delete(struct eval_ctx *ctx, struct cmd *cmd)static int cmd_evaluate_get (struct eval_ctx *ctx,struct cmd *cmd) { -struct table *table; -struct set *set; -switch (cmd->obj) {case CMD_OBJ_ELEMENTS : - table =table_lookup (&cmd->handle, &ctx->nft->cache); -if (table ==NULL ) -return table_not_found (ctx); - - set =set_lookup (table, cmd->handle.set.name); -if (set ==NULL ||set_is_map (set->flags)) -return set_not_found (ctx, &ctx->cmd->handle.set.location, - ctx->cmd->handle.set.name); -return setelem_evaluate (ctx, &cmd->expr);default :BUG ("invalid command object type %u\n" , cmd->obj);
Signature · 1 line
2.26.2