Skip to content

Commit

Permalink
selftests/bpf: Test wire_len/gso_segs in BPF_PROG_TEST_RUN
Browse files Browse the repository at this point in the history
Make sure we can pass arbitrary data in wire_len/gso_segs.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191213223028.161282-2-sdf@google.com
  • Loading branch information
Stanislav Fomichev authored and Alexei Starovoitov committed Dec 13, 2019
1 parent 850a88c commit a06bf42
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/bpf/prog_tests/skb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ void test_skb_ctx(void)
.cb[4] = 5,
.priority = 6,
.tstamp = 7,
.wire_len = 100,
.gso_segs = 8,
};
struct bpf_prog_test_run_attr tattr = {
.data_in = &pkt_v4,
Expand Down
5 changes: 5 additions & 0 deletions tools/testing/selftests/bpf/progs/test_skb_ctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,10 @@ int process(struct __sk_buff *skb)
skb->priority++;
skb->tstamp++;

if (skb->wire_len != 100)
return 1;
if (skb->gso_segs != 8)
return 1;

return 0;
}

0 comments on commit a06bf42

Please sign in to comment.