Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] The patch fixes VLAN metadata that userspace sees, but the commit has no Fixes: tag. - [Low] The commit message says the is_vlan_dev() fallback in vlan_get_tci() 'has been obsolete since commit 447cbe95ebb9'. -- packet: use Ethernet header length in vlan_get_tci() This commit makes vlan_get_tci() read the outer VLAN header at ETH_HLEN, and only for ARPHRD_ETHER and ARPHRD_LOOPBACK devices. The helper now returns whether a TCI was extracted. tpacket_rcv(), prb_fill_vlan_info() and packet_recvmsg() only set the VLAN valid flags when it was, and packet_recvmsg() no longer looks up the device under RCU.
> vlan_get_tci() uses dev->min_header_len to locate the outer 802.1Q/AD > header on SOCK_DGRAM captures, with an is_vlan_dev() fallback that has > been obsolete since commit 447cbe95ebb9 ("vlan: fix skb_under_panic and > races when toggling HW VLAN offload") stopped adding VLAN_HLEN to > vlandev->hard_header_len.
[Severity: Low] Is the is_vlan_dev() fallback really obsolete since 447cbe95ebb9? A VLAN device still inherits hard_header_len from its lower device: net/8021q/vlan_dev.c:vlan_dev_init() { ... dev->hard_header_len = real_dev->hard_header_len; ... } vlan_transfer_features() does the same thing: vlandev->hard_header_len = dev->hard_header_len; vlan_setup() calls ether_setup(), so min_header_len stays at ETH_HLEN. Some lower Ethernet devices have a hard_header_len larger than ETH_HLEN. smsc95xx is one: drivers/net/usb/smsc95xx.c:smsc95xx_bind() { ... dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; ... } rndis_host is another. For a VLAN device on top of one of these, min_header_len != hard_header_len, so the old vlan_get_tci() still took the is_vlan_dev() branch to get header_len = ETH_HLEN. The new code that reads at ETH_HLEN gives the right result either way, so only the explanation is affected. Could the wording be changed so backporters don't read it as a dependency on 447cbe95ebb9? [ ... ]
> This changes the reported VLAN metadata in three cases: > > - Ethernet devices with hard_header_len != ETH_HLEN (e.g., smsc95xx, > rndis_host) previously failed the min_header_len == hard_header_len > test and reported TCI 0. They now report the actual TCI. > - Non-Ethernet devices and frames without an extractable VLAN header > previously still set TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID: > headerless devices (e.g., tun, rmnet) matched 0 == 0 and read payload > bytes at offset 0 as TCI, while other non-Ethernet devices and > truncated frames reported TCI 0. They now omit VLAN metadata and flags. > - packet_recvmsg() previously omitted the VLAN fields if the device > had been unregistered since the packet was queued. It now fills > them from the queued skb. > > Signed-off-by: Willem de Bruijn <will…@google.com>
[Severity: Low] The first two cases fix wrong VLAN metadata that userspace sees, so should this have a Fixes: tag? Two pieces of code come from 79eecf631c14. One is the min_header_len / hard_header_len / is_vlan_dev() logic in vlan_get_tci(). The other is the code in tpacket_rcv(), prb_fill_vlan_info() and packet_recvmsg() that sets TP_STATUS_VLAN_VALID | TP_STATUS_VLAN_TPID_VALID whatever vlan_get_tci() returns. The old return value of 0 could not be told apart from a valid TCI of 0. Fixes: 79eecf631c14 ("af_packet: Handle outgoing VLAN packets without hardware offloading") Since that commit, a SOCK_DGRAM capture of software-tagged VLAN traffic on smsc95xx reports TCI 0 with the valid flags set. Headerless devices report payload bytes as the TCI, also with the valid flags set. Without the tag, stable trees that carry 79eecf631c14 have nothing pointing them at this fix. The subject "use Ethernet header length in vlan_get_tci()" and the "removing the last min_header_len reader" framing also read like a refactor rather than a fix for wrong output.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40google.com