dect
/
libpcap
Archived
13
0
Fork 0

bugreport from Paolo Lucente <paolo.lucente@ic.cnr.it>:

-catch the case where the expression is "mpls && vlan" or a similar mutation
   and generate an error - contrary "vlan && mpls" is perfectly fine;
This commit is contained in:
hannes 2005-07-11 13:58:52 +00:00
parent 7ec660f72d
commit 08fbef913e
1 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,7 @@
*/ */
#ifndef lint #ifndef lint
static const char rcsid[] _U_ = static const char rcsid[] _U_ =
"@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.25 2005-07-08 15:27:06 hannes Exp $ (LBL)"; "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.26 2005-07-11 13:58:52 hannes Exp $ (LBL)";
#endif #endif
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
@ -6219,7 +6219,7 @@ struct block *
gen_vlan(vlan_num) gen_vlan(vlan_num)
int vlan_num; int vlan_num;
{ {
struct block *b0; struct block *b0,*b1;
/* /*
* Change the offsets to point to the type and data fields within * Change the offsets to point to the type and data fields within
@ -6269,12 +6269,13 @@ gen_vlan(vlan_num)
} }
/* check for VLAN */ /* check for VLAN */
b0 = gen_cmp(OR_LINK, orig_linktype, BPF_H, (bpf_int32)ETHERTYPE_8021Q); if (orig_linktype != (u_int)-1)
b0 = gen_cmp(OR_LINK, orig_linktype, BPF_H, (bpf_int32)ETHERTYPE_8021Q);
else
bpf_error("no VLAN match after MPLS");
/* If a specific VLAN is requested, check VLAN id */ /* If a specific VLAN is requested, check VLAN id */
if (vlan_num >= 0) { if (vlan_num >= 0) {
struct block *b1;
b1 = gen_mcmp(OR_LINK, orig_nl, BPF_H, (bpf_int32)vlan_num, b1 = gen_mcmp(OR_LINK, orig_nl, BPF_H, (bpf_int32)vlan_num,
0x0fff); 0x0fff);
gen_and(b0, b1); gen_and(b0, b1);