From: Ajit Khaparde Date: Wed, 2 Oct 2019 23:25:51 +0000 (-0700) Subject: net/bnxt: allow only unicast MAC address filter creation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=407244800389;p=dpdk.git net/bnxt: allow only unicast MAC address filter creation 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 --- diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 2e2b21deff..4e6b4d7fce 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -219,6 +219,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 ? @@ -233,6 +241,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 ?