HomeFreeBSD

net: Do not overwrite if_vlan's PCP

Description

net: Do not overwrite if_vlan's PCP

In commit c7cffd65c5d8 the function ether_8021q_frame() was slightly
refactored to use pointer of struct ether_8021q_tag as parameter qtag to
include the new option proto.

It is wrong to write to qtag->pcp as it will effectively change the memory
that qtag points to. Unfortunately the transmit routine of if_vlan parses
pointer of the member ifv_qtag of its softc which stores vlan interface's
PCP internally, when transmitting mbufs that contains PCP the vlan
interface's PCP will get overwritten.

Fix by operating on a local copy of qtag->pcp. Also mark 'struct ether_8021q_tag'
as const so that compilers can pick up such kind of bug.

PR: 273304
Reviewed by: kp
Fixes: c7cffd65c5d85 Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D39505

(cherry picked from commit 838c8c47860a0203130bd558d507a0565a2eba8f)

Details

Provenance
zleiAuthored on Aug 23 2023, 9:48 AM
Reviewer
rGc7cffd65c5d8: Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).
Differential Revision
D39505: net: Do not overwrite if_vlan's PCP
Parents
rGb5a5a06fc012: iir: prevent negative offsets in ioctl
Branches
Unknown
Tags
Unknown