]> asedeno.scripts.mit.edu Git - linux.git/commit
selftests/bpf: add XDP selftests for modifying and popping VLAN headers
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 9 Oct 2018 10:04:53 +0000 (12:04 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Oct 2018 04:59:09 +0000 (21:59 -0700)
commit97396ff0bc2d31f8fcb29cbb57d2e0bbcb96d6c5
treecbdbc3c7bfabbbda8a93384f818f4e435c5fac71
parent4f775448f4d79e2db5791fcc3aa708373497d7e6
selftests/bpf: add XDP selftests for modifying and popping VLAN headers

This XDP selftest also contain a small TC-bpf component. It provoke
the generic-XDP bug fixed in previous commit.

The selftest itself shows how to do VLAN manipulation from XDP and TC.
The test demonstrate how XDP ingress can remove a VLAN tag, and how TC
egress can add back a VLAN tag.

This use-case originates from a production need by ISP (kviknet.dk),
who gets DSL-lines terminated as VLAN Q-in-Q tagged packets, and want
to avoid having an net_device for every end-customer on the box doing
the L2 to L3 termination.
  The test-setup is done via a veth-pair and creating two network
namespaces (ns1 and ns2).  The 'ns1' simulate the ISP network that are
loading the BPF-progs stripping and adding VLAN IDs.  The 'ns2'
simulate the DSL-customer that are using VLAN tagged packets.

Running the script with --interactive, will simply not call the
cleanup function.  This gives the effect of creating a testlab, that
the users can inspect and play with.  The --verbose option will simply
request that the shell will print input lines as they are read, this
include comments, which in effect make the comments visible docs.

Reported-by: Yoel Caspersen <yoel@kviknet.dk>
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/test_xdp_vlan.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_xdp_vlan.sh [new file with mode: 0755]