Add test case for 'divide by 0' with BPF_ALU|BPF_DIV|BPF_X instruction.
This commit is contained in:
parent
b82a8cd81c
commit
ed97cc0f0c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181857
@ -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
|
||||
|
||||
|
33
tools/regression/bpf/bpf_filter/tests/test0074.h
Normal file
33
tools/regression/bpf/bpf_filter/tests/test0074.h
Normal file
@ -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;
|
Loading…
Reference in New Issue
Block a user