Commit Graph

3 Commits

Author SHA1 Message Date
Jerome Marchand 380b7d9a90 selftests/bpf: Fix error compiling bpf_iter_setsockopt.c with musl libc
JIRA: https://issues.redhat.com/browse/RHEL-63880

commit 7b10f0c227ce3fa055d601f058dc411092a62a78
Author: Tony Ambardar <tony.ambardar@gmail.com>
Date:   Mon Jul 22 22:54:30 2024 -0700

    selftests/bpf: Fix error compiling bpf_iter_setsockopt.c with musl libc

    Existing code calls getsockname() with a 'struct sockaddr_in6 *' argument
    where a 'struct sockaddr *' argument is declared, yielding compile errors
    when building for mips64el/musl-libc:

      bpf_iter_setsockopt.c: In function 'get_local_port':
      bpf_iter_setsockopt.c:98:30: error: passing argument 2 of 'getsockname' from incompatible pointer type [-Werror=incompatible-pointer-types]
         98 |         if (!getsockname(fd, &addr, &addrlen))
            |                              ^~~~~
            |                              |
            |                              struct sockaddr_in6 *
      In file included from .../netinet/in.h:10,
                       from .../arpa/inet.h:9,
                       from ./test_progs.h:17,
                       from bpf_iter_setsockopt.c:5:
      .../sys/socket.h:391:23: note: expected 'struct sockaddr * restrict' but argument is of type 'struct sockaddr_in6 *'
        391 | int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict);
            |                       ^
      cc1: all warnings being treated as errors

    This compiled under glibc only because the argument is declared to be a
    "funky" transparent union which includes both types above. Explicitly cast
    the argument to allow compiling for both musl and glibc.

    Fixes: eed92afdd14c ("bpf: selftest: Test batching and bpf_(get|set)sockopt in bpf tcp iter")
    Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Acked-by: Geliang Tang <geliang@kernel.org>
    Link: https://lore.kernel.org/bpf/f41def0f17b27a23b1709080e4e3f37f4cc11ca9.1721713597.git.tony.ambardar@gmail.com

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
2025-01-13 17:36:35 +01:00
Yauheni Kaliuta 5db2ed5228 selfetest/bpf: Make some tests serial
Bugzilla: http://bugzilla.redhat.com/2069045

commit d3f7b1664d3ebd69751327f45f5cd4adfb29f620
Author: Yucong Sun <sunyucong@gmail.com>
Date:   Wed Oct 6 11:56:19 2021 -0700

    selfetest/bpf: Make some tests serial
    
    Change tests that often fails in parallel execution mode to serial.
    
    Signed-off-by: Yucong Sun <sunyucong@gmail.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20211006185619.364369-15-fallentree@fb.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-06-03 17:23:41 +03:00
Jiri Benc 315959ce9b bpf: selftest: Test batching and bpf_(get|set)sockopt in bpf tcp iter
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2071618

commit eed92afdd14c26b1e319fbe9eaa80e62ffa97a2c
Author: Martin KaFai Lau <kafai@fb.com>
Date:   Thu Jul 1 13:06:25 2021 -0700

    bpf: selftest: Test batching and bpf_(get|set)sockopt in bpf tcp iter

    This patch adds tests for the batching and bpf_(get|set)sockopt in
    bpf tcp iter.

    It first creates:
    a) 1 non SO_REUSEPORT listener in lhash2.
    b) 256 passive and active fds connected to the listener in (a).
    c) 256 SO_REUSEPORT listeners in one of the lhash2 bucket.

    The test sets all listeners and connections to bpf_cubic before
    running the bpf iter.

    The bpf iter then calls setsockopt(TCP_CONGESTION) to switch
    each listener and connection from bpf_cubic to bpf_dctcp.

    The bpf iter has a random_retry mode such that it can return EAGAIN
    to the usespace in the middle of a batch.

    Signed-off-by: Martin KaFai Lau <kafai@fb.com>
    Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
    Acked-by: Yonghong Song <yhs@fb.com>
    Link: https://lore.kernel.org/bpf/20210701200625.1036874-1-kafai@fb.com

Signed-off-by: Jiri Benc <jbenc@redhat.com>
2022-05-12 17:29:46 +02:00