Skip to content

Commit 740a794

Browse files
ummakynesgregkh
authored andcommitted
netfilter: nft_dynset: relax superfluous check on set updates
[ Upstream commit 7b13948 ] Relax this condition to make add and update commands idempotent for sets with no timeout. The eval function already checks if the set element timeout is available and updates it if the update command is used. Fixes: 22fe54d ("netfilter: nf_tables: add support for dynamic set updates") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent af756be commit 740a794

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

‎net/netfilter/nft_dynset.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,8 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
141141
return -EBUSY;
142142

143143
priv->op = ntohl(nla_get_be32(tb[NFTA_DYNSET_OP]));
144-
switch (priv->op) {
145-
case NFT_DYNSET_OP_ADD:
146-
case NFT_DYNSET_OP_DELETE:
147-
break;
148-
case NFT_DYNSET_OP_UPDATE:
149-
if (!(set->flags & NFT_SET_TIMEOUT))
150-
return -EOPNOTSUPP;
151-
break;
152-
default:
144+
if (priv->op > NFT_DYNSET_OP_DELETE)
153145
return -EOPNOTSUPP;
154-
}
155146

156147
timeout = 0;
157148
if (tb[NFTA_DYNSET_TIMEOUT] != NULL) {

0 commit comments

Comments
 (0)