The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=3bb09e6b1930b58d9d92aa3f28515114631a1d6b
commit 3bb09e6b1930b58d9d92aa3f28515114631a1d6b Author: Zhenlei Huang <z...@freebsd.org> AuthorDate: 2025-06-21 15:12:29 +0000 Commit: Zhenlei Huang <z...@freebsd.org> CommitDate: 2025-07-07 10:05:10 +0000 ethernet: Set maximum Ethernet header length based on the capability IFCAP_VLAN_MTU Lots of Ethernet drivers fix the header length after ether_ifattach(). Well since the net stack can conclude it based on the capability IFCAP_VLAN_MTU, let the net stack do it rather than individual drivers. Reviewed by: markj, glebius MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D50846 (cherry picked from commit 6ce8fd1978a9526ff0dc02ed98ef797f9154ec1f) --- sys/net/if_ethersubr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 9210f1378666..baf3a27c2e7e 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -997,7 +997,8 @@ ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) struct sockaddr_dl *sdl; ifp->if_addrlen = ETHER_ADDR_LEN; - ifp->if_hdrlen = ETHER_HDR_LEN; + ifp->if_hdrlen = (ifp->if_capabilities & IFCAP_VLAN_MTU) != 0 ? + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN : ETHER_HDR_LEN; ifp->if_mtu = ETHERMTU; if_attach(ifp); ifp->if_output = ether_output;