From: Daniel Miller Date: Tue, 7 Jan 2025 18:11:56 +0000 (-0600) Subject: Use correct size for VLAN tag load insn X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/ffcd5b4ec849395f224da02f29855de3d2c3d330?ds=sidebyside Use correct size for VLAN tag load insn Not a true bug, since Linux kernel (net/core/filter.c) forces any load from SKF_AD_VLAN_TAG to a BPF_H width. However, this change makes libpcap code easier to understand. --- diff --git a/gencode.c b/gencode.c index ecee3755..6b0014ac 100644 --- a/gencode.c +++ b/gencode.c @@ -9258,7 +9258,7 @@ gen_vlan_patch_vid_test(compiler_state_t *cstate, struct block *b_vid) sjeq->s.jf = b_vid->stmts; sappend(s, sjeq); - s2 = new_stmt(cstate, BPF_LD|BPF_B|BPF_ABS); + s2 = new_stmt(cstate, BPF_LD|BPF_H|BPF_ABS); s2->s.k = SKF_AD_OFF + SKF_AD_VLAN_TAG; sappend(s, s2); sjeq->s.jt = s2;