Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / net / netfilter / ipset / ip_set_core.c
index 2b19189..89009c8 100644 (file)
@@ -1109,6 +1109,8 @@ static int ip_set_create(struct net *net, struct sock *ctnl,
                ret = -IPSET_ERR_PROTOCOL;
                goto put_out;
        }
+       /* Set create flags depending on the type revision */
+       set->flags |= set->type->create_flags[revision];
 
        ret = set->type->create(net, set, tb, flags);
        if (ret != 0)
@@ -1239,10 +1241,12 @@ static int 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;