From e7b100e2c7c003964104b4ed7bae09f0a103158e Mon Sep 17 00:00:00 2001 From: Mike Seymour Date: Thu, 8 Jun 2023 17:26:44 +0100 Subject: [PATCH] ON-14927: allow insertion of "ethertype:ARP" filters A wrinkle in the logic of efx_spec_to_ethtool_flow prevented the flow_type being set in this case, so the filter was later rejected. --- src/lib/efhw/ethtool_flow.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/efhw/ethtool_flow.c b/src/lib/efhw/ethtool_flow.c index a1d55e8de..159791d03 100644 --- a/src/lib/efhw/ethtool_flow.c +++ b/src/lib/efhw/ethtool_flow.c @@ -160,16 +160,19 @@ int efx_spec_to_ethtool_flow(const struct efx_filter_spec *src, * ports, addresses etc.) then the handling of MAC addresses should be done * by setting FLOW_MAC_EXT in dst->flow_type and updating dst->h_ext. */ - if( (src->match_flags & EFX_FILTER_MATCH_LOC_MAC) && + if( (src->match_flags & (EFX_FILTER_MATCH_LOC_MAC | + EFX_FILTER_MATCH_ETHER_TYPE)) && !(src->match_flags & (EFX_FILTER_MATCH_IP_PROTO | EFX_FILTER_MATCH_LOC_HOST | EFX_FILTER_MATCH_LOC_PORT)) ) { dst->flow_type = ETHER_FLOW; - memcpy(dst->h_u.ether_spec.h_dest, src->loc_mac, - sizeof(dst->h_u.ether_spec.h_dest)); - memcpy(dst->m_u.ether_spec.h_dest, minus1, - sizeof(dst->m_u.ether_spec.h_dest)); + if( src->match_flags & EFX_FILTER_MATCH_LOC_MAC ) { + memcpy(dst->h_u.ether_spec.h_dest, src->loc_mac, + sizeof(dst->h_u.ether_spec.h_dest)); + memcpy(dst->m_u.ether_spec.h_dest, minus1, + sizeof(dst->m_u.ether_spec.h_dest)); + } if( src->match_flags & EFX_FILTER_MATCH_ETHER_TYPE ) { dst->h_u.ether_spec.h_proto = src->ether_type;