netfilter: nf_tables: honor NFT_SET_OBJECT in set backend selection
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 10 Feb 2017 18:59:36 +0000 (19:59 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 12 Feb 2017 13:45:14 +0000 (14:45 +0100)
Check for NFT_SET_OBJECT feature flag, otherwise we may end up selecting
the wrong set backend.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c
net/netfilter/nft_set_hash.c
net/netfilter/nft_set_rbtree.c

index 6c782532615f12c061aa614a0f8963331be510ac..ff7304ae58ac4f99cf4841badcbe0afd8a1f6968 100644 (file)
@@ -2424,7 +2424,8 @@ nft_select_set_ops(const struct nlattr * const nla[],
        features = 0;
        if (nla[NFTA_SET_FLAGS] != NULL) {
                features = ntohl(nla_get_be32(nla[NFTA_SET_FLAGS]));
-               features &= NFT_SET_INTERVAL | NFT_SET_MAP | NFT_SET_TIMEOUT;
+               features &= NFT_SET_INTERVAL | NFT_SET_MAP | NFT_SET_TIMEOUT |
+                           NFT_SET_OBJECT;
        }
 
        bops        = NULL;
index 6938bc890f311b175a555b5d9641025b35ab6751..5f652720fc78e6de437c100d31524588e729001c 100644 (file)
@@ -404,7 +404,7 @@ static struct nft_set_ops nft_hash_ops __read_mostly = {
        .lookup         = nft_hash_lookup,
        .update         = nft_hash_update,
        .walk           = nft_hash_walk,
-       .features       = NFT_SET_MAP | NFT_SET_TIMEOUT,
+       .features       = NFT_SET_MAP | NFT_SET_OBJECT | NFT_SET_TIMEOUT,
        .owner          = THIS_MODULE,
 };
 
index 3387ed7dd2317e65e6b381daac978730fc3018a6..71e8fb886a73b70489e635c63957cb9f8642ec5d 100644 (file)
@@ -310,7 +310,7 @@ static struct nft_set_ops nft_rbtree_ops __read_mostly = {
        .activate       = nft_rbtree_activate,
        .lookup         = nft_rbtree_lookup,
        .walk           = nft_rbtree_walk,
-       .features       = NFT_SET_INTERVAL | NFT_SET_MAP,
+       .features       = NFT_SET_INTERVAL | NFT_SET_MAP | NFT_SET_OBJECT,
        .owner          = THIS_MODULE,
 };