summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorLaura Garcia Liebana <nevola@gmail.com>2019-07-15 14:23:37 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-16 11:12:44 +0300
commit36b6458d8541d47a55b6aa20ac1792edf270410c (patch)
tree591345e09df8811050be113badc92dfa918b5fc3 /net
parent6f1d7f0d66899646ac50e717ca4cffd9c6c794ba (diff)
downloadlinux-36b6458d8541d47a55b6aa20ac1792edf270410c.tar.xz
netfilter: nft_hash: fix symhash with modulus one
[ Upstream commit 28b1d6ef53e3303b90ca8924bb78f31fa527cafb ] The rule below doesn't work as the kernel raises -ERANGE. nft add rule netdev nftlb lb01 ip daddr set \ symhash mod 1 map { 0 : 192.168.0.10 } fwd to "eth0" This patch allows to use the symhash modulus with one element, in the same way that the other types of hashes and algorithms that uses the modulus parameter. Signed-off-by: Laura Garcia Liebana <nevola@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nft_hash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index c2d237144f74..b8f23f75aea6 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -196,7 +196,7 @@ static int nft_symhash_init(const struct nft_ctx *ctx,
priv->dreg = nft_parse_register(tb[NFTA_HASH_DREG]);
priv->modulus = ntohl(nla_get_be32(tb[NFTA_HASH_MODULUS]));
- if (priv->modulus <= 1)
+ if (priv->modulus < 1)
return -ERANGE;
if (priv->offset + priv->modulus - 1 < priv->offset)