diff options
author | jkim <jkim@FreeBSD.org> | 2008-08-18 19:01:58 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2008-08-18 19:01:58 +0000 |
commit | 2e51cd9be9bf3bb0d8870d6f2117847e6da04a9e (patch) | |
tree | 99135c216c6bcc0ee80c8d738e16094e051ffd2a /tools | |
parent | 137ba6a2385b32d5d9884b675796cb1f79f233c9 (diff) | |
download | FreeBSD-src-2e51cd9be9bf3bb0d8870d6f2117847e6da04a9e.zip FreeBSD-src-2e51cd9be9bf3bb0d8870d6f2117847e6da04a9e.tar.gz |
Add simple bpf(9) regression tests and test cases.
Diffstat (limited to 'tools')
76 files changed, 2739 insertions, 0 deletions
diff --git a/tools/regression/bpf/Makefile b/tools/regression/bpf/Makefile new file mode 100644 index 0000000..8fac0b4 --- /dev/null +++ b/tools/regression/bpf/Makefile @@ -0,0 +1,5 @@ +# $FreeBSD$ + +SUBDIR= bpf_filter + +.include <bsd.subdir.mk> diff --git a/tools/regression/bpf/bpf_filter/Makefile b/tools/regression/bpf/bpf_filter/Makefile new file mode 100644 index 0000000..6c668d5 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/Makefile @@ -0,0 +1,65 @@ +# $FreeBSD$ + +TEST_CASES= test0001 test0002 test0003 test0004 \ + test0005 test0006 test0007 test0008 \ + test0009 test0010 test0011 test0012 \ + test0013 test0014 test0015 test0016 \ + test0017 test0018 test0019 test0020 \ + test0021 test0022 test0023 test0024 \ + test0025 test0026 test0027 test0028 \ + test0029 test0030 test0031 test0032 \ + test0033 test0034 test0035 test0036 \ + test0037 test0038 test0039 test0040 \ + test0041 test0042 test0043 test0044 \ + test0045 test0046 test0047 test0048 \ + test0049 test0050 test0051 test0052 \ + test0053 test0054 test0055 test0056 \ + test0057 test0058 test0059 test0060 \ + test0061 test0062 test0063 test0064 \ + test0065 test0066 test0067 test0068 \ + test0069 test0070 test0071 test0072 \ + test0073 + +SYSDIR?= ${.CURDIR}/../../../../sys + +SRCS= ${.CURDIR}/bpf_test.c + +CFLAGS+= -g -fno-builtin-abort -I${.CURDIR}/tests + +.if defined(LOG_LEVEL) +CFLAGS+= -DLOG_LEVEL="${LOG_LEVEL}" +.endif + +.if defined(BPF_VALIDATE) +CFLAGS+= -DBPF_VALIDATE +.endif + +.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386") && defined(BPF_JIT) +SRCS+= ${SYSDIR}/${MACHINE_ARCH}/${MACHINE_ARCH}/bpf_jit_machdep.c +CFLAGS+= -I${SYSDIR} -DBPF_JIT_COMPILER +WARNS?= 6 +.else +SRCS+= ${SYSDIR}/net/bpf_filter.c +WARNS?= 1 +.endif + +.for TEST in ${TEST_CASES} +${TEST}: ${.CURDIR}/tests/${TEST}.h ${SRCS} + @${CC} ${CFLAGS} -DBPF_TEST_H=\"${TEST}.h\" -o ${.CURDIR}/${TEST} ${SRCS} +.endfor + +all: ${TEST_CASES} +.for TEST in ${TEST_CASES} +.if !defined(LOG_LEVEL) || (${LOG_LEVEL} > 0) + @${ECHO} -n "${TEST}: " +.endif + @-${.CURDIR}/${TEST} + @rm -f ${.CURDIR}/${TEST} +.endfor + +clean: +.for TEST in ${TEST_CASES} + @rm -f ${.CURDIR}/${TEST} +.endfor + +.include <bsd.prog.mk> diff --git a/tools/regression/bpf/bpf_filter/bpf_test.c b/tools/regression/bpf/bpf_filter/bpf_test.c new file mode 100644 index 0000000..4412728 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/bpf_test.c @@ -0,0 +1,238 @@ +/*- + * Copyright (C) 2008 Jung-uk Kim <jkim@FreeBSD.org>. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + +#include <sys/types.h> + +#include <net/bpf.h> + +#include BPF_TEST_H + +#define PASSED 0 +#define FAILED 1 +#define FATAL -1 + +#ifndef LOG_LEVEL +#define LOG_LEVEL 1 +#endif + +static void sig_handler(int); + +static int nins = sizeof(pc) / sizeof(pc[0]); +static int verbose = LOG_LEVEL; + +#ifdef BPF_JIT_COMPILER + +#include <string.h> + +#include <net/bpf_jitter.h> + +bpf_filter_func bpf_jit_compile(struct bpf_insn *, u_int, int *); + +static u_int +bpf_compile_and_filter(void) +{ + bpf_jit_filter filter; + u_int ret; + + /* Do not use BPF JIT compiler for an empty program */ + if (nins == 0) + return (0); + + /* Allocate the filter's memory */ + if ((filter.mem = (int *)malloc(BPF_MEMWORDS * sizeof(int))) == NULL) + goto fail; + + /* Create the binary */ + if ((filter.func = bpf_jit_compile(pc, nins, filter.mem)) == NULL) + goto fail; + + ret = (*(filter.func))(pkt, wirelen, buflen); + + free(filter.mem); + free(filter.func); + + return (ret); + +fail: + if (filter.mem != NULL) + free(filter.mem); + + if (verbose > 1) + printf("Failed to allocate memory:\t"); + if (verbose > 0) + printf("FATAL\n"); + exit(FATAL); +} + +#else + +u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int); + +#endif + +#ifdef BPF_VALIDATE +/* + * XXX Copied from sys/net/bpf_filter.c and modified. + * + * Return true if the 'fcode' is a valid filter program. + * The constraints are that each jump be forward and to a valid + * code. The code must terminate with either an accept or reject. + * + * The kernel needs to be able to verify an application's filter code. + * Otherwise, a bogus program could easily crash the system. + */ +static int +bpf_validate(const struct bpf_insn *f, int len) +{ + register int i; + register const struct bpf_insn *p; + + /* Do not accept negative length filter. */ + if (len < 0) + return (0); + + /* An empty filter means accept all. */ + if (len == 0) + return (1); + + for (i = 0; i < len; ++i) { + /* + * Check that that jumps are forward, and within + * the code block. + */ + p = &f[i]; + if (BPF_CLASS(p->code) == BPF_JMP) { + register int from = i + 1; + + if (BPF_OP(p->code) == BPF_JA) { + if (from >= len || p->k >= (u_int)len - from) + return (0); + } + else if (from >= len || p->jt >= len - from || + p->jf >= len - from) + return (0); + } + /* + * Check that memory operations use valid addresses. + */ + if ((BPF_CLASS(p->code) == BPF_ST || + (BPF_CLASS(p->code) == BPF_LD && + (p->code & 0xe0) == BPF_MEM)) && + p->k >= BPF_MEMWORDS) + return (0); + /* + * Check for constant division by 0. + */ + if (p->code == (BPF_ALU|BPF_DIV|BPF_K) && p->k == 0) + return (0); + } + return (BPF_CLASS(f[len - 1].code) == BPF_RET); +} +#endif + +int +main(void) +{ + u_int ret; + int sig; +#ifdef BPF_VALIDATE + int valid; +#endif + + /* Try to catch all signals */ + for (sig = SIGHUP; sig <= SIGUSR2; sig++) + signal(sig, sig_handler); + +#ifdef BPF_VALIDATE + valid = bpf_validate(pc, nins); + if (valid != 0 && invalid != 0) { + if (verbose > 1) + printf("Validated invalid instructions:\t"); + if (verbose > 0) + printf("FAILED\n"); + return (FAILED); + } else if (valid == 0 && invalid == 0) { + if (verbose > 1) + printf("Invalidated valid instructions:\t"); + if (verbose > 0) + printf("FAILED\n"); + return (FAILED); + } +#endif + +#ifdef BPF_JIT_COMPILER + ret = bpf_compile_and_filter(); +#else + ret = bpf_filter(pc, pkt, wirelen, buflen); +#endif + if (ret != expect) { + if (verbose > 1) + printf("Expected 0x%x but got 0x%x:\t", expect, ret); + if (verbose > 0) + printf("FAILED\n"); + return (FAILED); + } + if (verbose > 1) + printf("Expected and got 0x%x:\t", ret); + if (verbose > 0) + printf("PASSED\n"); + + return (PASSED); +} + +static void +sig_handler(int sig) +{ + + if (expect_signal == 0) { + if (verbose > 1) + printf("Received unexpected signal %d:\t", sig); + if (verbose > 0) + printf("FATAL\n"); + exit(FATAL); + } + if (expect_signal != sig) { + if (verbose > 1) + printf("Expected signal %d but got %d:\t", + expect_signal, sig); + if (verbose > 0) + printf("FAILED\n"); + exit(FAILED); + } + + if (verbose > 1) + printf("Expected and got signal %d:\t", sig); + if (verbose > 0) + printf("PASSED\n"); + + exit(PASSED); +} diff --git a/tools/regression/bpf/bpf_filter/tests/test0001.h b/tools/regression/bpf/bpf_filter/tests/test0001.h new file mode 100644 index 0000000..57c9a95 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0001.h @@ -0,0 +1,30 @@ +/*- + * Test 0001: Catch illegal instruction. + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(0xdead, 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 = 1; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = SIGABRT; diff --git a/tools/regression/bpf/bpf_filter/tests/test0002.h b/tools/regression/bpf/bpf_filter/tests/test0002.h new file mode 100644 index 0000000..af66976 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0002.h @@ -0,0 +1,30 @@ +/*- + * Test 0002: BPF_RET+BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_RET+BPF_K, 0xdeadc0de), +}; + +/* 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0003.h b/tools/regression/bpf/bpf_filter/tests/test0003.h new file mode 100644 index 0000000..9089f05 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0003.h @@ -0,0 +1,31 @@ +/*- + * Test 0003: BPF_LD+BPF_IMM & BPF_RET+BPF_A + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de), + 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0004.h b/tools/regression/bpf/bpf_filter/tests/test0004.h new file mode 100644 index 0000000..78866ce --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0004.h @@ -0,0 +1,31 @@ +/*- + * Test 0004: BPF_LD|BPF_W|BPF_ABS + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_W|BPF_ABS, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, +}; + +/* 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 = 0x23456789; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0005.h b/tools/regression/bpf/bpf_filter/tests/test0005.h new file mode 100644 index 0000000..ec9b0fd --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0005.h @@ -0,0 +1,31 @@ +/*- + * Test 0005: BPF_LD|BPF_H|BPF_ABS + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_H|BPF_ABS, 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 = 0x2345; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0006.h b/tools/regression/bpf/bpf_filter/tests/test0006.h new file mode 100644 index 0000000..2d0a0b6 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0006.h @@ -0,0 +1,31 @@ +/*- + * Test 0006: BPF_LD|BPF_B|BPF_ABS + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_B|BPF_ABS, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, +}; + +/* 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 = 0x23; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0007.h b/tools/regression/bpf/bpf_filter/tests/test0007.h new file mode 100644 index 0000000..c253480 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0007.h @@ -0,0 +1,29 @@ +/*- + * Test 0007: BPF_LD|BPF_W|BPF_LEN + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_W|BPF_LEN, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[0xdeadc0de]; + +/* Packet length seen on wire */ +u_int wirelen = 0xdeadc0de; + +/* Packet length passed on buffer */ +u_int buflen = 0xdeadc0de; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0008.h b/tools/regression/bpf/bpf_filter/tests/test0008.h new file mode 100644 index 0000000..432eaaa --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0008.h @@ -0,0 +1,30 @@ +/*- + * Test 0008: BPF_LDX|BPF_W|BPF_LEN & BPF_MISC|BPF_TXA + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_W|BPF_LEN, 0), + BPF_STMT(BPF_MISC|BPF_TXA, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[0xdeadc0de]; + +/* Packet length seen on wire */ +u_int wirelen = 0xdeadc0de; + +/* Packet length passed on buffer */ +u_int buflen = 0xdeadc0de; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0009.h b/tools/regression/bpf/bpf_filter/tests/test0009.h new file mode 100644 index 0000000..17c8089 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0009.h @@ -0,0 +1,32 @@ +/*- + * Test 0009: BPF_LDX|BPF_IMM & BPF_LD|BPF_W|BPF_IND + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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 = 0x456789ab; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0010.h b/tools/regression/bpf/bpf_filter/tests/test0010.h new file mode 100644 index 0000000..cc5abb8 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0010.h @@ -0,0 +1,32 @@ +/*- + * Test 0010: BPF_LD|BPF_H|BPF_IND + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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 = 0x4567; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0011.h b/tools/regression/bpf/bpf_filter/tests/test0011.h new file mode 100644 index 0000000..9cfd2c5 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0011.h @@ -0,0 +1,32 @@ +/*- + * Test 0011: BPF_LD|BPF_B|BPF_IND + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_IMM, 1), + 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 = 0x45; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0012.h b/tools/regression/bpf/bpf_filter/tests/test0012.h new file mode 100644 index 0000000..b388a06 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0012.h @@ -0,0 +1,32 @@ +/*- + * Test 0012: BPF_LDX|BPF_MSH|BPF_B + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_MSH|BPF_B, 1), + BPF_STMT(BPF_MISC|BPF_TXA, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, +}; + +/* 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 = (0x23 & 0xf) << 2; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0013.h b/tools/regression/bpf/bpf_filter/tests/test0013.h new file mode 100644 index 0000000..2670fc2 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0013.h @@ -0,0 +1,34 @@ +/*- + * Test 0013: BPF_ST & BPF_LDX|BPF_MEM + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_ST, 7), + BPF_STMT(BPF_LDX|BPF_MEM, 7), + BPF_STMT(BPF_MISC|BPF_TXA, 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0014.h b/tools/regression/bpf/bpf_filter/tests/test0014.h new file mode 100644 index 0000000..4301109 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0014.h @@ -0,0 +1,33 @@ +/*- + * Test 0014: BPF_STX & BPF_LD|BPF_MEM + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LDX|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_STX, 7), + BPF_STMT(BPF_LD|BPF_MEM, 7), + 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0015.h b/tools/regression/bpf/bpf_filter/tests/test0015.h new file mode 100644 index 0000000..9a2aea3 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0015.h @@ -0,0 +1,33 @@ +/*- + * Test 0015: BPF_JMP|BPF_JA + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + BPF_STMT(BPF_JMP|BPF_JA, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0016.h b/tools/regression/bpf/bpf_filter/tests/test0016.h new file mode 100644 index 0000000..bd7cee3 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0016.h @@ -0,0 +1,37 @@ +/*- + * Test 0016: BPF_JMP|BPF_JGT|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_K, 0x01234568, 2, 0), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_K, 0x01234566, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_K, 0x01234567, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0017.h b/tools/regression/bpf/bpf_filter/tests/test0017.h new file mode 100644 index 0000000..e286249 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0017.h @@ -0,0 +1,37 @@ +/*- + * Test 0017: BPF_JMP|BPF_JGE|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 0x01234568, 2, 0), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 0x01234567, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, 0x01234566, 0, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0018.h b/tools/regression/bpf/bpf_filter/tests/test0018.h new file mode 100644 index 0000000..17c5ee8 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0018.h @@ -0,0 +1,37 @@ +/*- + * Test 0018: BPF_JMP|BPF_JEQ|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 0x01234568, 2, 0), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 0x01234567, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, 0x01234566, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0019.h b/tools/regression/bpf/bpf_filter/tests/test0019.h new file mode 100644 index 0000000..df7bccd --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0019.h @@ -0,0 +1,42 @@ +/*- + * Test 0019: BPF_JMP|BPF_JSET|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x80000000, 5, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x40000000, 4, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x20000000, 3, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x10000000, 2, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x1, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x08000000, 3, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x04000000, 2, 0), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_K, 0x02000000, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0020.h b/tools/regression/bpf/bpf_filter/tests/test0020.h new file mode 100644 index 0000000..5b58e70 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0020.h @@ -0,0 +1,40 @@ +/*- + * Test 0020: BPF_JMP|BPF_JGT|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234568), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_X, 0, 3, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234566), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_X, 0, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JGT|BPF_X, 0, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0021.h b/tools/regression/bpf/bpf_filter/tests/test0021.h new file mode 100644 index 0000000..4979cf8 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0021.h @@ -0,0 +1,40 @@ +/*- + * Test 0021: BPF_JMP|BPF_JGE|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234568), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_X, 0, 3, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_X, 0, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234566), + BPF_JUMP(BPF_JMP|BPF_JGE|BPF_X, 0, 0, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0022.h b/tools/regression/bpf/bpf_filter/tests/test0022.h new file mode 100644 index 0000000..f6e4102 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0022.h @@ -0,0 +1,40 @@ +/*- + * Test 0022: BPF_JMP|BPF_JEQ|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234568), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_X, 0, 3, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234567), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_X, 0, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x01234566), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_X, 0, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0023.h b/tools/regression/bpf/bpf_filter/tests/test0023.h new file mode 100644 index 0000000..6b5dc01 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0023.h @@ -0,0 +1,50 @@ +/*- + * Test 0023: BPF_JMP|BPF_JSET|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x01234567), + BPF_STMT(BPF_LDX|BPF_IMM, 0x80000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 9, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x40000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 7, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x20000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 5, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x10000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 3, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x1), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0x1, 2, 1), + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_RET+BPF_A, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x08000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 5, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x04000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 3, 0), + BPF_STMT(BPF_LDX|BPF_IMM, 0x02000000), + BPF_JUMP(BPF_JMP|BPF_JSET|BPF_X, 0, 1, 0), + BPF_STMT(BPF_LD|BPF_IMM, 0xc0decafe), + 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 = 0xc0decafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0024.h b/tools/regression/bpf/bpf_filter/tests/test0024.h new file mode 100644 index 0000000..7c4347f --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0024.h @@ -0,0 +1,33 @@ +/*- + * Test 0024: BPF_ALU|BPF_ADD|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xbeadb8dd), + BPF_STMT(BPF_LDX|BPF_IMM, 0x20000801), + BPF_STMT(BPF_ALU|BPF_ADD|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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0025.h b/tools/regression/bpf/bpf_filter/tests/test0025.h new file mode 100644 index 0000000..16800f3 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0025.h @@ -0,0 +1,33 @@ +/*- + * Test 0025: BPF_ALU|BPF_SUB|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0x20000801), + BPF_STMT(BPF_ALU|BPF_SUB|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 = 0xbeadb8dd; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0026.h b/tools/regression/bpf/bpf_filter/tests/test0026.h new file mode 100644 index 0000000..9ef1bc1 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0026.h @@ -0,0 +1,33 @@ +/*- + * Test 0026: BPF_ALU|BPF_MUL|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdead), + BPF_STMT(BPF_LDX|BPF_IMM, 0xc0de), + BPF_STMT(BPF_ALU|BPF_MUL|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 = 0xa7c2da06; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0027.h b/tools/regression/bpf/bpf_filter/tests/test0027.h new file mode 100644 index 0000000..8417e1a --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0027.h @@ -0,0 +1,33 @@ +/*- + * Test 0027: 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, 0xdead), + 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 = 0xc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0028.h b/tools/regression/bpf/bpf_filter/tests/test0028.h new file mode 100644 index 0000000..7bcc455 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0028.h @@ -0,0 +1,33 @@ +/*- + * Test 0028: BPF_ALU|BPF_AND|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0xc0decafe), + BPF_STMT(BPF_ALU|BPF_AND|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 = 0xc08cc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0029.h b/tools/regression/bpf/bpf_filter/tests/test0029.h new file mode 100644 index 0000000..6ac2b67 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0029.h @@ -0,0 +1,33 @@ +/*- + * Test 0029: BPF_ALU|BPF_OR|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0xc0decafe), + BPF_STMT(BPF_ALU|BPF_OR|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 = 0xdeffcafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0030.h b/tools/regression/bpf/bpf_filter/tests/test0030.h new file mode 100644 index 0000000..b2eb60c --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0030.h @@ -0,0 +1,33 @@ +/*- + * Test 0030: BPF_ALU|BPF_LSH|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdefc0), + BPF_STMT(BPF_LDX|BPF_IMM, 9), + BPF_STMT(BPF_ALU|BPF_LSH|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 = 0x1bdf8000; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0031.h b/tools/regression/bpf/bpf_filter/tests/test0031.h new file mode 100644 index 0000000..5db96be --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0031.h @@ -0,0 +1,33 @@ +/*- + * Test 0031: BPF_ALU|BPF_RSH|BPF_X + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 13), + BPF_STMT(BPF_ALU|BPF_RSH|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 = 0x6f56e; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0032.h b/tools/regression/bpf/bpf_filter/tests/test0032.h new file mode 100644 index 0000000..05fb432 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0032.h @@ -0,0 +1,32 @@ +/*- + * Test 0032: BPF_ALU|BPF_ADD|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xbeadb8dd), + BPF_STMT(BPF_ALU|BPF_ADD|BPF_K, 0x20000801), + 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0033.h b/tools/regression/bpf/bpf_filter/tests/test0033.h new file mode 100644 index 0000000..79ddafc --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0033.h @@ -0,0 +1,32 @@ +/*- + * Test 0033: BPF_ALU|BPF_SUB|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_ALU|BPF_SUB|BPF_K, 0x20000801), + 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 = 0xbeadb8dd; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0034.h b/tools/regression/bpf/bpf_filter/tests/test0034.h new file mode 100644 index 0000000..5c09da1 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0034.h @@ -0,0 +1,32 @@ +/*- + * Test 0034: BPF_ALU|BPF_MUL|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdead), + BPF_STMT(BPF_ALU|BPF_MUL|BPF_K, 0xc0de), + 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 = 0xa7c2da06; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0035.h b/tools/regression/bpf/bpf_filter/tests/test0035.h new file mode 100644 index 0000000..1283a88 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0035.h @@ -0,0 +1,32 @@ +/*- + * Test 0035: BPF_ALU|BPF_DIV|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xa7c2da06), + BPF_STMT(BPF_ALU|BPF_DIV|BPF_K, 0xdead), + 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 = 0xc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0036.h b/tools/regression/bpf/bpf_filter/tests/test0036.h new file mode 100644 index 0000000..8506b90 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0036.h @@ -0,0 +1,32 @@ +/*- + * Test 0036: BPF_ALU|BPF_AND|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_ALU|BPF_AND|BPF_K, 0xc0decafe), + 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 = 0xc08cc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0037.h b/tools/regression/bpf/bpf_filter/tests/test0037.h new file mode 100644 index 0000000..f231deb --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0037.h @@ -0,0 +1,32 @@ +/*- + * Test 0037: BPF_ALU|BPF_OR|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_ALU|BPF_OR|BPF_K, 0xc0decafe), + 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 = 0xdeffcafe; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0038.h b/tools/regression/bpf/bpf_filter/tests/test0038.h new file mode 100644 index 0000000..1c9b764 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0038.h @@ -0,0 +1,32 @@ +/*- + * Test 0038: BPF_ALU|BPF_LSH|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdefc0), + BPF_STMT(BPF_ALU|BPF_LSH|BPF_K, 9), + 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 = 0x1bdf8000; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0039.h b/tools/regression/bpf/bpf_filter/tests/test0039.h new file mode 100644 index 0000000..848c0cd --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0039.h @@ -0,0 +1,32 @@ +/*- + * Test 0039: BPF_ALU|BPF_RSH|BPF_K + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_ALU|BPF_RSH|BPF_K, 13), + 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 = 0x6f56e; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0040.h b/tools/regression/bpf/bpf_filter/tests/test0040.h new file mode 100644 index 0000000..c08fe91 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0040.h @@ -0,0 +1,32 @@ +/*- + * Test 0040: BPF_ALU|BPF_NEG + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0x21523f22), + BPF_STMT(BPF_ALU|BPF_NEG, 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0041.h b/tools/regression/bpf/bpf_filter/tests/test0041.h new file mode 100644 index 0000000..5480bda --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0041.h @@ -0,0 +1,34 @@ +/*- + * Test 0041: BPF_MISC|BPF_TAX + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_MISC|BPF_TAX, 0), + BPF_STMT(BPF_STX, 0), + BPF_STMT(BPF_LD|BPF_MEM, 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 = 0xdeadc0de; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0042.h b/tools/regression/bpf/bpf_filter/tests/test0042.h new file mode 100644 index 0000000..bf9cf5b --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0042.h @@ -0,0 +1,32 @@ +/*- + * Test 0042: Check boundary conditions (BPF_LD|BPF_W|BPF_ABS) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LD|BPF_W|BPF_ABS, 2), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0043.h b/tools/regression/bpf/bpf_filter/tests/test0043.h new file mode 100644 index 0000000..2e06829 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0043.h @@ -0,0 +1,32 @@ +/*- + * Test 0043: Check boundary conditions (BPF_LD|BPF_H|BPF_ABS) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LD|BPF_H|BPF_ABS, 2), + 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0044.h b/tools/regression/bpf/bpf_filter/tests/test0044.h new file mode 100644 index 0000000..ae6e8ee --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0044.h @@ -0,0 +1,32 @@ +/*- + * Test 0044: Check boundary conditions (BPF_LD|BPF_B|BPF_ABS) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LD|BPF_B|BPF_ABS, 2), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0045.h b/tools/regression/bpf/bpf_filter/tests/test0045.h new file mode 100644 index 0000000..329357f --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0045.h @@ -0,0 +1,33 @@ +/*- + * Test 0045: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 2), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0046.h b/tools/regression/bpf/bpf_filter/tests/test0046.h new file mode 100644 index 0000000..0c9d72e --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0046.h @@ -0,0 +1,33 @@ +/*- + * Test 0046: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 2), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0047.h b/tools/regression/bpf/bpf_filter/tests/test0047.h new file mode 100644 index 0000000..2561c65 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0047.h @@ -0,0 +1,33 @@ +/*- + * Test 0047: 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, 1), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 2), + 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0048.h b/tools/regression/bpf/bpf_filter/tests/test0048.h new file mode 100644 index 0000000..a933078 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0048.h @@ -0,0 +1,33 @@ +/*- + * Test 0048: Check boundary conditions (BPF_LDX|BPF_MSH|BPF_B) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_MSH|BPF_B, 2), + BPF_STMT(BPF_MISC|BPF_TXA, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0049.h b/tools/regression/bpf/bpf_filter/tests/test0049.h new file mode 100644 index 0000000..47ca771 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0049.h @@ -0,0 +1,32 @@ +/*- + * Test 0049: Check boundary conditions (BPF_LD|BPF_W|BPF_ABS) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LD|BPF_W|BPF_ABS, 6), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0050.h b/tools/regression/bpf/bpf_filter/tests/test0050.h new file mode 100644 index 0000000..4f560c9 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0050.h @@ -0,0 +1,32 @@ +/*- + * Test 0050: Check boundary conditions (BPF_LD|BPF_H|BPF_ABS) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LD|BPF_H|BPF_ABS, 4), + 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0051.h b/tools/regression/bpf/bpf_filter/tests/test0051.h new file mode 100644 index 0000000..2036cb3 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0051.h @@ -0,0 +1,33 @@ +/*- + * Test 0051: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 6), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0052.h b/tools/regression/bpf/bpf_filter/tests/test0052.h new file mode 100644 index 0000000..976d1cd --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0052.h @@ -0,0 +1,33 @@ +/*- + * Test 0052: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 4), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0053.h b/tools/regression/bpf/bpf_filter/tests/test0053.h new file mode 100644 index 0000000..4b4d0c1 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0053.h @@ -0,0 +1,33 @@ +/*- + * Test 0053: 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, 1), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 3), + 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0054.h b/tools/regression/bpf/bpf_filter/tests/test0054.h new file mode 100644 index 0000000..534b7f6 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0054.h @@ -0,0 +1,33 @@ +/*- + * Test 0054: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 6), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0055.h b/tools/regression/bpf/bpf_filter/tests/test0055.h new file mode 100644 index 0000000..6460846 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0055.h @@ -0,0 +1,33 @@ +/*- + * Test 0055: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 4), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0056.h b/tools/regression/bpf/bpf_filter/tests/test0056.h new file mode 100644 index 0000000..790a9b9 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0056.h @@ -0,0 +1,33 @@ +/*- + * Test 0056: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0xffffffff), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0057.h b/tools/regression/bpf/bpf_filter/tests/test0057.h new file mode 100644 index 0000000..9df3088 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0057.h @@ -0,0 +1,33 @@ +/*- + * Test 0057: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 0xffffffff), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0058.h b/tools/regression/bpf/bpf_filter/tests/test0058.h new file mode 100644 index 0000000..419983c --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0058.h @@ -0,0 +1,33 @@ +/*- + * Test 0058: 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, 1), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 0xffffffff), + 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0059.h b/tools/regression/bpf/bpf_filter/tests/test0059.h new file mode 100644 index 0000000..193abd7 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0059.h @@ -0,0 +1,33 @@ +/*- + * Test 0059: Check boundary conditions (BPF_LD|BPF_W|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_W|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* 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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0060.h b/tools/regression/bpf/bpf_filter/tests/test0060.h new file mode 100644 index 0000000..f23bb49 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0060.h @@ -0,0 +1,33 @@ +/*- + * Test 0060: Check boundary conditions (BPF_LD|BPF_H|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_H|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* 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; 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 0000000..f9f7dad --- /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; diff --git a/tools/regression/bpf/bpf_filter/tests/test0062.h b/tools/regression/bpf/bpf_filter/tests/test0062.h new file mode 100644 index 0000000..817305b --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0062.h @@ -0,0 +1,33 @@ +/*- + * Test 0062: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0063.h b/tools/regression/bpf/bpf_filter/tests/test0063.h new file mode 100644 index 0000000..f012323 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0063.h @@ -0,0 +1,33 @@ +/*- + * Test 0063: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0064.h b/tools/regression/bpf/bpf_filter/tests/test0064.h new file mode 100644 index 0000000..9788602 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0064.h @@ -0,0 +1,33 @@ +/*- + * Test 0064: 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, 1), + 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 = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0065.h b/tools/regression/bpf/bpf_filter/tests/test0065.h new file mode 100644 index 0000000..66b1197 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0065.h @@ -0,0 +1,33 @@ +/*- + * Test 0065: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0066.h b/tools/regression/bpf/bpf_filter/tests/test0066.h new file mode 100644 index 0000000..1276ac8 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0066.h @@ -0,0 +1,33 @@ +/*- + * Test 0066: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 1), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0067.h b/tools/regression/bpf/bpf_filter/tests/test0067.h new file mode 100644 index 0000000..0b21c44 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0067.h @@ -0,0 +1,33 @@ +/*- + * Test 0067: 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, 0), + 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 = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0068.h b/tools/regression/bpf/bpf_filter/tests/test0068.h new file mode 100644 index 0000000..62511e0 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0068.h @@ -0,0 +1,33 @@ +/*- + * Test 0068: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0069.h b/tools/regression/bpf/bpf_filter/tests/test0069.h new file mode 100644 index 0000000..7d12bdc --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0069.h @@ -0,0 +1,33 @@ +/*- + * Test 0069: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 1), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0070.h b/tools/regression/bpf/bpf_filter/tests/test0070.h new file mode 100644 index 0000000..a6eb7da --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0070.h @@ -0,0 +1,33 @@ +/*- + * Test 0070: 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, 1), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 0), + 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 = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0071.h b/tools/regression/bpf/bpf_filter/tests/test0071.h new file mode 100644 index 0000000..d938378 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0071.h @@ -0,0 +1,33 @@ +/*- + * Test 0071: Check boundary conditions (BPF_LD|BPF_W|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0), + BPF_STMT(BPF_LD|BPF_W|BPF_IND, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0072.h b/tools/regression/bpf/bpf_filter/tests/test0072.h new file mode 100644 index 0000000..38ba942 --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0072.h @@ -0,0 +1,33 @@ +/*- + * Test 0072: Check boundary conditions (BPF_LD|BPF_H|BPF_IND) + * + * $FreeBSD$ + */ + +/* BPF program */ +struct bpf_insn pc[] = { + BPF_STMT(BPF_LD|BPF_IMM, 0xdeadc0de), + BPF_STMT(BPF_LDX|BPF_IMM, 0), + BPF_STMT(BPF_LD|BPF_H|BPF_IND, 0), + BPF_STMT(BPF_RET+BPF_A, 0), +}; + +/* Packet */ +u_char pkt[] = { + 0x01, 0x23, 0x45, 0x67, +}; + +/* Packet length seen on wire */ +u_int wirelen = sizeof(pkt); + +/* Packet length passed on buffer */ +u_int buflen = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; diff --git a/tools/regression/bpf/bpf_filter/tests/test0073.h b/tools/regression/bpf/bpf_filter/tests/test0073.h new file mode 100644 index 0000000..d9fae4a --- /dev/null +++ b/tools/regression/bpf/bpf_filter/tests/test0073.h @@ -0,0 +1,33 @@ +/*- + * Test 0073: 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, 0), + BPF_STMT(BPF_LD|BPF_B|BPF_IND, 0), + 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 = 0; + +/* Invalid instruction */ +int invalid = 0; + +/* Expected return value */ +u_int expect = 0; + +/* Expeced signal */ +int expect_signal = 0; |