diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2008-08-18 19:01:58 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2008-08-18 19:01:58 +0000 |
commit | b0729b181a6c7d621beb06fcd929047eb8e83019 (patch) | |
tree | 99135c216c6bcc0ee80c8d738e16094e051ffd2a /tools/regression/bpf/bpf_filter/tests/test0061.h | |
parent | 3bfea8682f0462c538b640c7e7cbc5272c8c80c4 (diff) | |
download | src-b0729b181a6c7d621beb06fcd929047eb8e83019.tar.gz src-b0729b181a6c7d621beb06fcd929047eb8e83019.zip |
Add simple bpf(9) regression tests and test cases.
Notes
Notes:
svn path=/head/; revision=181847
Diffstat (limited to 'tools/regression/bpf/bpf_filter/tests/test0061.h')
-rw-r--r-- | tools/regression/bpf/bpf_filter/tests/test0061.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/regression/bpf/bpf_filter/tests/test0061.h b/tools/regression/bpf/bpf_filter/tests/test0061.h new file mode 100644 index 000000000000..f9f7dad69a32 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0061.h @@ -0,0 +1,33 @@ +/*- + * Test 0061: Check boundary conditions (BPF_LD|BPF_B|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0xffffffff), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = sizeof(pkt); + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; |