selftests/bpf: expand test_tc_tunnel with SIT encap
authorWillem de Bruijn <willemb@google.com>
Tue, 23 Apr 2019 18:43:49 +0000 (14:43 -0400)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 23 Apr 2019 23:32:26 +0000 (01:32 +0200)
commitf6ad6accaa99dfa7462d18687961b8421d707c1e
tree017cfbea5a7d5be7c4503bd248b05c0858925d41
parent1b00e0dfe7d08a17d818c34d4c9968047a3f3e4b
selftests/bpf: expand test_tc_tunnel with SIT encap

So far, all BPF tc tunnel testcases encapsulate in the same network
protocol. Add an encap testcase that requires updating skb->protocol.

The 6in4 tunnel encapsulates an IPv6 packet inside an IPv4 tunnel.
Verify that bpf_skb_net_grow correctly updates skb->protocol to
select the right protocol handler in __netif_receive_skb_core.

The BPF program should also manually update the link layer header to
encode the right network protocol.

Changes v1->v2
  - improve documentation of non-obvious logic

Signed-off-by: Willem de Bruijn <willemb@google.com>
Tested-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/config
tools/testing/selftests/bpf/progs/test_tc_tunnel.c
tools/testing/selftests/bpf/test_tc_tunnel.sh