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: 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
This commit is contained in:
Stanislav Fomichev 2019-12-13 14:30:28 -08:00 committed by Alexei Starovoitov
parent 850a88cc40
commit a06bf42f5a
2 changed files with 7 additions and 0 deletions

View File

@ -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,

View File

@ -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;
} }