Re: [PATCH bpf-next v1 2/2] bpf: sockopt_sk: fix 'undeclared' definition error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2/4/2025 10:39 AM, Jason Xing wrote:
> Error messages:
> selftests/bpf/prog_tests/sockopt_sk.c: In function ‘getsetsockopt’:
> selftests/bpf/prog_tests/sockopt_sk.c:22:31: error: field ‘zc’ has incomplete type
>    struct tcp_zerocopy_receive zc;
>                                ^~
> selftests/bpf/prog_tests/sockopt_sk.c:169:32: error: ‘TCP_ZEROCOPY_RECEIVE’ undeclared (first use in this function)
>   err = getsockopt(fd, SOL_TCP, TCP_ZEROCOPY_RECEIVE, &buf, &optlen);
>                                 ^~~~~~~~~~~~~~~~~~~~
>
> Fix it by introducing the right header.
>
> Signed-off-by: Jason Xing <kerneljasonxing@xxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/prog_tests/sockopt_sk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
> index ba6b3ec1156a..e0a9785ffcdc 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockopt_sk.c
> @@ -2,7 +2,7 @@
>  #include <test_progs.h>
>  #include "cgroup_helpers.h"
>  
> -#include <netinet/tcp.h>
> +#include <uapi/linux/tcp.h>

Should it be <linux/tcp.h> instead ? Directly including uapi header file
in application seems weird.
>  #include <linux/netlink.h>
>  #include "sockopt_sk.skel.h"
>  





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux