bpf_error(cstate, "syntax error in filter expression");
}
+static PCAP_NORETURN_DEF void
+fail_kw_on_dlt(compiler_state_t *cstate, const char *keyword)
+{
+ bpf_error(cstate, "'%s' not supported on %s", keyword,
+ pcap_datalink_val_to_description_or_dlt(cstate->linktype));
+}
+
int
pcap_compile(pcap_t *p, struct bpf_program *program,
const char *buf, int optimize, bpf_u_int32 mask)
IEEE80211_FC0_TYPE_MASK);
default:
- bpf_error(cstate, "'llc' not supported for %s",
- pcap_datalink_val_to_description_or_dlt(cstate->linktype));
+ fail_kw_on_dlt(cstate, "llc");
/*NOTREACHED*/
}
}
return gen_wlanhostop(cstate, ebroadcast, Q_DST);
case DLT_IP_OVER_FC:
return gen_ipfchostop(cstate, ebroadcast, Q_DST);
- default:
- bpf_error(cstate, "not a broadcast link");
}
+ fail_kw_on_dlt(cstate, "broadcast");
/*NOTREACHED*/
case Q_IP:
default:
break;
}
- /* Link not known to support multicasts */
- break;
+ fail_kw_on_dlt(cstate, "multicast");
+ /*NOTREACHED*/
case Q_IP:
b0 = gen_linktype(cstate, ETHERTYPE_IP);
b0 = gen_cmp(cstate, OR_LINKHDR, SKF_AD_OFF + SKF_AD_IFINDEX, BPF_W,
ifindex);
#else /* defined(__linux__) */
- bpf_error(cstate, "ifindex not supported on %s",
- pcap_datalink_val_to_description_or_dlt(cstate->linktype));
+ fail_kw_on_dlt(cstate, "ifindex");
/*NOTREACHED*/
#endif /* defined(__linux__) */
}
gen_not(b0);
}
#else /* defined(__linux__) */
- bpf_error(cstate, "inbound/outbound not supported on %s",
- pcap_datalink_val_to_description_or_dlt(cstate->linktype));
+ fail_kw_on_dlt(cstate, outbound ? "outbound" : "inbound");
/*NOTREACHED*/
#endif /* defined(__linux__) */
}
break;
default:
- bpf_error(cstate, "802.11 link-layer types supported only on 802.11");
+ fail_kw_on_dlt(cstate, "type/subtype");
/*NOTREACHED*/
}
break;
default:
- bpf_error(cstate, "frame direction supported only with 802.11 headers");
+ fail_kw_on_dlt(cstate, "dir");
/*NOTREACHED*/
}
name => 'wlan_on_eth',
DLT => 'EN10MB',
expr => 'type data',
- errstr => '802.11 link-layer types supported only on 802.11',
+ errstr => '\'type/subtype\' not supported on Ethernet',
},
{
name => 'wlan_type',
name => 'broadcast_not_supported',
DLT => 'SLIP',
expr => 'broadcast',
- errstr => 'not a broadcast link',
+ errstr => '\'broadcast\' not supported on SLIP',
},
{
name => 'multicast_not_supported',
DLT => 'SLIP',
expr => 'multicast',
- errstr => 'link-layer multicast filters supported only on',
+ errstr => '\'multicast\' not supported on SLIP',
},
# This test has been flaky because it depends on an external effect (DNS
# lookup), which sometimes times out. Let's disable it until there is a good