aboutsummaryrefslogtreecommitdiffstats
path: root/bpf_dump.c
diff options
context:
space:
mode:
authorguy <guy>2008-01-02 04:16:46 +0000
committerguy <guy>2008-01-02 04:16:46 +0000
commit0446821e49224c6a29be28760cc9c4cc14f56d8a (patch)
tree441245d6b2105ff1d2cb4f2e309817d231893f23 /bpf_dump.c
parent716cd1f4ddb365a5dc6f3db7950e69b7b10e6d8a (diff)
Make some arguments const pointers if that makes sense.
Add some additional checks to bpf_validate(), from OpenBSD. Use bpf_validate() in install_bpf_program(), so we validate programs even when they're being processed by userland filters; we make bpf_validate() not reject backward branches, as we use them for the protochain operator. For BPF, don't assume that, just because no_optimize was set, we have a program that we can't hand to the kernel; the user of the application might have specified no optimization (e.g., tcpdump with -O), or we might have generated code to handle 802.11 headers (the optimizer can't handle that code). Instead, try handing the filter to the kernel and, if that fails, try it in userland. Get rid of BPF_MAXINSNS - we don't have a limit on program size in libpcap.
Diffstat (limited to 'bpf_dump.c')
-rw-r--r--bpf_dump.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bpf_dump.c b/bpf_dump.c
index ad096b5..e4ff4a2 100644
--- a/bpf_dump.c
+++ b/bpf_dump.c
@@ -20,7 +20,7 @@
*/
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/bpf_dump.c,v 1.14 2003-11-15 23:23:57 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/bpf_dump.c,v 1.15 2008-01-02 04:16:46 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -31,9 +31,9 @@ static const char rcsid[] _U_ =
#include <stdio.h>
void
-bpf_dump(struct bpf_program *p, int option)
+bpf_dump(const struct bpf_program *p, int option)
{
- struct bpf_insn *insn;
+ const struct bpf_insn *insn;
int i;
int n = p->bf_len;