On 5/20/26 1:42 PM, David Marchand wrote: > On Wed, 20 May 2026 at 13:09, Robin Jarry <[email protected]> wrote: >>>> - } else if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ)) { >>>> - const struct rte_vlan_hdr *vh; >>>> - struct rte_vlan_hdr vh_copy; >>>> + if (proto == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) >>>> + pkt_type = RTE_PTYPE_L2_ETHER_VLAN; >>>> + else >>>> + pkt_type = RTE_PTYPE_L2_ETHER_QINQ; >>>> + >>>> + do { >>>> + vh = rte_pktmbuf_read(m, off, sizeof(*vh), >>>> &vh_copy); >>>> + if (unlikely(vh == NULL)) >>>> + return pkt_type; >>> >>> Kevin noted that it is weird to report back some packet type when the >>> packet is malformed. >>> Maybe return RTE_PTYPE_UNKNOWN here so that the application is forced >>> to validate the packet? (it should already be doing it, in any >>> case..). >> >> If we do this, we need to fix it in the entire function. There are >> several other places where the "current" value of pkt_type is returned >> on error. > > There is this point and the code has been behaving like this for > years, so some applications may have been relying on this behavior. > I don't mind leaving as is. > >
I can agree with Hyrum's law :-) https://xkcd.com/1172/

