mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 17:54:13 +08:00
netfilter: nft_rbtree: introduce nft_rbtree_interval_end() helper
Add this new nft_rbtree_interval_end() helper function to check in the end interval is set. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
parent
3971ca1435
commit
ef1d20e0f8
@ -29,6 +29,11 @@ struct nft_rbtree_elem {
|
|||||||
struct nft_set_ext ext;
|
struct nft_set_ext ext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool nft_rbtree_interval_end(const struct nft_rbtree_elem *rbe)
|
||||||
|
{
|
||||||
|
return nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) &&
|
||||||
|
(*nft_set_ext_flags(&rbe->ext) & NFT_SET_ELEM_INTERVAL_END);
|
||||||
|
}
|
||||||
|
|
||||||
static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key,
|
static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key,
|
||||||
const struct nft_set_ext **ext)
|
const struct nft_set_ext **ext)
|
||||||
@ -56,9 +61,7 @@ found:
|
|||||||
parent = parent->rb_left;
|
parent = parent->rb_left;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) &&
|
if (nft_rbtree_interval_end(rbe))
|
||||||
*nft_set_ext_flags(&rbe->ext) &
|
|
||||||
NFT_SET_ELEM_INTERVAL_END)
|
|
||||||
goto out;
|
goto out;
|
||||||
spin_unlock_bh(&nft_rbtree_lock);
|
spin_unlock_bh(&nft_rbtree_lock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user