From 08fbef913ea74523fe1957541d85083c5ca08d02 Mon Sep 17 00:00:00 2001 From: hannes Date: Mon, 11 Jul 2005 13:58:52 +0000 Subject: [PATCH] bugreport from Paolo Lucente : -catch the case where the expression is "mpls && vlan" or a similar mutation and generate an error - contrary "vlan && mpls" is perfectly fine; --- gencode.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gencode.c b/gencode.c index 429e712..4bd3c7d 100644 --- a/gencode.c +++ b/gencode.c @@ -21,7 +21,7 @@ */ #ifndef lint 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 #ifdef HAVE_CONFIG_H @@ -6219,7 +6219,7 @@ struct block * gen_vlan(vlan_num) int vlan_num; { - struct block *b0; + struct block *b0,*b1; /* * Change the offsets to point to the type and data fields within @@ -6269,12 +6269,13 @@ gen_vlan(vlan_num) } /* 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 (vlan_num >= 0) { - struct block *b1; - b1 = gen_mcmp(OR_LINK, orig_nl, BPF_H, (bpf_int32)vlan_num, 0x0fff); gen_and(b0, b1);