diff options
author | Jozsef Kadlecsik <kadlec@netfilter.org> | 2020-09-20 13:06:59 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@netfilter.org> | 2020-09-20 13:09:41 +0200 |
commit | 3d5ffca9db521d5bd8868760ee1c5263e0d25c1d (patch) | |
tree | 41bcd23dc0dbd9d7a0c42e8a1f8085e8c13ee53f /kernel/net/netfilter | |
parent | 514bd1d1234ce9bab49244cf638dff8c894940a1 (diff) |
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>
Diffstat (limited to 'kernel/net/netfilter')
-rw-r--r-- | kernel/net/netfilter/ipset/ip_set_core.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/net/netfilter/ipset/ip_set_core.c b/kernel/net/netfilter/ipset/ip_set_core.c index 6fa3107..6e80fb4 100644 --- a/kernel/net/netfilter/ipset/ip_set_core.c +++ b/kernel/net/netfilter/ipset/ip_set_core.c @@ -1259,10 +1259,12 @@ IPSET_CBFN(ip_set_destroy, struct net *net, struct sock *ctnl, /* Modified by ip_set_destroy() only, which is serialized */ inst->is_destroyed = false; } else { + u32 flags = flag_exist(nlh); s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]), &i); if (!s) { - ret = -ENOENT; + if (!(flags & IPSET_FLAG_EXIST)) + ret = -ENOENT; goto out; } else if (s->ref || s->ref_netlink) { ret = -IPSET_ERR_BUSY; |