Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1085192ybl; Wed, 14 Aug 2019 10:27:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvT9qY4Kz+aJZsGIHQ3x0aHKXaLavdg/F5nr8kk1LOKfAyivntPvJeyukbi7fqH+EOUUi+ X-Received: by 2002:aa7:8106:: with SMTP id b6mr1059196pfi.5.1565803639211; Wed, 14 Aug 2019 10:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565803639; cv=none; d=google.com; s=arc-20160816; b=nGbjFDmRvy/rFbBHna7YHHg4JCugvLDzN4nxjjhQBdEwopcQi+x/2+cueAvU+A3iQq ZTHA7F6Bh3Ekyftu8cKR5ZTznqL0+pCvunCC3sGuzMt5Npqx6QHxwij9qaOpozX3IeIy +757BRQas+BkGtUcYLLas+KgBLeXhtV+pgOes+D4sZvmShKZR8en5It5ElBTHmXVRuio D2m9AJuTq2VtqhqSH6zMHwUij/EmBruz6XIrUAFRSnXea1r9wdUjhPJBLiiliRZFIkz7 3nuOoUlbD2rxF8IkePNBR1hDOjKn2cP/L0d7QrMDtpVcvHZFwInZY6H4pb1G8pTkoADY BaQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B4S12Xk+G0sVvge35t3DrdHqorCDNM+5tSm0oZ3c3ws=; b=A5EcV+NboZbu4R5BbN8n2Bub5oipmFz2wp69JCL4EODsSH7VBAWUqd4VDQH5BP4hU5 PGOBE8SIH0Lo5z2SIpD03kxXi8AUSxy0lYZtdbmBVwfVflTLgurhr/Y8DFwCtxI6H+z3 I5+iwAKwfqY8ZvtgYnSUoKu1Lq5EIf8Xp454azx15W8qRTq300p3QjzWLn8cgwUaBQz4 Ie6jlrYJ5HxB5YyhRnZ3WXBXUDDLr+7kMlA6Yj4YudBELB4K+pCOazvBTcnRbuludttW P9Q+P209HuGjB3nmDpS8SNTipI7Y3TXFp0AtN/MOy4Od2c4MKH8nFKXw9cKkpsBdPv4U RUxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rfQWcmsI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si272946plu.126.2019.08.14.10.27.03; Wed, 14 Aug 2019 10:27:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rfQWcmsI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729274AbfHNR0d (ORCPT + 99 others); Wed, 14 Aug 2019 13:26:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729275AbfHNREj (ORCPT ); Wed, 14 Aug 2019 13:04:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8ABBA2084D; Wed, 14 Aug 2019 17:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802279; bh=+bHoaEyut0jt8XpJIrpUFxCbGOTtiDFobi2WIvPHMWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfQWcmsIqysVZLCjNe/TXNZTnI4azphL8ZpW/sV1bzCS1/kf88wlaiQ0dqj9LOmcN LtGLczMwgKnyU4Pm259ZvcHvTj5KJTNhjB8Jh1m7IWs1Q2HV65c2UIOgXGn3cyzFxR fsGYQuFEFHr9s2zc+A8iA8TEV+9NrogvH7Pd4b9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laura Garcia Liebana , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.2 056/144] netfilter: nft_hash: fix symhash with modulus one Date: Wed, 14 Aug 2019 19:00:12 +0200 Message-Id: <20190814165802.173677704@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- 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 fe93e731dc7fb..b836d550b9199 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.20.1