Skip to content

Commit 95cd4bc

Browse files
committed
netfilter: nft_dynset: report EOPNOTSUPP on missing set feature
If userspace requests a feature which is not available the original set definition, then bail out with EOPNOTSUPP. If userspace sends unsupported dynset flags (new feature not supported by this kernel), then report EOPNOTSUPP to userspace. EINVAL should be only used to report malformed netlink messages from userspace. Fixes: 22fe54d ("netfilter: nf_tables: add support for dynamic set updates") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 6cb5621 commit 95cd4bc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

net/netfilter/nft_dynset.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
177177
u32 flags = ntohl(nla_get_be32(tb[NFTA_DYNSET_FLAGS]));
178178

179179
if (flags & ~NFT_DYNSET_F_INV)
180-
return -EINVAL;
180+
return -EOPNOTSUPP;
181181
if (flags & NFT_DYNSET_F_INV)
182182
priv->invert = true;
183183
}
@@ -210,7 +210,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
210210
timeout = 0;
211211
if (tb[NFTA_DYNSET_TIMEOUT] != NULL) {
212212
if (!(set->flags & NFT_SET_TIMEOUT))
213-
return -EINVAL;
213+
return -EOPNOTSUPP;
214214

215215
err = nf_msecs_to_jiffies64(tb[NFTA_DYNSET_TIMEOUT], &timeout);
216216
if (err)
@@ -224,7 +224,7 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
224224

225225
if (tb[NFTA_DYNSET_SREG_DATA] != NULL) {
226226
if (!(set->flags & NFT_SET_MAP))
227-
return -EINVAL;
227+
return -EOPNOTSUPP;
228228
if (set->dtype == NFT_DATA_VERDICT)
229229
return -EOPNOTSUPP;
230230

0 commit comments

Comments
 (0)