*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.26 2005-07-11 13:58:52 hannes Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.27 2005-07-14 16:01:46 hannes Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
{
struct block *b0, *b1, *b2;
+ /* has the linktype been poisoned by MPLS expression ? */
+ if (off_linktype == (u_int)-1) {
+ switch(proto) {
+ /* FIXME add other L3 proto IDs */
+ case ETHERTYPE_IP:
+ case PPP_IP:
+ return gen_null(Q_IP);
+ /* FIXME add other L3 proto IDs */
+ case ETHERTYPE_IPV6:
+ case PPP_IPV6:
+ return gen_null(Q_IPV6);
+ default:
+ bpf_error("unsupported protocol over mpls");
+ /* NOTREACHED */
+ }
+ }
+
switch (linktype) {
case DLT_EN10MB:
default:
abort();
}
- if (off_linktype != (u_int)-1)
- b0 = gen_linktype(proto);
- else
- b0 = gen_null(Q_IP);
+ b0 = gen_linktype(proto);
b1 = gen_mcmp(OR_NET, offset, BPF_W, (bpf_int32)addr, mask);
gen_and(b0, b1);
return b1;
break;
case Q_IP:
- if (off_linktype != (u_int)-1)
- b1 = gen_linktype(ETHERTYPE_IP);
- else
- b1 = gen_null(Q_IP);
+ b1 = gen_linktype(ETHERTYPE_IP);
break;
case Q_ARP:
* So we always check for ETHERTYPE_IP.
*/
- if (off_linktype != (u_int)-1)
- b0 = gen_linktype(ETHERTYPE_IP);
- else
- b0 = gen_null(Q_IP);
+ b0 = gen_linktype(ETHERTYPE_IP);
#ifndef CHASE_CHAIN
b1 = gen_cmp(OR_NET, 9, BPF_B, (bpf_int32)v);
#else