Commit Graph

6 Commits

Author SHA1 Message Date
Artem Savkov fbd9cfcd5b selftests/bpf: Store BPF object files with .bpf.o extension
Bugzilla: https://bugzilla.redhat.com/2166911

commit afef88e65554c3e8691513b8350d6445e292560e
Author: Daniel Müller <deso@posteo.net>
Date:   Thu Sep 1 22:22:53 2022 +0000

    selftests/bpf: Store BPF object files with .bpf.o extension
    
    BPF object files are, in a way, the final artifact produced as part of
    the ahead-of-time compilation process. That makes them somewhat special
    compared to "regular" object files, which are a intermediate build
    artifacts that can typically be removed safely. As such, it can make
    sense to name them differently to make it easier to spot this difference
    at a glance.
    
    Among others, libbpf-bootstrap [0] has established the extension .bpf.o
    for BPF object files. It seems reasonable to follow this example and
    establish the same denomination for selftest build artifacts. To that
    end, this change adjusts the corresponding part of the build system and
    the test programs loading BPF object files to work with .bpf.o files.
    
      [0] https://github.com/libbpf/libbpf-bootstrap
    
    Suggested-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Daniel Müller <deso@posteo.net>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20220901222253.1199242-1-deso@posteo.net

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2023-03-06 14:54:06 +01:00
Jiri Benc 64e74a3195 selftests/bpf/test_tcp_check_syncookie: use temp netns for testing
Bugzilla: https://bugzilla.redhat.com/2120966

commit ab6bcc20722775022c5ab0086824e9d2e3ceefcd
Author: Hangbin Liu <liuhangbin@gmail.com>
Date:   Tue Jan 25 16:17:15 2022 +0800

    selftests/bpf/test_tcp_check_syncookie: use temp netns for testing

    Use temp netns instead of hard code name for testing in case the
    netns already exists.

    Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
    Acked-by: Lorenz Bauer <lmb@cloudflare.com>
    Link: https://lore.kernel.org/r/20220125081717.1260849-6-liuhangbin@gmail.com
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2022-10-25 14:57:54 +02:00
Yauheni Kaliuta 339734a01e selftests/bpf: Switch SEC("classifier*") usage to a strict SEC("tc")
Bugzilla: http://bugzilla.redhat.com/2069045

commit c22bdd28257f3532092746b31856932d84ca2e2b
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Tue Sep 28 09:19:39 2021 -0700

    selftests/bpf: Switch SEC("classifier*") usage to a strict SEC("tc")
    
    Convert all SEC("classifier*") uses to a new and strict SEC("tc")
    section name. In reference_tracking selftests switch from ambiguous
    searching by program title (section name) to non-ambiguous searching by
    name in some selftests, getting closer to completely removing
    bpf_object__find_program_by_title().
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20210928161946.2512801-4-andrii@kernel.org

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:16:17 +03:00
Yauheni Kaliuta 9c4cd5c9f3 selftests/bpf: Normalize XDP section names in selftests
Bugzilla: http://bugzilla.redhat.com/2069045

commit 8fffa0e3451abdd84e4b4e427f7e66040eb24f43
Author: Andrii Nakryiko <andrii@kernel.org>
Date:   Tue Sep 28 09:19:38 2021 -0700

    selftests/bpf: Normalize XDP section names in selftests
    
    Convert almost all SEC("xdp_blah") uses to strict SEC("xdp") to comply
    with strict libbpf 1.0 logic of exact section name match for XDP program
    types. There is only one exception, which is only tested through
    iproute2 and defines multiple XDP programs within the same BPF object.
    Given iproute2 still works in non-strict libbpf mode and it doesn't have
    means to specify XDP programs by its name (not section name/title),
    leave that single file alone for now until iproute2 gains lookup by
    function/program name.
    
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Acked-by: Dave Marchevsky <davemarchevsky@fb.com>
    Link: https://lore.kernel.org/bpf/20210928161946.2512801-3-andrii@kernel.org

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:16:17 +03:00
Petar Penkov 91bc35789d selftests/bpf: add test for bpf_tcp_gen_syncookie
Modify the existing bpf_tcp_check_syncookie test to also generate a
SYN cookie, pass the packet to the kernel, and verify that the two
cookies are the same (and both valid). Since cloned SKBs are skipped
during generic XDP, this test does not issue a SYN cookie when run in
XDP mode. We therefore only check that a valid SYN cookie was issued at
the TC hook.

Additionally, verify that the MSS for that SYN cookie is within
expected range.

Signed-off-by: Petar Penkov <ppenkov@google.com>
Reviewed-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-07-30 21:03:05 -07:00
Lorenz Bauer bafc0ba826 selftests/bpf: add tests for bpf_tcp_check_syncookie and bpf_skc_lookup_tcp
Add tests which verify that the new helpers work for both IPv4 and
IPv6, by forcing SYN cookies to always on. Use a new network namespace
to avoid clobbering the global SYN cookie settings.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2019-03-21 18:59:11 -07:00