summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bpf/bpf_filter/Makefile2
-rw-r--r--tools/regression/bpf/bpf_filter/tests/test0074.h33
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;
OpenPOWER on IntegriCloud