Skip to content

Commit a304ea7

Browse files
Jozsef Kadlecsikummakynes
authored andcommitted
netfilter: ipset: Support the -exist flag with the destroy command
The -exist flag was supported with the create, add and delete commands. In order to gracefully handle the destroy command with nonexistent sets, the -exist flag is added to destroy too. Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 6bbb9ad commit a304ea7

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎net/netfilter/ipset/ip_set_core.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1239,10 +1239,12 @@ static int ip_set_destroy(struct net *net, struct sock *ctnl,
12391239
/* Modified by ip_set_destroy() only, which is serialized */
12401240
inst->is_destroyed = false;
12411241
} else {
1242+
u32 flags = flag_exist(nlh);
12421243
s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]),
12431244
&i);
12441245
if (!s) {
1245-
ret = -ENOENT;
1246+
if (!(flags & IPSET_FLAG_EXIST))
1247+
ret = -ENOENT;
12461248
goto out;
12471249
} else if (s->ref || s->ref_netlink) {
12481250
ret = -IPSET_ERR_BUSY;

0 commit comments

Comments
 (0)