• Jesper Dangaard Brouer's avatar
    selftests/bpf: add XDP selftests for modifying and popping VLAN headers · 97396ff0
    Jesper Dangaard Brouer authored
    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: default avatarYoel Caspersen <yoel@kviknet.dk>
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    97396ff0
Makefile 4.61 KB