From e7d3210974e3c091ea11c1c9a94b07d3b5b6abd1 Mon Sep 17 00:00:00 2001 From: Elise Lennion Date: Fri, 24 Mar 2017 12:30:41 -0300 Subject: src: Make flush command selective of the set structure type The internal set infrastructure is used for sets, maps and flow tables. The flush command requires the set type but currently it works for all of them. E.g. if there is a set named 's' in a table 't' the following command shouldn't be valid but still executes: $ nft flush flow table t s This patch makes the flush command selective so 'flush flow table' only works in flow tables and so on. Fixes: 6d37dae ("parser_bison: Allow flushing maps") Fixes: 2daa0ee ("parser_bison: Allow flushing flow tables") Signed-off-by: Elise Lennion Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index 997a6243..209cf2d7 100644 --- a/src/rule.c +++ b/src/rule.c @@ -1512,6 +1512,8 @@ static int do_command_flush(struct netlink_ctx *ctx, struct cmd *cmd) case CMD_OBJ_CHAIN: return netlink_flush_chain(ctx, &cmd->handle, &cmd->location); case CMD_OBJ_SET: + case CMD_OBJ_MAP: + case CMD_OBJ_FLOWTABLE: return netlink_flush_setelems(ctx, &cmd->handle, &cmd->location); case CMD_OBJ_RULESET: -- cgit v1.2.3