From e1dfd5cc4c46514a84dd8a2063b45517b596e1ca Mon Sep 17 00:00:00 2001 From: "Fernando F. Mancera" Date: Mon, 6 Feb 2023 11:06:42 +0100 Subject: src: add support to command "destroy" "destroy" command performs a deletion as "delete" command but does not fail if the object does not exist. As there is no NLM_F_* flag for ignoring such error, it needs to be ignored directly on error handling. Example of use: # nft list ruleset table ip filter { chain output { } } # nft destroy table ip missingtable # echo $? 0 # nft list ruleset table ip filter { chain output { } } Signed-off-by: Fernando Fernandez Mancera Signed-off-by: Pablo Neira Ayuso --- src/rule.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/rule.c') diff --git a/src/rule.c b/src/rule.c index 371c803a..a58fd1f2 100644 --- a/src/rule.c +++ b/src/rule.c @@ -2738,6 +2738,7 @@ int do_command(struct netlink_ctx *ctx, struct cmd *cmd) case CMD_REPLACE: return do_command_replace(ctx, cmd); case CMD_DELETE: + case CMD_DESTROY: return do_command_delete(ctx, cmd); case CMD_GET: return do_command_get(ctx, cmd); -- cgit v1.2.3