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 54A70A2E1B for ; Tue, 3 Sep 2019 04:20:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 98F2F1EB06; Tue, 3 Sep 2019 04:19:27 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id CF8491E980 for ; Tue, 3 Sep 2019 04:19:08 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 44D2F30C1FD; Mon, 2 Sep 2019 19:19:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 44D2F30C1FD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1567477141; bh=D8B2YgK6G0JGKi0HAoS0sIeGNkcfIGE5L75i0b3PiUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPOf/fbWKlLr8xykkydKG06M/8wjNh34i6h0GirMe7JQWztfCImO46L9yjSTxLyn2 vOQ9H6XCg/otnpE/xwcn19APulVa2wPgj9DGfxqvz/m5igtGJQaz6oZj57Sp5TNHas xwh2R0jZP1CRgMEv4QmM+I7z2IeA4VQubB4uHCVQ= Received: from localhost.localdomain (unknown [10.230.30.225]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id A76F9AC06AB; Mon, 2 Sep 2019 19:19:07 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Rahul Gupta , Santoshkumar Karanappa Rastapur Date: Mon, 2 Sep 2019 19:18:53 -0700 Message-Id: <20190903021901.25895-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190903021901.25895-1-ajit.khaparde@broadcom.com> References: <20190903021901.25895-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 09/17] net/bnxt: allow only unicast MAC address filter creation 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" Check if the application is trying to create filters using broadcast and multicast MAC address and reject it. Signed-off-by: Ajit Khaparde Reviewed-by: Rahul Gupta Reviewed-by: Santoshkumar Karanappa Rastapur --- drivers/net/bnxt/bnxt_flow.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index aed822ee3..578081890 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -217,6 +217,14 @@ 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)) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "DMAC is invalid"); + return -rte_errno; + } rte_memcpy(filter->dst_macaddr, ð_spec->dst, RTE_ETHER_ADDR_LEN); en |= use_ntuple ? @@ -231,6 +239,14 @@ bnxt_validate_and_parse_flow_type(struct bnxt *bp, } if (rte_is_broadcast_ether_addr(ð_mask->src)) { + if (!rte_is_unicast_ether_addr(ð_spec->src)) { + rte_flow_error_set(error, + EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "SMAC is invalid"); + return -rte_errno; + } rte_memcpy(filter->src_macaddr, ð_spec->src, RTE_ETHER_ADDR_LEN); en |= use_ntuple ? -- 2.20.1 (Apple Git-117)