From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1BAB4A32A1 for ; Thu, 24 Oct 2019 09:54:17 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50A671DFEE; Thu, 24 Oct 2019 09:52:59 +0200 (CEST) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id D5EB91D414 for ; Thu, 24 Oct 2019 09:52:32 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id B73D81B44E7; Thu, 24 Oct 2019 00:52:31 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com B73D81B44E7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1571903552; bh=6y6SvyfHsZibfx4SDZsdftvxVpxfJjtZ+6pYPpKA/Wg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqkR9OBhfTF9wdc+7a/SXnUMzEAwrh5ikn1LH0J2iQjNeVw0zCDU6FC8qJz0vC6Ot w1AAiYM+GA5ifvT+n1BDBW7Ovh02Y5XqE0cmmiynepIL1GTC/rhzsrG7wzvd9Ro9g/ VJIGshrQp1ikYHon8Zjo8vK67iBV0UpvwAxM6yHI= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Thu, 24 Oct 2019 13:14:26 +0530 Message-Id: <20191024074432.30705-12-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20191024074432.30705-1-somnath.kotur@broadcom.com> References: <20191024074432.30705-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 11/17] net/bnxt: fix to check for zero mac address while parsing flow arguments X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add another check to flag zero mac address while validating/parsing the flow arguments Fixes: 74defda79 ("net/bnxt: allow only unicast MAC address filter creation") Reviewed-by: Venkat Duvvuru Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt_flow.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 2bde6f7..cad232a 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -136,6 +136,7 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, const struct rte_flow_item_tcp *tcp_spec, *tcp_mask; const struct rte_flow_item_udp *udp_spec, *udp_mask; const struct rte_flow_item_eth *eth_spec, *eth_mask; + const struct rte_ether_addr *dst, *src; const struct rte_flow_item_nvgre *nvgre_spec; const struct rte_flow_item_nvgre *nvgre_mask; const struct rte_flow_item_gre *gre_spec; @@ -226,12 +227,15 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, } if (rte_is_broadcast_ether_addr(ð_mask->dst)) { - if (!rte_is_unicast_ether_addr(ð_spec->dst)) { + dst = ð_spec->dst; + if (!rte_is_valid_assigned_ether_addr(dst)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "DMAC is invalid"); + PMD_DRV_LOG(ERR, + "DMAC is invalid!\n"); return -rte_errno; } rte_memcpy(filter->dst_macaddr, @@ -246,14 +250,16 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, PMD_DRV_LOG(DEBUG, "Creating a priority flow\n"); } - if (rte_is_broadcast_ether_addr(ð_mask->src)) { - if (!rte_is_unicast_ether_addr(ð_spec->src)) { + src = ð_spec->src; + if (!rte_is_valid_assigned_ether_addr(src)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, "SMAC is invalid"); + PMD_DRV_LOG(ERR, + "SMAC is invalid!\n"); return -rte_errno; } rte_memcpy(filter->src_macaddr, -- 2.10.1.613.g2cc2e70