mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
bpf: sockmap, add BPF_F_INGRESS tests
Add a set of tests to verify ingress flag in redirect helpers works correctly with various msg sizes. Signed-off-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
committed by
Daniel Borkmann
parent
8934ce2fd0
commit
2596f64cb2
@@ -64,6 +64,7 @@ int txmsg_apply;
|
||||
int txmsg_cork;
|
||||
int txmsg_start;
|
||||
int txmsg_end;
|
||||
int txmsg_ingress;
|
||||
|
||||
static const struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h' },
|
||||
@@ -83,6 +84,7 @@ static const struct option long_options[] = {
|
||||
{"txmsg_cork", required_argument, NULL, 'k'},
|
||||
{"txmsg_start", required_argument, NULL, 's'},
|
||||
{"txmsg_end", required_argument, NULL, 'e'},
|
||||
{"txmsg_ingress", no_argument, &txmsg_ingress, 1 },
|
||||
{0, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
@@ -793,6 +795,39 @@ run:
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
if (txmsg_ingress) {
|
||||
int in = BPF_F_INGRESS;
|
||||
|
||||
i = 0;
|
||||
err = bpf_map_update_elem(map_fd[6], &i, &in, BPF_ANY);
|
||||
if (err) {
|
||||
fprintf(stderr,
|
||||
"ERROR: bpf_map_update_elem (txmsg_ingress): %d (%s)\n",
|
||||
err, strerror(errno));
|
||||
}
|
||||
i = 1;
|
||||
err = bpf_map_update_elem(map_fd[1], &i, &p1, BPF_ANY);
|
||||
if (err) {
|
||||
fprintf(stderr,
|
||||
"ERROR: bpf_map_update_elem (p1 txmsg): %d (%s)\n",
|
||||
err, strerror(errno));
|
||||
}
|
||||
err = bpf_map_update_elem(map_fd[2], &i, &p1, BPF_ANY);
|
||||
if (err) {
|
||||
fprintf(stderr,
|
||||
"ERROR: bpf_map_update_elem (p1 redir): %d (%s)\n",
|
||||
err, strerror(errno));
|
||||
}
|
||||
|
||||
i = 2;
|
||||
err = bpf_map_update_elem(map_fd[2], &i, &p2, BPF_ANY);
|
||||
if (err) {
|
||||
fprintf(stderr,
|
||||
"ERROR: bpf_map_update_elem (p2 txmsg): %d (%s)\n",
|
||||
err, strerror(errno));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (txmsg_drop)
|
||||
|
||||
Reference in New Issue
Block a user