Skip to content

Commit

Permalink
net/ice: fix pattern check in flow director
Browse files Browse the repository at this point in the history
[ upstream commit 01b8739 ]

Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current
code. Thus we need to check each pattern mask. Only zero-mask and
full-mask are allowed to pass the pattern parse, otherwise will
return failure.

Fixes: a631c98 ("net/ice: fix pattern check for flow director parser")

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
  • Loading branch information
junfengg authored and kevintraynor committed Feb 21, 2022
1 parent d422a9c commit 607d564
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/net/ice/ice_fdir_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2038,10 +2038,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
}

/* Mask for IPv4 src/dst addrs not supported */
if (!ipv4_mask->hdr.src_addr &&
if (ipv4_mask->hdr.src_addr &&
ipv4_mask->hdr.src_addr != UINT32_MAX)
return -rte_errno;
if (!ipv4_mask->hdr.dst_addr &&
if (ipv4_mask->hdr.dst_addr &&
ipv4_mask->hdr.dst_addr != UINT32_MAX)
return -rte_errno;

Expand Down Expand Up @@ -2187,10 +2187,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
}

/* Mask for TCP src/dst ports not supported */
if (!tcp_mask->hdr.src_port &&
if (tcp_mask->hdr.src_port &&
tcp_mask->hdr.src_port != UINT16_MAX)
return -rte_errno;
if (!tcp_mask->hdr.dst_port &&
if (tcp_mask->hdr.dst_port &&
tcp_mask->hdr.dst_port != UINT16_MAX)
return -rte_errno;

Expand Down Expand Up @@ -2234,10 +2234,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
}

/* Mask for UDP src/dst ports not supported */
if (!udp_mask->hdr.src_port &&
if (udp_mask->hdr.src_port &&
udp_mask->hdr.src_port != UINT16_MAX)
return -rte_errno;
if (!udp_mask->hdr.dst_port &&
if (udp_mask->hdr.dst_port &&
udp_mask->hdr.dst_port != UINT16_MAX)
return -rte_errno;

Expand Down Expand Up @@ -2279,10 +2279,10 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
}

/* Mask for SCTP src/dst ports not supported */
if (!sctp_mask->hdr.src_port &&
if (sctp_mask->hdr.src_port &&
sctp_mask->hdr.src_port != UINT16_MAX)
return -rte_errno;
if (!sctp_mask->hdr.dst_port &&
if (sctp_mask->hdr.dst_port &&
sctp_mask->hdr.dst_port != UINT16_MAX)
return -rte_errno;

Expand Down

0 comments on commit 607d564

Please sign in to comment.