🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14638

[PATCH RFC net 1/3] net: restore the L3 header before VLAN TX offload checks

#14638
From: Gabriel Goller
Date: Wed, 11 Nov 2026 17:37
72 lines
10094 bytes
A second VLAN push leaves network_header pointing at an in-band VLAN
header. Drivers such as igb can interpret those bytes as an IP header
when preparing TSO and corrupt the packet.

Restore the L3 header before offload feature checks for VLAN-tagged
CHECKSUM_PARTIAL packets. Keep the generic skb_vlan_push() layout intact
because tc classification after a push depends on it.

This fix belongs in the common TX path because packets tagged by tc or
BPF do not pass through OVS actions. Keep it separate from the OVS fix:
OVS must preserve L3 before executing subsequent actions, including on
packets without checksum offload. TX validation cannot repair corruption
that has already occurred in an action, whether in OVS or tc.

validate_xmit_skb() also runs on noqueue upper devices such as bond,
team or macvlan. For CHECKSUM_PARTIAL packets tagged above such a
device, network_header then sits at L3 while skb->protocol is still a
VLAN type. The flow dissector parses the IP header as a VLAN header in
that state, which affects bond layer3+4 hashing and tc flower on the
lower device's egress. Bridged packets already get the same conversion
in br_dev_queue_push_xmit() since commit df356d5e81b0 ("bridge: Fix
network header pointer for vlan tagged packets").

The IPv4/IPv6 KUnit reproducer fails without this fix and passes with it.
All 22 enabled net_core KUnit cases and software tc_actions and tc_flower
tests pass in QEMU. Actual igb hardware TSO has not been tested.

Fixes: 938863727076 ("tc: adjust network header after 2nd vlan push")
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 net/core/dev.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 3c58db732761..fa47fe60b444 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4219,6 +4219,20 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
 		     !(skb_shinfo(skb)->gso_type & SKB_GSO_FRAGLIST)))
 		skb->ip_summed = CHECKSUM_NONE;
 
+	/* VLAN actions may leave network_header at an in-band VLAN header.
+	 * Hardware checksum and segmentation offloads need the L3 header.
+	 */
+	if (skb->ip_summed == CHECKSUM_PARTIAL &&
+	    eth_type_vlan(skb->protocol)) {
+		int depth;
+
+		if (!vlan_get_protocol_and_depth(skb, skb->protocol, &depth))
+			goto out_unhandled_proto;
+
+		skb_set_network_header(skb, depth);
+		skb_reset_mac_len(skb);
+	}
+
 	features = netif_skb_features(skb);
 	skb = validate_xmit_vlan(skb, features);
 	if (unlikely(!skb))
@@ -4267,6 +4281,9 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device
 
 	return skb;
 
+out_unhandled_proto:
+	kfree_skb_reason(skb, SKB_DROP_REASON_UNHANDLED_PROTO);
+	goto out_null;
 out_kfree_skb:
 	kfree_skb(skb);
 out_null:

-- 
2.47.3
Technical Details
Message-ID: <20261111-net_restore_the-v1-1-6aaeffa601c9@proxmox.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361205-linux-kernel-netdev=dewy.ru
References: <20261111-net_restore_the-v1-0-6aaeffa601c9@proxmox.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361205-linux-kernel-netdev=dewy.ru
From: g.goller@proxmox.com (Gabriel Goller)
Newsgroups: linux.kernel.netdev
Subject: [PATCH RFC net 1/3] net: restore the L3 header before VLAN TX
 offload checks
