Some filters (such as VLAN) increment off_macpl as they are parsed.
In the fixed MAC header case, this is handled properly since it is
simply incorporated into the header length. However, currently with
variable length headers we only look at the variable component and ignore
the fixed part, so the VLAN stack can't be handled.
This includes both pieces for variable headers; in cases where there
are no VLAN filters, off_macpl is zero so things still work.
* for example, any 802.2 LLC header, so it's the MAC-layer
* portion of that header), plus any prefix preceding the
* link-layer header.
+ *
+ * In the event of a variable length MAC header, this is typically
+ * 0. However, it can be used as a fixed component added to the
+ * variable piece, such as in the case of a VLAN increasing the size
+ * of the header.
*/
static u_int off_macpl;
* as an offset.
*/
s2 = new_stmt(BPF_LD|BPF_IND|size);
- s2->s.k = offset;
+ s2->s.k = off_macpl + offset;
sappend(s, s2);
} else {
/*