Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4825851ybl; Wed, 22 Jan 2020 05:28:03 -0800 (PST) X-Google-Smtp-Source: APXvYqwAStfly5lU0mZWA0baDBYsffNsvWKP9dKx6hTnEPNlV8IJp7KDRbq6zGcpBNIGY+PJ6soJ X-Received: by 2002:aca:814:: with SMTP id 20mr6875134oii.159.1579699683017; Wed, 22 Jan 2020 05:28:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699683; cv=none; d=google.com; s=arc-20160816; b=Wi57mP3troDnjeus0vbq6QScrpZWSfvtMY2sXuJ0HSTCc/JM6iSeIgmTUYgGxsNaW9 uPkUxMo2L0bxkCE9T3uLO7MCq3b7cVhKiatzakB8NU20Qzp3NyFUqHQDo9vE8zvWKEm+ GUFhbUCHPrkVwGJeHz2N23vgpmIDQZ2420JMKuW+ylOwsoxvo2uyLT801GykE4kZVJM4 8WxnHwDytxVN1CGx6lypddKdz/iv/geD3EX+ZtCYq3e+RzuQ4GrtdzlE6FD9egGOxnZK e4rNI8NPwRBxbexRJl1vnOSUK21DnteH0EkCq/miGUmYjBI8sz56MgojEITS98DXKAtK IxcQ== 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=4RiO2z0kRBC38t+EOqwzbQ2yRRzkMm//tx27I2CaGDE=; b=PrsFpIbqFRGwV5GQhYLlESx3rZnJKVUpSAkmPm1LqXD37OD+p9IKxVzQWr1wzGm2SB aIT4FrHR5EC6mN1ZdD67aMpSjOn3zF4ABs0jrMTWttu8z9blpgefTeMhq5VLbL07YLx5 FAOi+Cn4CmPcTH0zl7kjRR53KmoNJzENDzK4g9NeDRb4cGkzePzIr8Uc0csH5C0XXg41 s+4Ypz7hsOtwaWdcetNzKXrqtXIZIeRco3eNSvYywaDqvD9VxgyXId2302na9AryYu6n YRv5zcjlIe+mBI0I3bHHp7+yJf+cMvRlNBYiMQYC+TmmT5MAwaYDC431SD7tLShW/+9m 8JeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cXQDrWY6; 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 j24si23380211otn.110.2020.01.22.05.27.51; Wed, 22 Jan 2020 05:28:03 -0800 (PST) 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=cXQDrWY6; 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 S1730545AbgAVNZw (ORCPT + 99 others); Wed, 22 Jan 2020 08:25:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:46218 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731064AbgAVNZu (ORCPT ); Wed, 22 Jan 2020 08:25:50 -0500 Received: from localhost (unknown [84.241.205.26]) (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 6E9EA24685; Wed, 22 Jan 2020 13:25:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699550; bh=Jnyl6LZcK62BDY0N9K8CcaJUd99p9lmS1tmd49Rfz0E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXQDrWY6yBT9/1V61gQ3mkMwnucx1BR5kLxvJ6zRoH9zkX4t260c3THk5rPQo8CV4 sfyFxXbZqTVqmU1usYE7jOhj7sA6IjR+Rw8T79TZt9MV/wqXUB3f5tsOR1KopAxKgC bd7I0W33MyhFAgeX1AFNj7dhObp4Cxw62Y1OolSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Chan , "David S. Miller" Subject: [PATCH 5.4 150/222] bnxt_en: Fix ipv6 RFS filter matching logic. Date: Wed, 22 Jan 2020 10:28:56 +0100 Message-Id: <20200122092844.466699313@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@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 From: Michael Chan [ Upstream commit 6fc7caa84e713f7627e171ab1e7c4b5be0dc9b3d ] Fix bnxt_fltr_match() to match ipv6 source and destination addresses. The function currently only checks ipv4 addresses and will not work corrently on ipv6 filters. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10991,11 +10991,23 @@ static bool bnxt_fltr_match(struct bnxt_ struct flow_keys *keys1 = &f1->fkeys; struct flow_keys *keys2 = &f2->fkeys; - if (keys1->addrs.v4addrs.src == keys2->addrs.v4addrs.src && - keys1->addrs.v4addrs.dst == keys2->addrs.v4addrs.dst && - keys1->ports.ports == keys2->ports.ports && - keys1->basic.ip_proto == keys2->basic.ip_proto && - keys1->basic.n_proto == keys2->basic.n_proto && + if (keys1->basic.n_proto != keys2->basic.n_proto || + keys1->basic.ip_proto != keys2->basic.ip_proto) + return false; + + if (keys1->basic.n_proto == htons(ETH_P_IP)) { + if (keys1->addrs.v4addrs.src != keys2->addrs.v4addrs.src || + keys1->addrs.v4addrs.dst != keys2->addrs.v4addrs.dst) + return false; + } else { + if (memcmp(&keys1->addrs.v6addrs.src, &keys2->addrs.v6addrs.src, + sizeof(keys1->addrs.v6addrs.src)) || + memcmp(&keys1->addrs.v6addrs.dst, &keys2->addrs.v6addrs.dst, + sizeof(keys1->addrs.v6addrs.dst))) + return false; + } + + if (keys1->ports.ports == keys2->ports.ports && keys1->control.flags == keys2->control.flags && ether_addr_equal(f1->src_mac_addr, f2->src_mac_addr) && ether_addr_equal(f1->dst_mac_addr, f2->dst_mac_addr))