Skip to content

Commit

Permalink
netfilter: nft_rbtree: introduce nft_rbtree_interval_end() helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pablo Neira Ayuso committed Apr 25, 2016
1 parent 3971ca1 commit ef1d20e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions net/netfilter/nft_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ struct nft_rbtree_elem {
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,
const struct nft_set_ext **ext)
Expand Down Expand Up @@ -56,9 +61,7 @@ static bool nft_rbtree_lookup(const struct nft_set *set, const u32 *key,
parent = parent->rb_left;
continue;
}
if (nft_set_ext_exists(&rbe->ext, NFT_SET_EXT_FLAGS) &&
*nft_set_ext_flags(&rbe->ext) &
NFT_SET_ELEM_INTERVAL_END)
if (nft_rbtree_interval_end(rbe))
goto out;
spin_unlock_bh(&nft_rbtree_lock);

Expand Down

0 comments on commit ef1d20e

Please sign in to comment.