Commit a06bf42f authored by Stanislav Fomichev's avatar Stanislav Fomichev Committed by Alexei Starovoitov

selftests/bpf: Test wire_len/gso_segs in BPF_PROG_TEST_RUN

Make sure we can pass arbitrary data in wire_len/gso_segs.
Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191213223028.161282-2-sdf@google.com
parent 850a88cc
...@@ -11,6 +11,8 @@ void test_skb_ctx(void) ...@@ -11,6 +11,8 @@ void test_skb_ctx(void)
.cb[4] = 5, .cb[4] = 5,
.priority = 6, .priority = 6,
.tstamp = 7, .tstamp = 7,
.wire_len = 100,
.gso_segs = 8,
}; };
struct bpf_prog_test_run_attr tattr = { struct bpf_prog_test_run_attr tattr = {
.data_in = &pkt_v4, .data_in = &pkt_v4,
......
...@@ -18,5 +18,10 @@ int process(struct __sk_buff *skb) ...@@ -18,5 +18,10 @@ int process(struct __sk_buff *skb)
skb->priority++; skb->priority++;
skb->tstamp++; skb->tstamp++;
if (skb->wire_len != 100)
return 1;
if (skb->gso_segs != 8)
return 1;
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment