netfilter: nf_tables: reject NFT_SET_ELEM_INTERVAL_END flag for non-interval sets
authorPatrick McHardy <kaber@trash.net>
Sat, 21 Mar 2015 15:19:16 +0000 (15:19 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 22 Mar 2015 18:50:35 +0000 (19:50 +0100)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c

index a072d8769b9be390e830cbed219584b74267d439..f7e3371ce856a0a51a0fd4ee106e3602ea0190f9 100644 (file)
@@ -3138,6 +3138,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
                elem.flags = ntohl(nla_get_be32(nla[NFTA_SET_ELEM_FLAGS]));
                if (elem.flags & ~NFT_SET_ELEM_INTERVAL_END)
                        return -EINVAL;
+               if (!(set->flags & NFT_SET_INTERVAL) &&
+                   elem.flags & NFT_SET_ELEM_INTERVAL_END)
+                       return -EINVAL;
        }
 
        if (set->flags & NFT_SET_MAP) {