DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix a error in ACL parser
@ 2020-10-23  9:32 Simei Su
  0 siblings, 0 replies; only message in thread
From: Simei Su @ 2020-10-23  9:32 UTC (permalink / raw)
  To: qi.z.zhang, qiming.yang; +Cc: dev, beilei.xing, Simei Su

A ACL rule with only mask not spec is invalid. This patch corrects
incomplete implementation in parsing ACL pattern.

Fixes: d623d798c7e6 ("net/ice: support ACL filter in DCF")

Signed-off-by: Simei Su <simei.su@intel.com>
---
 drivers/net/ice/ice_acl_filter.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_acl_filter.c b/drivers/net/ice/ice_acl_filter.c
index ca483f0..0915d50 100644
--- a/drivers/net/ice/ice_acl_filter.c
+++ b/drivers/net/ice/ice_acl_filter.c
@@ -710,7 +710,8 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 					return -rte_errno;
 				}
 
-				if (ipv4_mask->hdr.src_addr) {
+				if (ipv4_spec->hdr.src_addr &&
+				    ipv4_mask->hdr.src_addr) {
 					filter->input.ip.v4.src_ip =
 						ipv4_spec->hdr.src_addr;
 					filter->input.mask.v4.src_ip =
@@ -719,7 +720,8 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 					input_set |= ICE_INSET_IPV4_SRC;
 				}
 
-				if (ipv4_mask->hdr.dst_addr) {
+				if (ipv4_spec->hdr.dst_addr &&
+				    ipv4_mask->hdr.dst_addr) {
 					filter->input.ip.v4.dst_ip =
 						ipv4_spec->hdr.dst_addr;
 					filter->input.mask.v4.dst_ip =
@@ -755,6 +757,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 				}
 
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    tcp_spec->hdr.src_port &&
 				    tcp_mask->hdr.src_port) {
 					input_set |= ICE_INSET_TCP_SRC_PORT;
 					filter->input.ip.v4.src_port =
@@ -764,6 +767,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 				}
 
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    tcp_spec->hdr.dst_port &&
 				    tcp_mask->hdr.dst_port) {
 					input_set |= ICE_INSET_TCP_DST_PORT;
 					filter->input.ip.v4.dst_port =
@@ -792,6 +796,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 				}
 
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    udp_spec->hdr.src_port &&
 				    udp_mask->hdr.src_port) {
 					input_set |= ICE_INSET_UDP_SRC_PORT;
 					filter->input.ip.v4.src_port =
@@ -801,6 +806,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 				}
 
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    udp_spec->hdr.dst_port &&
 				    udp_mask->hdr.dst_port) {
 					input_set |= ICE_INSET_UDP_DST_PORT;
 					filter->input.ip.v4.dst_port =
@@ -819,6 +825,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 			if (sctp_spec && sctp_mask) {
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    sctp_spec->hdr.src_port &&
 				    sctp_mask->hdr.src_port) {
 					input_set |= ICE_INSET_SCTP_SRC_PORT;
 					filter->input.ip.v4.src_port =
@@ -828,6 +835,7 @@ ice_acl_parse_pattern(__rte_unused struct ice_adapter *ad,
 				}
 
 				if (l3 == RTE_FLOW_ITEM_TYPE_IPV4 &&
+				    sctp_spec->hdr.dst_port &&
 				    sctp_mask->hdr.dst_port) {
 					input_set |= ICE_INSET_SCTP_DST_PORT;
 					filter->input.ip.v4.dst_port =
-- 
2.9.5


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-23  9:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-23  9:32 [dpdk-dev] [PATCH] net/ice: fix a error in ACL parser Simei Su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).