From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 09/14] netfilter: nft_hash: fix symhash with modulus one
Date: Fri, 19 Jul 2019 18:45:12 +0200 [thread overview]
Message-ID: <20190719164517.29496-10-pablo@netfilter.org> (raw)
In-Reply-To: <20190719164517.29496-1-pablo@netfilter.org>
From: Laura Garcia Liebana <nevola@gmail.com>
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>
---
net/netfilter/nft_hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index fe93e731dc7f..b836d550b919 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -129,7 +129,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)
--
2.11.0
next prev parent reply other threads:[~2019-07-19 16:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-19 16:45 [PATCH 00/14] Netfilter fixes for net Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 01/14] netfilter: nfnetlink: avoid deadlock due to synchronous request_module Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 02/14] netfilter: Fix rpfilter dropping vrf packets by mistake Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 03/14] netfilter: nf_conntrack_sip: fix expectation clash Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 04/14] netfilter: Update obsolete comments referring to ip_conntrack Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 05/14] netfilter: nf_tables: fix module autoload for redir Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 06/14] netfilter: synproxy: fix erroneous tcp mss option Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 07/14] netfilter: conntrack: always store window size un-scaled Pablo Neira Ayuso
2019-07-19 16:45 ` [PATCH 08/14] netfilter: nf_tables: don't fail when updating base chain policy Pablo Neira Ayuso
2019-07-19 16:45 ` Pablo Neira Ayuso [this message]
2019-07-20 4:25 ` [PATCH 00/14] Netfilter fixes for net David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190719164517.29496-10-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).