diff options
Diffstat (limited to 'lib/libpcap/pcap-bpf.c')
-rw-r--r-- | lib/libpcap/pcap-bpf.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libpcap/pcap-bpf.c b/lib/libpcap/pcap-bpf.c index a7c1fef224b..19ddc88f20e 100644 --- a/lib/libpcap/pcap-bpf.c +++ b/lib/libpcap/pcap-bpf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcap-bpf.c,v 1.11 1999/08/17 09:13:13 millert Exp $ */ +/* $OpenBSD: pcap-bpf.c,v 1.12 2000/04/26 21:25:53 jakob Exp $ */ /* * Copyright (c) 1993, 1994, 1995, 1996, 1998 @@ -22,7 +22,7 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /cvs/OpenBSD/src/lib/libpcap/pcap-bpf.c,v 1.11 1999/08/17 09:13:13 millert Exp $ (LBL)"; + "@(#) $Header: /cvs/OpenBSD/src/lib/libpcap/pcap-bpf.c,v 1.12 2000/04/26 21:25:53 jakob Exp $ (LBL)"; #endif #include <sys/param.h> /* optionally get BSD define */ @@ -48,6 +48,8 @@ static const char rcsid[] = #include "os-proto.h" #endif +#include "gencode.h" + int pcap_stats(pcap_t *p, struct pcap_stat *ps) { @@ -272,7 +274,14 @@ pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) int pcap_setfilter(pcap_t *p, struct bpf_program *fp) { - if (p->sf.rfile != NULL) + /* + * It looks that BPF code generated by gen_protochain() is not + * compatible with some of kernel BPF code (for example BSD/OS 3.1). + * Take a safer side for now. + */ + if (no_optimize) + p->fcode = *fp; + else if (p->sf.rfile != NULL) p->fcode = *fp; else if (ioctl(p->fd, BIOCSETF, (caddr_t)fp) < 0) { snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "BIOCSETF: %s", |