Re: vlan and bpf

Roy Marples <[email protected]>
Newsgroups gmane.os.netbsd.devel.network
Message-ID <[email protected]>
 ---- On Fri, 15 Dec 2023 18:47:54 +0000  Mouse  wrote --- 
 > Again, I would expect to find it in the packet, bytes [14] and [15]
 > containing the tag and priority, but, depending on the use case, "need"
 > may or may not be appropriate.
 > 
 > If you're stuck with hardware that insists on stripping VLAN tags, IMO
 > the only sane thing is to synthesize the stripped 4 octets for
 > presentation via bpf.

Sane or not, you don't see VLAN tags in Linux BPF.
They move ancillary data such as that to a negative offset (which is invalid in BPF syntax)
https://github.com/torvalds/linux/blob/7acac4b3196caee5e21fb5ea53f8bc124e6a16fc/include/uapi/linux/filter.h#L60

They have more there than just VLAN, so if we feel the urge to do anything more, it might be something to consider.
I'm not advocating for one or the other, just noting it as a datapoint.

Roy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.