Commit 96df8360 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements

Otherwise EINVAL is bogusly reported to userspace when deleting a set
element. NFTA_SET_ELEM_KEY_END does not need to be set in case of:

- insertion: if not present, start key is used as end key.
- deletion: only start key needs to be specified, end key is ignored.

Hence, relax the sanity check.

Fixes: 88cccd90 ("netfilter: nf_tables: NFTA_SET_ELEM_KEY_END requires concat and interval flags")
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 1fcc064b
...@@ -5865,8 +5865,9 @@ static bool nft_setelem_valid_key_end(const struct nft_set *set, ...@@ -5865,8 +5865,9 @@ static bool nft_setelem_valid_key_end(const struct nft_set *set,
(NFT_SET_CONCAT | NFT_SET_INTERVAL)) { (NFT_SET_CONCAT | NFT_SET_INTERVAL)) {
if (flags & NFT_SET_ELEM_INTERVAL_END) if (flags & NFT_SET_ELEM_INTERVAL_END)
return false; return false;
if (!nla[NFTA_SET_ELEM_KEY_END] &&
!(flags & NFT_SET_ELEM_CATCHALL)) if (nla[NFTA_SET_ELEM_KEY_END] &&
flags & NFT_SET_ELEM_CATCHALL)
return false; return false;
} else { } else {
if (nla[NFTA_SET_ELEM_KEY_END]) if (nla[NFTA_SET_ELEM_KEY_END])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment