Skip to content

Commit

Permalink
Use gen_linktype() for VLAN EtherType check.
Browse files Browse the repository at this point in the history
Directly using off_linktype to match the VLAN EtherType only
works for basic Ethernet cases. Instead we can use gen_linktype()
which is more general and is more likely to be updated to handle
future protocols.
  • Loading branch information
jessegross authored and guyharris committed Feb 6, 2015
1 parent 16201f0 commit a444868
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Additional people who have contributed patches:
Jefferson Ogata <jogata at nodc dot noaa dot gov>
Jesper Dangaard Brouer <hawk at comx dot dk>
Jesper Peterson <jesper at endace dot com>
Jesse Gross <jesse at nicira dot com>
Jiri Slaby <jirislaby at gmail dot com>
Joerg Mayer <jmayer at loplof dot de>
John Bankier <jbankier at rainfinity dot com>
Expand Down
6 changes: 2 additions & 4 deletions gencode.c
Original file line number Diff line number Diff line change
Expand Up @@ -8082,10 +8082,8 @@ gen_vlan_no_bpf_extensions(int vlan_num)
struct block *b0, *b1;

/* check for VLAN, including QinQ */
b0 = gen_cmp(OR_LINK, off_linktype, BPF_H,
(bpf_int32)ETHERTYPE_8021Q);
b1 = gen_cmp(OR_LINK, off_linktype, BPF_H,
(bpf_int32)ETHERTYPE_8021QINQ);
b0 = gen_linktype(ETHERTYPE_8021Q);
b1 = gen_linktype(ETHERTYPE_8021QINQ);
gen_or(b0,b1);
b0 = b1;

Expand Down

0 comments on commit a444868

Please sign in to comment.