diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test_bpf.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index d1377390b3ad..10cd1860e5b0 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c | |||
@@ -5056,6 +5056,36 @@ static struct bpf_test tests[] = { | |||
5056 | { {0x1, 0x0 } }, | 5056 | { {0x1, 0x0 } }, |
5057 | }, | 5057 | }, |
5058 | { | 5058 | { |
5059 | "MOD default X", | ||
5060 | .u.insns = { | ||
5061 | /* | ||
5062 | * A = 0x42 | ||
5063 | * A = A mod X ; this halt the filter execution if X is 0 | ||
5064 | * ret 0x42 | ||
5065 | */ | ||
5066 | BPF_STMT(BPF_LD | BPF_IMM, 0x42), | ||
5067 | BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0), | ||
5068 | BPF_STMT(BPF_RET | BPF_K, 0x42), | ||
5069 | }, | ||
5070 | CLASSIC | FLAG_NO_DATA, | ||
5071 | {}, | ||
5072 | { {0x1, 0x0 } }, | ||
5073 | }, | ||
5074 | { | ||
5075 | "MOD default A", | ||
5076 | .u.insns = { | ||
5077 | /* | ||
5078 | * A = A mod 1 | ||
5079 | * ret A | ||
5080 | */ | ||
5081 | BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x1), | ||
5082 | BPF_STMT(BPF_RET | BPF_A, 0x0), | ||
5083 | }, | ||
5084 | CLASSIC | FLAG_NO_DATA, | ||
5085 | {}, | ||
5086 | { {0x1, 0x0 } }, | ||
5087 | }, | ||
5088 | { | ||
5059 | "JMP EQ default A", | 5089 | "JMP EQ default A", |
5060 | .u.insns = { | 5090 | .u.insns = { |
5061 | /* | 5091 | /* |