forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bpf: add test_run support for netfilter program type
also add two simple retval tests: as-is, a return value other than accept or drop will cause issues. NF_QUEUE could be implemented later IFF we can guarantee that attachment of such programs can be rejected if they get attached to a pf/hook that doesn't support async reinjection. NF_STOLEN could be implemented via trusted helpers that will eventually free the skb, else this would leak the skb reference. Signed-off-by: Florian Westphal <fw@strlen.de>
- Loading branch information
1 parent
952fd08
commit 7fba218
Showing
4 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"netfilter, accept all", | ||
.insns = { | ||
BPF_MOV64_IMM(BPF_REG_0, 1), | ||
BPF_EXIT_INSN(), | ||
}, | ||
.result = ACCEPT, | ||
.prog_type = BPF_PROG_TYPE_NETFILTER, | ||
.retval = 1, | ||
.data = { | ||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x08, 0x00, | ||
}, | ||
}, | ||
{ | ||
"netfilter, stolen verdict", | ||
.insns = { | ||
BPF_MOV64_IMM(BPF_REG_0, 2), | ||
BPF_EXIT_INSN(), | ||
}, | ||
.result = REJECT, | ||
.errstr = "At program exit the register R0 has value (0x2; 0x0) should have been in (0x0; 0x1)", | ||
.prog_type = BPF_PROG_TYPE_NETFILTER, | ||
}, |