Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Gabriel Goller
Wed, 11 Nov 2026 17:37
[PATCH RFC net 0/3] net: fix stacked VLAN header corruption in TX offloads and OVS
Author: Gabriel Goller
Date: Wed, 11 Nov 2026 17:37
Date: Wed, 11 Nov 2026 17:37
61 lines
10249 bytes
10249 bytes
Since commit 938863727076 ("tc: adjust network header after 2nd vlan
push"), a second VLAN push leaves network_header pointing to the
in-band VLAN header. The igb driver TSO and OVS IP set actions still
expect the L3 header, so they write to the VLAN header and corrupt
the packet. Patch 1 restores the L3 header in validate_xmit_skb() for
CHECKSUM_PARTIAL packets, which covers packets tagged by tc or BPF.
Patch 2 restores it in OVS right after the push, before later actions
run. Patch 3 adds a KUnit test. tc classification after a push keeps
working.
The kernel uses two conventions for skb->network_header when a packet
carries an in-band VLAN tag:
* network_header points at the L3 header
* network_header points at the in-band VLAN header
Since commit 938863727076 ("tc: adjust network header after 2nd vlan
push"), skb_vlan_push() uses the second convention when it pushes a
second tag. The flow dissector, and so tc flower, needs that layout to
classify the packet after the push. Drivers doing TSO or checksum
offload expect the first one. vlan_features_check() clears TSO for
multi-tagged packets, so most drivers fall back to software GSO, which
finds the L3 header itself. igb keeps TSO for these packets and reads
the IP header at skb->network_header, so it builds the TSO context from
the VLAN header and corrupts the packet. OVS set actions after a second
push write to the wrong header in the same way.
Which convention should a packet with in-band VLAN tags follow? This
series keeps the tc layout, converts to L3 in validate_xmit_skb() for
CHECKSUM_PARTIAL packets, and restores L3 right after the push in OVS.
If L3 should hold everywhere instead, the flow dissector would need to
find in-band tags from mac_len, and skb_vlan_push() could go back to
its old behavior.
We hit this in production with VLAN-tagged traffic forwarded by OVS out
of an igb NIC. The bug was actually triggered, not just found by
code inspection.
Link: https://bugzilla.proxmox.com/show_bug.cgi?id=8318
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
Gabriel Goller (3):
net: restore the L3 header before VLAN TX offload checks
openvswitch: preserve the L3 header after stacked VLAN pushes
net: test stacked VLAN headers before TX offloads
net/core/dev.c | 17 +++
net/core/net_test.c | 145 +++++++++++++++++++++
net/openvswitch/actions.c | 6 +-
.../selftests/net/openvswitch/openvswitch.sh | 34 +++++
4 files changed, 201 insertions(+), 1 deletion(-)
---
base-commit: 8d5ce4751fad9499ea408163af7f410f18a85782
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git main
change-id: 20261111-net_restore_the-59b5fb335fe3
Best regards,
--
Gabriel Goller <g.goller@proxmox.com>
Re: [PATCH RFC net 0/3] net: fix stacked VLAN header corruption in TX offloads and OVS
Author: Gabriel Goller
Date: Mon, 23 Nov 2026 15:35
Date: Mon, 23 Nov 2026 15:35
55 lines
10131 bytes
10131 bytes
On 11.11.2026 19:33, Ilya Maximets wrote:
> On 11/11/26 6:37 PM, Gabriel Goller wrote:
> > Since commit 938863727076 ("tc: adjust network header after 2nd vlan
> > push"), a second VLAN push leaves network_header pointing to the
> > in-band VLAN header. The igb driver TSO and OVS IP set actions still
> > expect the L3 header, so they write to the VLAN header and corrupt
> > the packet. Patch 1 restores the L3 header in validate_xmit_skb() for
> > CHECKSUM_PARTIAL packets, which covers packets tagged by tc or BPF.
> > Patch 2 restores it in OVS right after the push, before later actions
> > run. Patch 3 adds a KUnit test. tc classification after a push keeps
> > working.
> >
> > The kernel uses two conventions for skb->network_header when a packet
> > carries an in-band VLAN tag:
> >
> > * network_header points at the L3 header
> > * network_header points at the in-band VLAN header
> >
> > Since commit 938863727076 ("tc: adjust network header after 2nd vlan
> > push"), skb_vlan_push() uses the second convention when it pushes a
> > second tag. The flow dissector, and so tc flower, needs that layout to
> > classify the packet after the push. Drivers doing TSO or checksum
> > offload expect the first one. vlan_features_check() clears TSO for
> > multi-tagged packets, so most drivers fall back to software GSO, which
> > finds the L3 header itself. igb keeps TSO for these packets and reads
> > the IP header at skb->network_header, so it builds the TSO context from
> > the VLAN header and corrupts the packet. OVS set actions after a second
> > push write to the wrong header in the same way.
> >
> > Which convention should a packet with in-band VLAN tags follow? This
> > series keeps the tc layout, converts to L3 in validate_xmit_skb() for
> > CHECKSUM_PARTIAL packets, and restores L3 right after the push in OVS.
> > If L3 should hold everywhere instead, the flow dissector would need to
> > find in-band tags from mac_len, and skb_vlan_push() could go back to
> > its old behavior.
>
> IMO, having 'network_header' pointing to something that is not a network
> layer doesn't make much sense, and having two separate meanings for the
> same field is a recipe for more issues introduced or discovered later.
> Others may, of course, disagree.
I agree, a full implementation would have to revert:
938863727076 ("tc: adjust network header after 2nd vlan push")
then change the flow-dissector to not rely on network_header and find the
in-band vlan tags itself.
@Boris maybe?
> Best regards, Ilya Maximets.
Thanks,
Gabriel
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads