diff options
author | jkim <jkim@FreeBSD.org> | 2008-08-18 23:05:19 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2008-08-18 23:05:19 +0000 |
commit | 95cf51a304659079405d1943022f0de1ea57dbf7 (patch) | |
tree | efb18e43c1abc4b2bb136ac2abefd9417cc06f79 /tools/regression/bpf | |
parent | 62966b1d9f9e0e26ca130c307fce6afbcbe71832 (diff) | |
download | FreeBSD-src-95cf51a304659079405d1943022f0de1ea57dbf7.zip FreeBSD-src-95cf51a304659079405d1943022f0de1ea57dbf7.tar.gz |
Add test case for 'divide by 0' with BPF_ALU|BPF_DIV|BPF_X instruction.
Diffstat (limited to 'tools/regression/bpf')
-rw-r--r-- | tools/regression/bpf/bpf_filter/Makefile | 2 | ||||
-rw-r--r-- | tools/regression/bpf/bpf_filter/tests/test0074.h | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tools/regression/bpf/bpf_filter/Makefile b/tools/regression/bpf/bpf_filter/Makefile index 6c668d5..ea12e53 100644 --- a/tools/regression/bpf/bpf_filter/Makefile +++ b/tools/regression/bpf/bpf_filter/Makefile @@ -18,7 +18,7 @@ TEST_CASES= test0001 test0002 test0003 test0004 \ test0061 test0062 test0063 test0064 \ test0065 test0066 test0067 test0068 \ test0069 test0070 test0071 test0072 \ - test0073 + test0073 test0074 SYSDIR?= ${.CURDIR}/../../../../sys diff --git a/tools/regression/bpf/bpf_filter/tests/test0074.h b/tools/regression/bpf/bpf_filter/tests/test0074.h new file mode 100644 index 0000000..8ab73a1 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0074.h @@ -0,0 +1,33 @@ +/*- + * Test 0074: Divide by 0 (BPF_ALU|BPF_DIV|BPF_X) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xa7c2da06), + BPF_STMT(BPF_LDX|BPF_IMM, 0), + BPF_STMT(BPF_ALU|BPF_DIV|BPF_X, 0), + BPF_STMT(BPF_RET|BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x00, +}; + +/* 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; |