Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bpf: selftest: Use static globals in tcp_hdr_options and btf_skc_cls_ingress

Some globals in the tcp_hdr_options test and btf_skc_cls_ingress test
are not using static scope. This patch fixes it.

Targeting bpf-next branch as an improvement since it currently does not
break the build.

Fixes: ad2f8eb0095e ("bpf: selftests: Tcp header options")
Fixes: 9a856cae2217 ("bpf: selftest: Add test_btf_skc_cls_ingress")
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Link: https://lore.kernel.org/bpf/20201106225402.4135741-1-kafai@fb.com

authored by

Martin KaFai Lau and committed by
Andrii Nakryiko
f52b8fd3 666475cc

+7 -7
+1 -1
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c
··· 17 17 #include "test_btf_skc_cls_ingress.skel.h" 18 18 19 19 static struct test_btf_skc_cls_ingress *skel; 20 - struct sockaddr_in6 srv_sa6; 20 + static struct sockaddr_in6 srv_sa6; 21 21 static __u32 duration; 22 22 23 23 #define PROG_PIN_FILE "/sys/fs/bpf/btf_skc_cls_ingress"
+6 -6
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
··· 18 18 #define LO_ADDR6 "::1" 19 19 #define CG_NAME "/tcpbpf-hdr-opt-test" 20 20 21 - struct bpf_test_option exp_passive_estab_in; 22 - struct bpf_test_option exp_active_estab_in; 23 - struct bpf_test_option exp_passive_fin_in; 24 - struct bpf_test_option exp_active_fin_in; 25 - struct hdr_stg exp_passive_hdr_stg; 26 - struct hdr_stg exp_active_hdr_stg = { .active = true, }; 21 + static struct bpf_test_option exp_passive_estab_in; 22 + static struct bpf_test_option exp_active_estab_in; 23 + static struct bpf_test_option exp_passive_fin_in; 24 + static struct bpf_test_option exp_active_fin_in; 25 + static struct hdr_stg exp_passive_hdr_stg; 26 + static struct hdr_stg exp_active_hdr_stg = { .active = true, }; 27 27 28 28 static struct test_misc_tcp_hdr_options *misc_skel; 29 29 static struct test_tcp_hdr_options *skel;