Date: Wed, 11 Nov 2026 18:37:49 +0100
Organization: Usenet Network
Message-ID: <20261111-net_restore_the-v1-1-6aaeffa601c9@proxmox.com>
References: <20261111-net_restore_the-v1-0-6aaeffa601c9@proxmox.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="909224"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ESOb4/S/UJwnu+VBIULVh3tEbds= sha256:3TjxBMeNmR0rOxSmXe7sX6AEs3aDMzNlhtPAA/2i4IQ=
	sha1:42kDM7TEYa/Xq+H6b/pXD8JptwA= sha256:KUxBWydfBCzR+F73pLAwy/CCrLZcvBLKurikgQmoJrs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 87C27113F7E; Wed, 11 Nov 2026 21:18:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 5dpn1OlHV17z;
	Wed, 11 Nov 2026 21:18:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-361205-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 999AC113F7C; Wed, 11 Nov 2026 21:18:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 0D7251403B4; Wed, 11 Nov 2026 17:39:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794418729;
	b=uHAeuJZfDjesZP7ZYBeveBymelCVHcMb0p5AOEdUuRRVbP/nqLhdzF/sQo2d/XODI6Qf
	 fw4YIRQwWVTOqWUbhHmgbTgPLe3dNos/Yi3bCAwuDfC+ckRHXDjFkCt0NuWXyQmB5KwKV
	 u2BN6Mloia6W+OBcrFw26tTEo2EKdag4cf5mTYQBjU+IJuEwVv3Kvmyux48MNZuHoHzqN
	 B5K3IigwpaRd1PL61LUxVnZ0H1sI+YiD/ioYvamNF80WGrKZb05VDhStJ8zt4c66J4pc+
	 gDoeZnjrGZw5ZIHQUbIv+2qv50tQs2ZcxuCx921dE1RRudjhzwIP9pNSheG5uGTbhmA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794418729;
	h=X-Original-To:Received:DMARC-Filter:Received:From:Date:Subject:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Bm-Milter-Handled:X-Bm-Transport-Timestamp;
	bh=E7m3c8vNY4e9niQFNFPSTIwQ27u9U/34uB1xD6ktbVE=;
	b=yKkJEPXVZmfq8d3w5S3DEunVVk+Y8e4gIfddk/BP12Rf6S62VjW8mWCr6tn+EE5DU0fH
	 5ibnJf1yIeF4pjcHtuSYmBMfPz4t8+lGE2WC2w8lBW3SyyfjfFGBoM/ULnKTONqbYom42
	 W+JVewbbDgnDh0q3BhGZNjE8vGkF2d0iy9CtUm7exi96Z0KS29bMSQ1s5zO/Ee3gPr4e4
	 ARe+huMg0tNZkQ7f3vFlvSICv0eiGiJsFjx4UkotNMNV3dxcdzroCepZIDKQmyo7nUfGj
	 y00H2rIGhqVwpGRNWIYJKL6RAkHt+5l7MfCwLgLUT8oHUql2B38KRsDz85hk909SAUg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=proxmox.com;
	spf=pass smtp.mailfrom=proxmox.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id BF288606A8B0;
	Wed, 11 Nov 2026 17:38:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=94.136.29.106
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794418729;
	b=VnDqDeh7Cqs2P/OSwSOiOkSWGalZhShJM8iSJ1cRbbmZtodYeH9snV+Y6YnGyH5bvZJ6
	 JFvbL2jjd0ExcQVzWxGhz7LbBTSOUkBCKJ9W/efwCGaQN8iY2drMoYTJeKaNg7LXlsKRh
	 58ddTid8HoyPlow09jp13HDRydrIyMf5rJ3G098cfcuj1PqarwsBexvUJZB1Zfl7VsPgm
	 V+I6uqNFOBbZgW3kt+Luw4DhGalc/R2dhkiv0WG03piaGhvZ84alghOwX7OEopqw+y/wP
	 SJvsDguPc6iECCea3iyvtGy+u/yf3jhNJKRmKL1dxGt3z8cnkGFQuhmvspvY6d0dXpw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794418729;
	h=DMARC-Filter:Received:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Bm-Milter-Handled:X-Bm-Transport-Timestamp;
	bh=E7m3c8vNY4e9niQFNFPSTIwQ27u9U/34uB1xD6ktbVE=;
	b=XuoLHEYLxbRXFvNwmCXmMTQYgjDfY8Bm/hSlVOSh9Q+V21t4m6ogJgpDrX5vgZeZDq9Q
	 Rof1Q4Kjt6+wB9r1f+uIp/xGE1ePJor7pjgfuKPkyZjc0M9Tsqjxofd4TpuqS2FR8ZV4j
	 h5fsCJagU1ue39g5SIBzrpKvAZB9udYPZF1G+tD+3IC0vRPoxz7x4TpRL8s2aMpS1kyea
	 pSk+VdE/oYZzvMN0x4YjR7V1TpAANnKJii4LcdGBdGnhgpbt3TbZ9xSGFH9MEYvzSQx6k
	 UYa8y/Uy0hYzPUnrVQdEHk2Zh1wgnVhnmJ3vTetOiIsvdebZml1QIwTEUF2cOmWPC9w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=proxmox.com;
	spf=pass smtp.mailfrom=proxmox.com;
	arc=none smtp.remote-ip=94.136.29.106
X-Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B3CE606A324;
	Wed, 11 Nov 2026 17:38:46 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B3CE606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=proxmox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proxmox.com
X-Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
	by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D0B18482CE;
	Wed, 11 Nov 2026 18:38:44 +0100 (CET)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261111-net_restore_the-v1-0-6aaeffa601c9@proxmox.com>
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
 dev@openvswitch.org, linux-kselftest@vger.kernel.org, 
 Gabriel Goller <g.goller@proxmox.com>
X-Mailer: b4 0.17-dev
X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2
X-Bm-Transport-Timestamp: 1794418723547