selftests/bpf: Migrate test_tunnel.sh to test_progs
Subsystems (3)
v2 cover selftests/bpf: Migrate test_tunnel.sh to test_progs
Hi all,
This patch series continues the work to migrate the *.sh tests into prog_tests framework.
The test_tunnel.sh script has already been partly migrated to test_progs in prog_tests/test_tunnel.c so I add my work to it.
PATCH 1 & 2 create some helpers to avoid code duplication and ease the migration in the following patches.
PATCH 3 to 9 migrate the tests of gre, ip6gre, erspan, ip6erspan, geneve, ip6geneve and ip6tnl tunnels.
PATCH 10 removes test_tunnel.sh
---
Changes in v2:
- PATCH 1: Move tc_hook definition to attatch_tc_prog()
- PATCH 4: Disable DAD through ip addr
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Bastien Curutchet (eBPF Foundation) (10):
selftests/bpf: test_tunnel: Add generic_attach* helpers selftests/bpf: test_tunnel: Add ping helpers selftests/bpf: test_tunnel: Move gre tunnel test to test_progs selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs selftests/bpf: test_tunnel: Move erspan tunnel tests to test_progs selftests/bpf: test_tunnel: Move ip6erspan tunnel test to test_progs selftests/bpf: test_tunnel: Move geneve tunnel test to test_progs selftests/bpf: test_tunnel: Move ip6geneve tunnel test to test_progs selftests/bpf: test_tunnel: Move ip6tnl tunnel tests to test_progs selftests/bpf: test_tunnel: Remove test_tunnel.sh
tools/testing/selftests/bpf/Makefile | 1 - .../testing/selftests/bpf/prog_tests/test_tunnel.c | 633 ++++++++++++++++---- tools/testing/selftests/bpf/test_tunnel.sh | 645 --------------------- 3 files changed, 530 insertions(+), 749 deletions(-)
---
base-commit: 97b4501198b918f1d0adeb8205004d64f780e472
change-id: 20250131-tunnels-59b641ea3f10
Best regards,
Signature · 1 line
Bastien Curutchet (eBPF Foundation) <[email protected]>
PATCH v2 1/10 selftests/bpf: test_tunnel: Add generic_attach* helpers
A fair amount of code duplication is present among tests to attach BPF programs.
Create generic_attach* helpers that attach BPF programs to a given interface.
Use ASSERT_OK_FD() instead of ASSERT_GE() to check fd's validity. Use these helpers in all the available tests.
---
Changes in v2:
- Move tc_hook definition to attach_tc_prog()
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 140 ++++++++++----------- 1 file changed, 66 insertions(+), 74 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +66 -74
@@ -364,32 +364,34 @@ static int test_ping(int family, const char *addr)return -1 ; } -static int attach_tc_prog (struct bpf_tc_hook *hook,int igr_fd,int egr_fd) +static int attach_tc_prog (int ifindex,int igr_fd,int egr_fd) { + DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex = ifindex, + .attach_point = BPF_TC_INGRESS | BPF_TC_EGRESS); DECLARE_LIBBPF_OPTS(bpf_tc_opts, opts1, .handle = 1, .priority = 1, .prog_fd = igr_fd); DECLARE_LIBBPF_OPTS(bpf_tc_opts, opts2, .handle = 1, .priority = 1, .prog_fd = egr_fd);int ret; - ret =bpf_tc_hook_create (hook); + ret =bpf_tc_hook_create (&hook);if (!ASSERT_OK (ret,"create tc hook" ))return ret;if (igr_fd >=0 ) { - hook->attach_point =BPF_TC_INGRESS ; - ret =bpf_tc_attach (hook, &opts1); + hook.attach_point =BPF_TC_INGRESS ; + ret =bpf_tc_attach (&hook, &opts1);if (!ASSERT_OK (ret,"bpf_tc_attach" )) { -bpf_tc_hook_destroy (hook); +bpf_tc_hook_destroy (&hook);return ret; } }if (egr_fd >=0 ) { - hook->attach_point =BPF_TC_EGRESS ; - ret =bpf_tc_attach (hook, &opts2); + hook.attach_point =BPF_TC_EGRESS ; + ret =bpf_tc_attach (&hook, &opts2);if (!ASSERT_OK (ret,"bpf_tc_attach" )) { -bpf_tc_hook_destroy (hook); +bpf_tc_hook_destroy (&hook);return ret; } }
@@ -397,6 +399,50 @@ static int attach_tc_prog(struct bpf_tc_hook *hook, int igr_fd, int egr_fd)return 0 ; } +static int generic_attach (const char *dev,int igr_fd,int egr_fd) +{ +int ifindex; + +if (!ASSERT_OK_FD (igr_fd,"check ingress fd" )) +return -1 ; +if (!ASSERT_OK_FD (egr_fd,"check egress fd" )) +return -1 ; + + ifindex =if_nametoindex (dev); +if (!ASSERT_NEQ (ifindex,0 ,"get ifindex" )) +return -1 ; + +return attach_tc_prog (ifindex, igr_fd, egr_fd); +} + +static int generic_attach_igr (const char *dev,int igr_fd) +{ +int ifindex; + +if (!ASSERT_OK_FD (igr_fd,"check ingress fd" )) +return -1 ; + + ifindex =if_nametoindex (dev); +if (!ASSERT_NEQ (ifindex,0 ,"get ifindex" )) +return -1 ; + +return attach_tc_prog (ifindex, igr_fd,-1 ); +} + +static int generic_attach_egr (const char *dev,int egr_fd) +{ +int ifindex; + +if (!ASSERT_OK_FD (egr_fd,"check egress fd" )) +return -1 ; + + ifindex =if_nametoindex (dev); +if (!ASSERT_NEQ (ifindex,0 ,"get ifindex" )) +return -1 ; + +return attach_tc_prog (ifindex,-1 , egr_fd); +} +static void test_vxlan_tunnel (void ) {struct test_tunnel_kern *skel =NULL ;
@@ -404,11 +450,9 @@ static void test_vxlan_tunnel(void)int local_ip_map_fd =-1 ;int set_src_prog_fd, get_src_prog_fd;int set_dst_prog_fd; -int key =0 , ifindex =-1 ; +int key =0 ;uint local_ip;int err; -DECLARE_LIBBPF_OPTS (bpf_tc_hook, tc_hook, - .attach_point = BPF_TC_INGRESS);/* add vxlan tunnel */ err =add_vxlan_tunnel ();
@@ -419,42 +463,22 @@ static void test_vxlan_tunnel(void) skel =test_tunnel_kern__open_and_load ();if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) goto done; - ifindex =if_nametoindex (VXLAN_TUNL_DEV1 ); -if (!ASSERT_NEQ (ifindex,0 ,"vxlan11 ifindex" )) - goto done; - tc_hook.ifindex = ifindex; get_src_prog_fd =bpf_program__fd (skel->progs.vxlan_get_tunnel_src); set_src_prog_fd =bpf_program__fd (skel->progs.vxlan_set_tunnel_src); -if (!ASSERT_GE (get_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (!ASSERT_GE (set_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook, get_src_prog_fd, set_src_prog_fd)) +if (generic_attach (VXLAN_TUNL_DEV1 , get_src_prog_fd, set_src_prog_fd)) goto done;/* load and attach bpf prog to veth dev tc hook point */ - ifindex =if_nametoindex ("veth1" ); -if (!ASSERT_NEQ (ifindex,0 ,"veth1 ifindex" )) - goto done; - tc_hook.ifindex = ifindex; set_dst_prog_fd =bpf_program__fd (skel->progs.veth_set_outer_dst); -if (!ASSERT_GE (set_dst_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook, set_dst_prog_fd,-1 )) +if (generic_attach_igr ("veth1" , set_dst_prog_fd)) goto done;/* load and attach prog set_md to tunnel dev tc hook point at_ns0 */ nstoken =open_netns ("at_ns0" );if (!ASSERT_OK_PTR (nstoken,"setns src" )) goto done; - ifindex =if_nametoindex (VXLAN_TUNL_DEV0 ); -if (!ASSERT_NEQ (ifindex,0 ,"vxlan00 ifindex" )) - goto done; - tc_hook.ifindex = ifindex; set_dst_prog_fd =bpf_program__fd (skel->progs.vxlan_set_tunnel_dst); -if (!ASSERT_GE (set_dst_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook,-1 , set_dst_prog_fd)) +if (generic_attach_egr (VXLAN_TUNL_DEV0 , set_dst_prog_fd)) goto done;close_netns (nstoken);
@@ -488,11 +512,9 @@ static void test_ip6vxlan_tunnel(void)int local_ip_map_fd =-1 ;int set_src_prog_fd, get_src_prog_fd;int set_dst_prog_fd; -int key =0 , ifindex =-1 ; +int key =0 ;uint local_ip;int err; -DECLARE_LIBBPF_OPTS (bpf_tc_hook, tc_hook, - .attach_point = BPF_TC_INGRESS);/* add vxlan tunnel */ err =add_ip6vxlan_tunnel ();
@@ -503,31 +525,17 @@ static void test_ip6vxlan_tunnel(void) skel =test_tunnel_kern__open_and_load ();if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) goto done; - ifindex =if_nametoindex (IP6VXLAN_TUNL_DEV1 ); -if (!ASSERT_NEQ (ifindex,0 ,"ip6vxlan11 ifindex" )) - goto done; - tc_hook.ifindex = ifindex; get_src_prog_fd =bpf_program__fd (skel->progs.ip6vxlan_get_tunnel_src); set_src_prog_fd =bpf_program__fd (skel->progs.ip6vxlan_set_tunnel_src); -if (!ASSERT_GE (set_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (!ASSERT_GE (get_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook, get_src_prog_fd, set_src_prog_fd)) +if (generic_attach (IP6VXLAN_TUNL_DEV1 , get_src_prog_fd, set_src_prog_fd)) goto done;/* load and attach prog set_md to tunnel dev tc hook point at_ns0 */ nstoken =open_netns ("at_ns0" );if (!ASSERT_OK_PTR (nstoken,"setns src" )) goto done; - ifindex =if_nametoindex (IP6VXLAN_TUNL_DEV0 ); -if (!ASSERT_NEQ (ifindex,0 ,"ip6vxlan00 ifindex" )) - goto done; - tc_hook.ifindex = ifindex; set_dst_prog_fd =bpf_program__fd (skel->progs.ip6vxlan_set_tunnel_dst); -if (!ASSERT_GE (set_dst_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook,-1 , set_dst_prog_fd)) +if (generic_attach_egr (IP6VXLAN_TUNL_DEV0 , set_dst_prog_fd)) goto done;close_netns (nstoken);
@@ -559,10 +567,7 @@ static void test_ipip_tunnel(enum ipip_encap encap)struct test_tunnel_kern *skel =NULL ;struct nstoken *nstoken;int set_src_prog_fd, get_src_prog_fd; -int ifindex =-1 ;int err; -DECLARE_LIBBPF_OPTS (bpf_tc_hook, tc_hook, - .attach_point = BPF_TC_INGRESS);/* add ipip tunnel */ err =add_ipip_tunnel (encap);
@@ -573,10 +578,6 @@ static void test_ipip_tunnel(enum ipip_encap encap) skel =test_tunnel_kern__open_and_load ();if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) goto done; - ifindex =if_nametoindex (IPIP_TUNL_DEV1 ); -if (!ASSERT_NEQ (ifindex,0 ,"ipip11 ifindex" )) - goto done; - tc_hook.ifindex = ifindex;switch (encap) {case FOU :
@@ -598,11 +599,7 @@ static void test_ipip_tunnel(enum ipip_encap encap) skel->progs.ipip_set_tunnel); } -if (!ASSERT_GE (set_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (!ASSERT_GE (get_src_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook, get_src_prog_fd, set_src_prog_fd)) +if (generic_attach (IPIP_TUNL_DEV1 , get_src_prog_fd, set_src_prog_fd)) goto done;/* ping from root namespace test */
@@ -628,8 +625,6 @@ static void test_ipip_tunnel(enum ipip_encap encap)static void test_xfrm_tunnel (void ) { -DECLARE_LIBBPF_OPTS (bpf_tc_hook, tc_hook, - .attach_point = BPF_TC_INGRESS);LIBBPF_OPTS (bpf_xdp_attach_opts, opts);struct test_tunnel_kern *skel =NULL ;struct nstoken *nstoken;
@@ -646,19 +641,16 @@ static void test_xfrm_tunnel(void)if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) goto done; - ifindex =if_nametoindex ("veth1" ); -if (!ASSERT_NEQ (ifindex,0 ,"veth1 ifindex" )) - goto done;/* attach tc prog to tunnel dev */ - tc_hook.ifindex = ifindex; tc_prog_fd =bpf_program__fd (skel->progs.xfrm_get_state); -if (!ASSERT_GE (tc_prog_fd,0 ,"bpf_program__fd" )) - goto done; -if (attach_tc_prog (&tc_hook, tc_prog_fd,-1 )) +if (generic_attach_igr ("veth1" , tc_prog_fd)) goto done;/* attach xdp prog to tunnel dev */ + ifindex =if_nametoindex ("veth1" ); +if (!ASSERT_NEQ (ifindex,0 ,"veth1 ifindex" )) + goto done; xdp_prog_fd =bpf_program__fd (skel->progs.xfrm_get_state_xdp);if (!ASSERT_GE (xdp_prog_fd,0 ,"bpf_program__fd" )) goto done;
Signature · 1 line
2.48.1
Re: [PATCH bpf-next v2 01/10] selftests/bpf: test_tunnel: Add generic_attach* helpers
Quoted 9 lines · Bastien Curutchet (eBPF Foundation)
A fair amount of code duplication is present among tests to attach BPF programs.
Create generic_attach* helpers that attach BPF programs to a given interface.
UseASSERT_OK_FD()instead ofASSERT_GE()to check fd's validity. Use these helpers in all the available tests.Signed-off-by Bastien Curutchet (eBPF Foundation) <[email protected]>
PATCH v2 2/10 selftests/bpf: test_tunnel: Add ping helpers
In reply to Bastien Curutchet (eBPF Foundation)All tests use more or less the same ping commands as final validation. Also test_ping()'s return value is checked with ASSERT_OK() while this check is already done by the SYS() macro inside test_ping().
Create helpers around test_ping() and use them in the tests to avoid code duplication.
Remove the unnecessary ASSERT_OK() from the tests.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 53 ++++++++++------------ 1 file changed, 24 insertions(+), 29 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +24 -29
@@ -364,6 +364,25 @@ static int test_ping(int family, const char *addr)return -1 ; } +static void ping_dev0 (void ) +{ +/* ping from root namespace test */ +test_ping (AF_INET ,IP4_ADDR_TUNL_DEV0 ); +} + +static void ping_dev1 (void ) +{ +struct nstoken *nstoken; + +/* ping from at_ns0 namespace test */ + nstoken =open_netns ("at_ns0" ); +if (!ASSERT_OK_PTR (nstoken,"setns" )) +return ; + +test_ping (AF_INET ,IP4_ADDR_TUNL_DEV1 ); +close_netns (nstoken); +} +static int attach_tc_prog (int ifindex,int igr_fd,int egr_fd) { DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex = ifindex,
@@ -492,9 +511,7 @@ static void test_vxlan_tunnel(void) goto done;/* ping test */ - err =test_ping (AF_INET ,IP4_ADDR_TUNL_DEV0 ); -if (!ASSERT_OK (err,"test_ping" )) - goto done; +ping_dev0 (); done:/* delete vxlan tunnel */
@@ -549,9 +566,7 @@ static void test_ip6vxlan_tunnel(void) goto done;/* ping test */ - err =test_ping (AF_INET ,IP4_ADDR_TUNL_DEV0 ); -if (!ASSERT_OK (err,"test_ping" )) - goto done; +ping_dev0 (); done:/* delete ipv6 vxlan tunnel */
@@ -565,7 +580,6 @@ static void test_ip6vxlan_tunnel(void)static void test_ipip_tunnel (enum ipip_encap encap) {struct test_tunnel_kern *skel =NULL ; -struct nstoken *nstoken;int set_src_prog_fd, get_src_prog_fd;int err;
@@ -602,19 +616,8 @@ static void test_ipip_tunnel(enum ipip_encap encap)if (generic_attach (IPIP_TUNL_DEV1 , get_src_prog_fd, set_src_prog_fd)) goto done; -/* ping from root namespace test */ - err =test_ping (AF_INET ,IP4_ADDR_TUNL_DEV0 ); -if (!ASSERT_OK (err,"test_ping" )) - goto done; - -/* ping from at_ns0 namespace test */ - nstoken =open_netns ("at_ns0" ); -if (!ASSERT_OK_PTR (nstoken,"setns" )) - goto done; - err =test_ping (AF_INET ,IP4_ADDR_TUNL_DEV1 ); -if (!ASSERT_OK (err,"test_ping" )) - goto done; -close_netns (nstoken); +ping_dev0 (); +ping_dev1 (); done:/* delete ipip tunnel */
@@ -627,7 +630,6 @@ static void test_xfrm_tunnel(void) {LIBBPF_OPTS (bpf_xdp_attach_opts, opts);struct test_tunnel_kern *skel =NULL ; -struct nstoken *nstoken;int xdp_prog_fd;int tc_prog_fd;int ifindex;
@@ -658,14 +660,7 @@ static void test_xfrm_tunnel(void)if (!ASSERT_OK (err,"bpf_xdp_attach" )) goto done; -/* ping from at_ns0 namespace test */ - nstoken =open_netns ("at_ns0" ); -if (!ASSERT_OK_PTR (nstoken,"setns" )) - goto done; - err =test_ping (AF_INET ,IP4_ADDR_TUNL_DEV1 ); -close_netns (nstoken); -if (!ASSERT_OK (err,"test_ping" )) - goto done; +ping_dev1 ();if (!ASSERT_EQ (skel->bss->xfrm_reqid,1 ,"req_id" )) goto done;
Signature · 1 line
2.48.1
PATCH v2 3/10 selftests/bpf: test_tunnel: Move gre tunnel test to test_progs
In reply to Bastien Curutchet (eBPF Foundation)gre tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test gre tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_gre() and test_gre_no_tunnel_key() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 97 ++++++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 79 ------------------ 2 files changed, 97 insertions(+), 79 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +97 -0
@@ -98,6 +98,9 @@#define XFRM_SPI_IN_TO_OUT 0x1#define XFRM_SPI_OUT_TO_IN 0x2 +#define GRE_TUNL_DEV0 "gre00" +#define GRE_TUNL_DEV1 "gre11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -216,6 +219,18 @@ static int set_ipip_encap(const char *ipproto, const char *type)return -1 ; } +static int set_ipv4_addr (const char *dev0,const char *dev1) +{ +SYS (fail,"ip -n at_ns0 link set dev %s up" , dev0); +SYS (fail,"ip -n at_ns0 addr add dev %s %s/24" , dev0,IP4_ADDR_TUNL_DEV0 ); +SYS (fail,"ip link set dev %s up" , dev1); +SYS (fail,"ip addr add dev %s %s/24" , dev1,IP4_ADDR_TUNL_DEV1 ); + +return 0 ; +fail: +return 1 ; +} +static int add_ipip_tunnel (enum ipip_encap encap) {int err;
@@ -356,6 +371,31 @@ static void delete_xfrm_tunnel(void) IP4_ADDR1_VETH1, IP4_ADDR_VETH0, XFRM_SPI_OUT_TO_IN); } +static int add_ipv4_tunnel (const char *dev0,const char *dev1, +const char *type,const char *opt) +{ +if (!type || !opt || !dev0 || !dev1) +return -1 ; + +SYS (fail,"ip -n at_ns0 link add dev %s type %s %s local %s remote %s" , + dev0, type, opt,IP4_ADDR_VETH0 ,IP4_ADDR1_VETH1 ); + +SYS (fail,"ip link add dev %s type %s external" , dev1, type); + +return set_ipv4_addr (dev0, dev1); +fail: +return -1 ; +} + +static void delete_tunnel (const char *dev0,const char *dev1) +{ +if (!dev0 || !dev1) +return ; + +SYS_NOFAIL ("ip netns exec at_ns0 ip link delete dev %s" , dev0); +SYS_NOFAIL ("ip link delete dev %s" , dev1); +} +static int test_ping (int family,const char *addr) {SYS (fail,"%s %s %s > /dev/null" ,ping_command (family),PING_ARGS , addr);
@@ -677,6 +717,59 @@ static void test_xfrm_tunnel(void)test_tunnel_kern__destroy (skel); } +enum gre_test { +GRE , +GRE_NOKEY , +GRETAP , +GRETAP_NOKEY , +}; + +static void test_gre_tunnel (enum gre_test test) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + +switch (test) { +case GRE : + err =add_ipv4_tunnel (GRE_TUNL_DEV0 ,GRE_TUNL_DEV1 ,"gre" ,"seq" ); + set_fd =bpf_program__fd (skel->progs.gre_set_tunnel_no_key); + get_fd =bpf_program__fd (skel->progs.gre_get_tunnel); +break ; +case GRE_NOKEY : + err =add_ipv4_tunnel (GRE_TUNL_DEV0 ,GRE_TUNL_DEV1 ,"gre" ,"seq key 2" ); + set_fd =bpf_program__fd (skel->progs.gre_set_tunnel); + get_fd =bpf_program__fd (skel->progs.gre_get_tunnel); +break ; +case GRETAP : + err =add_ipv4_tunnel (GRE_TUNL_DEV0 ,GRE_TUNL_DEV1 ,"gretap" ,"seq" ); + set_fd =bpf_program__fd (skel->progs.gre_set_tunnel_no_key); + get_fd =bpf_program__fd (skel->progs.gre_get_tunnel); +break ; +case GRETAP_NOKEY : + err =add_ipv4_tunnel (GRE_TUNL_DEV0 ,GRE_TUNL_DEV1 ,"gretap" ,"seq key 2" ); + set_fd =bpf_program__fd (skel->progs.gre_set_tunnel); + get_fd =bpf_program__fd (skel->progs.gre_get_tunnel); +break ; + } +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + +if (generic_attach (GRE_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping_dev0 (); +ping_dev1 (); + +done: +delete_tunnel (GRE_TUNL_DEV0 ,GRE_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -694,6 +787,10 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (ipip_tunnel,FOU );RUN_TEST (ipip_tunnel,GUE );RUN_TEST (xfrm_tunnel); +RUN_TEST (gre_tunnel,GRE ); +RUN_TEST (gre_tunnel,GRE_NOKEY ); +RUN_TEST (gre_tunnel,GRETAP ); +RUN_TEST (gre_tunnel,GRETAP_NOKEY );return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -79
109 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 4/10 selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs
In reply to Bastien Curutchet (eBPF Foundation)ip6gre tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test ip6gre tunnels. It uses the same network topology and the same BPF programs than the script. Disable the IPv6 DAD feature because it can take lot of time and cause some tests to fail depending on the environment they're run on.
Remove test_ip6gre() and test_ip6gretap() from the script.
---
Changes in v2:
- Disable DAD through ip addr instead of using sysctl
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 104 +++++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 95 ------------------- 2 files changed, 104 insertions(+), 95 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +104 -0
@@ -71,6 +71,8 @@#define IP4_ADDR2_VETH1 "172.16.1.20"#define IP4_ADDR_TUNL_DEV0 "10.1.1.100"#define IP4_ADDR_TUNL_DEV1 "10.1.1.200" +#define IP6_ADDR_TUNL_DEV0 "fc80::100" +#define IP6_ADDR_TUNL_DEV1 "fc80::200"#define IP6_ADDR_VETH0 "::11"#define IP6_ADDR1_VETH1 "::22"
@@ -101,6 +103,9 @@#define GRE_TUNL_DEV0 "gre00"#define GRE_TUNL_DEV1 "gre11" +#define IP6GRE_TUNL_DEV0 "ip6gre00" +#define IP6GRE_TUNL_DEV1 "ip6gre11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -396,6 +401,43 @@ static void delete_tunnel(const char *dev0, const char *dev1)SYS_NOFAIL ("ip link delete dev %s" , dev1); } +static int set_ipv6_addr (const char *dev0,const char *dev1) +{ +/* disable IPv6 DAD because it might take too long and fail tests */ +SYS (fail,"ip -n at_ns0 addr add %s/96 dev veth0 nodad" ,IP6_ADDR_VETH0 ); +SYS (fail,"ip -n at_ns0 link set dev veth0 up" ); +SYS (fail,"ip addr add %s/96 dev veth1 nodad" ,IP6_ADDR1_VETH1 ); +SYS (fail,"ip link set dev veth1 up" ); + +SYS (fail,"ip -n at_ns0 addr add dev %s %s/24" , dev0,IP4_ADDR_TUNL_DEV0 ); +SYS (fail,"ip -n at_ns0 addr add dev %s %s/96 nodad" , dev0,IP6_ADDR_TUNL_DEV0 ); +SYS (fail,"ip -n at_ns0 link set dev %s up" , dev0); + +SYS (fail,"ip addr add dev %s %s/24" , dev1,IP4_ADDR_TUNL_DEV1 ); +SYS (fail,"ip addr add dev %s %s/96 nodad" , dev1,IP6_ADDR_TUNL_DEV1 ); +SYS (fail,"ip link set dev %s up" , dev1); +return 0 ; +fail: +return 1 ; +} + +static int add_ipv6_tunnel (const char *dev0,const char *dev1, +const char *type,const char *opt) +{ +if (!type || !opt || !dev0 || !dev1) +return -1 ; + +SYS (fail,"ip -n at_ns0 link add dev %s type %s %s local %s remote %s" , + dev0, type, opt,IP6_ADDR_VETH0 ,IP6_ADDR1_VETH1 ); + +SYS (fail,"ip link add dev %s type %s external" , dev1, type); + +return set_ipv6_addr (dev0, dev1); +fail: +return -1 ; +} + +static int test_ping (int family,const char *addr) {SYS (fail,"%s %s %s > /dev/null" ,ping_command (family),PING_ARGS , addr);
@@ -423,6 +465,24 @@ static void ping_dev1(void)close_netns (nstoken); } +static void ping6_veth0 (void ) +{ +test_ping (AF_INET6 ,IP6_ADDR_VETH0 ); +} + +static void ping6_dev1 (void ) +{ +struct nstoken *nstoken; + +/* ping from at_ns0 namespace test */ + nstoken =open_netns ("at_ns0" ); +if (!ASSERT_OK_PTR (nstoken,"setns" )) +return ; + +test_ping (AF_INET ,IP6_ADDR_TUNL_DEV1 ); +close_netns (nstoken); +} +static int attach_tc_prog (int ifindex,int igr_fd,int egr_fd) { DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex = ifindex,
@@ -770,6 +830,48 @@ static void test_gre_tunnel(enum gre_test test)test_tunnel_kern__destroy (skel); } +enum ip6gre_test { +IP6GRE , +IP6GRETAP +}; + +static void test_ip6gre_tunnel (enum ip6gre_test test) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + +switch (test) { +case IP6GRE : + err =add_ipv6_tunnel (IP6GRE_TUNL_DEV0 ,IP6GRE_TUNL_DEV1 , +"ip6gre" ,"flowlabel 0xbcdef key 2" ); +break ; +case IP6GRETAP : + err =add_ipv6_tunnel (IP6GRE_TUNL_DEV0 ,IP6GRE_TUNL_DEV1 , +"ip6gretap" ,"flowlabel 0xbcdef key 2" ); +break ; + } +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + + set_fd =bpf_program__fd (skel->progs.ip6gretap_set_tunnel); + get_fd =bpf_program__fd (skel->progs.ip6gretap_get_tunnel); +if (generic_attach (IP6GRE_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping6_veth0 (); +ping6_dev1 (); +ping_dev0 (); +ping_dev1 (); +done: +delete_tunnel (IP6GRE_TUNL_DEV0 ,IP6GRE_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -791,6 +893,8 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (gre_tunnel,GRE_NOKEY );RUN_TEST (gre_tunnel,GRETAP );RUN_TEST (gre_tunnel,GRETAP_NOKEY ); +RUN_TEST (ip6gre_tunnel,IP6GRE ); +RUN_TEST (ip6gre_tunnel,IP6GRETAP );return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -95
125 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH bpf-next v2 04/10] selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs
Quoted 10 lines · Bastien Curutchet (eBPF Foundation)
ip6gre tunnels are tested in the
test_tunnel.shbut not in thetest_progsframework.Add a new test in
test_progsto test ip6gre tunnels. It uses the same network topology and the same BPF programs than the script. Disable the IPv6 DAD feature because it can take lot of time and cause some tests to fail depending on the environment they're run on.
Removetest_ip6gre()andtest_ip6gretap()from the script.Signed-off-by Bastien Curutchet (eBPF Foundation) <[email protected]>
PATCH v2 5/10 selftests/bpf: test_tunnel: Move erspan tunnel tests to test_progs
In reply to Bastien Curutchet (eBPF Foundation)erspan tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test erspan tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_erspan() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 46 +++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 52 ---------------------- 2 files changed, 46 insertions(+), 52 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +46 -0
@@ -106,6 +106,9 @@#define IP6GRE_TUNL_DEV0 "ip6gre00"#define IP6GRE_TUNL_DEV1 "ip6gre11" +#define ERSPAN_TUNL_DEV0 "erspan00" +#define ERSPAN_TUNL_DEV1 "erspan11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -872,6 +875,47 @@ static void test_ip6gre_tunnel(enum ip6gre_test test)test_tunnel_kern__destroy (skel); } +enum erspan_test { +V1 , +V2 +}; + +static void test_erspan_tunnel (enum erspan_test test) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + +switch (test) { +case V1 : + err =add_ipv4_tunnel (ERSPAN_TUNL_DEV0 ,ERSPAN_TUNL_DEV1 , +"erspan" ,"seq key 2 erspan_ver 1 erspan 123" ); +break ; +case V2 : + err =add_ipv4_tunnel (ERSPAN_TUNL_DEV0 ,ERSPAN_TUNL_DEV1 , +"erspan" , +"seq key 2 erspan_ver 2 erspan_dir egress erspan_hwid 3" ); +break ; + } +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + + set_fd =bpf_program__fd (skel->progs.erspan_set_tunnel); + get_fd =bpf_program__fd (skel->progs.erspan_get_tunnel); +if (generic_attach (ERSPAN_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping_dev0 (); +ping_dev1 (); +done: +delete_tunnel (ERSPAN_TUNL_DEV0 ,ERSPAN_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -895,6 +939,8 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (gre_tunnel,GRETAP_NOKEY );RUN_TEST (ip6gre_tunnel,IP6GRE );RUN_TEST (ip6gre_tunnel,IP6GRETAP ); +RUN_TEST (erspan_tunnel,V1 ); +RUN_TEST (erspan_tunnel,V2 );return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -52
76 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 6/10 selftests/bpf: test_tunnel: Move ip6erspan tunnel test to test_progs
In reply to Bastien Curutchet (eBPF Foundation)ip6erspan tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test ip6erspan tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_ip6erspan() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 41 +++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 58 ---------------------- 2 files changed, 41 insertions(+), 58 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +41 -0
@@ -109,6 +109,9 @@#define ERSPAN_TUNL_DEV0 "erspan00"#define ERSPAN_TUNL_DEV1 "erspan11" +#define IP6ERSPAN_TUNL_DEV0 "ip6erspan00" +#define IP6ERSPAN_TUNL_DEV1 "ip6erspan11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -916,6 +919,42 @@ static void test_erspan_tunnel(enum erspan_test test)test_tunnel_kern__destroy (skel); } +static void test_ip6erspan_tunnel (enum erspan_test test) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + +switch (test) { +case V1 : + err =add_ipv6_tunnel (IP6ERSPAN_TUNL_DEV0 ,IP6ERSPAN_TUNL_DEV1 , +"ip6erspan" ,"seq key 2 erspan_ver 1 erspan 123" ); +break ; +case V2 : + err =add_ipv6_tunnel (IP6ERSPAN_TUNL_DEV0 ,IP6ERSPAN_TUNL_DEV1 , +"ip6erspan" , +"seq key 2 erspan_ver 2 erspan_dir egress erspan_hwid 7" ); +break ; + } +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + + set_fd =bpf_program__fd (skel->progs.ip4ip6erspan_set_tunnel); + get_fd =bpf_program__fd (skel->progs.ip4ip6erspan_get_tunnel); +if (generic_attach (IP6ERSPAN_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping6_veth0 (); +ping_dev1 (); +done: +delete_tunnel (IP6ERSPAN_TUNL_DEV0 ,IP6ERSPAN_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -941,6 +980,8 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (ip6gre_tunnel,IP6GRETAP );RUN_TEST (erspan_tunnel,V1 );RUN_TEST (erspan_tunnel,V2 ); +RUN_TEST (ip6erspan_tunnel,V1 ); +RUN_TEST (ip6erspan_tunnel,V2 );return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -58
82 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 7/10 selftests/bpf: test_tunnel: Move geneve tunnel test to test_progs
In reply to Bastien Curutchet (eBPF Foundation)geneve tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test geneve tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_geneve() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 45 ++++++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 45 ---------------------- 2 files changed, 45 insertions(+), 45 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +45 -0
@@ -112,6 +112,9 @@#define IP6ERSPAN_TUNL_DEV0 "ip6erspan00"#define IP6ERSPAN_TUNL_DEV1 "ip6erspan11" +#define GENEVE_TUNL_DEV0 "geneve00" +#define GENEVE_TUNL_DEV1 "geneve11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -443,6 +446,21 @@ static int add_ipv6_tunnel(const char *dev0, const char *dev1,return -1 ; } +static int add_geneve_tunnel (const char *dev0,const char *dev1, +const char *type,const char *opt) +{ +if (!type || !opt || !dev0 || !dev1) +return -1 ; + +SYS (fail,"ip -n at_ns0 link add dev %s type %s id 2 %s remote %s" , + dev0, type, opt,IP4_ADDR1_VETH1 ); + +SYS (fail,"ip link add dev %s type %s %s external" , dev1, type, opt); + +return set_ipv4_addr (dev0, dev1); +fail: +return -1 ; +}static int test_ping (int family,const char *addr) {
@@ -955,6 +973,32 @@ static void test_ip6erspan_tunnel(enum erspan_test test)test_tunnel_kern__destroy (skel); } +static void test_geneve_tunnel (void ) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + + err =add_geneve_tunnel (GENEVE_TUNL_DEV0 ,GENEVE_TUNL_DEV1 , +"geneve" ,"dstport 6081" ); +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + + set_fd =bpf_program__fd (skel->progs.geneve_set_tunnel); + get_fd =bpf_program__fd (skel->progs.geneve_get_tunnel); +if (generic_attach (GENEVE_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping_dev0 (); +ping_dev1 (); +done: +delete_tunnel (GENEVE_TUNL_DEV0 ,GENEVE_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +}#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -982,6 +1026,7 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (erspan_tunnel,V2 );RUN_TEST (ip6erspan_tunnel,V1 );RUN_TEST (ip6erspan_tunnel,V2 ); +RUN_TEST (geneve_tunnel);return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -45
75 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 8/10 selftests/bpf: test_tunnel: Move ip6geneve tunnel test to test_progs
In reply to Bastien Curutchet (eBPF Foundation)ip6geneve tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test ip6geneve tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_ip6geneve() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 48 +++++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 49 ---------------------- 2 files changed, 48 insertions(+), 49 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +48 -0
@@ -115,6 +115,9 @@#define GENEVE_TUNL_DEV0 "geneve00"#define GENEVE_TUNL_DEV1 "geneve11" +#define IP6GENEVE_TUNL_DEV0 "ip6geneve00" +#define IP6GENEVE_TUNL_DEV1 "ip6geneve11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -462,6 +465,22 @@ static int add_geneve_tunnel(const char *dev0, const char *dev1,return -1 ; } +static int add_ip6geneve_tunnel (const char *dev0,const char *dev1, +const char *type,const char *opt) +{ +if (!type || !opt || !dev0 || !dev1) +return -1 ; + +SYS (fail,"ip -n at_ns0 link add dev %s type %s id 22 %s remote %s" , + dev0, type, opt,IP6_ADDR1_VETH1 ); + +SYS (fail,"ip link add dev %s type %s %s external" , dev1, type, opt); + +return set_ipv6_addr (dev0, dev1); +fail: +return -1 ; +} +static int test_ping (int family,const char *addr) {SYS (fail,"%s %s %s > /dev/null" ,ping_command (family),PING_ARGS , addr);
@@ -999,6 +1018,34 @@ static void test_geneve_tunnel(void)delete_tunnel (GENEVE_TUNL_DEV0 ,GENEVE_TUNL_DEV1 );test_tunnel_kern__destroy (skel); } + +static void test_ip6geneve_tunnel (void ) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + + err =add_ip6geneve_tunnel (IP6GENEVE_TUNL_DEV0 ,IP6GENEVE_TUNL_DEV1 , +"geneve" ,"" ); +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + + set_fd =bpf_program__fd (skel->progs.ip6geneve_set_tunnel); + get_fd =bpf_program__fd (skel->progs.ip6geneve_get_tunnel); +if (generic_attach (IP6GENEVE_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping_dev0 (); +ping_dev1 (); +done: +delete_tunnel (IP6GENEVE_TUNL_DEV0 ,IP6GENEVE_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -1027,6 +1074,7 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (ip6erspan_tunnel,V1 );RUN_TEST (ip6erspan_tunnel,V2 );RUN_TEST (geneve_tunnel); +RUN_TEST (ip6geneve_tunnel);return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -49
73 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 9/10 selftests/bpf: test_tunnel: Move ip6tnl tunnel tests to test_progs
In reply to Bastien Curutchet (eBPF Foundation)ip6tnl tunnels are tested in the test_tunnel.sh but not in the test_progs framework.
Add a new test in test_progs to test ip6tnl tunnels. It uses the same network topology and the same BPF programs than the script. Remove test_ipip6() and test_ip6ip6() from the script.
--- .../testing/selftests/bpf/prog_tests/test_tunnel.c | 59 +++++++++++++++ tools/testing/selftests/bpf/test_tunnel.sh | 88 ---------------------- 2 files changed, 59 insertions(+), 88 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_tunnel.c +59 -0
@@ -118,6 +118,9 @@#define IP6GENEVE_TUNL_DEV0 "ip6geneve00"#define IP6GENEVE_TUNL_DEV1 "ip6geneve11" +#define IP6TNL_TUNL_DEV0 "ip6tnl00" +#define IP6TNL_TUNL_DEV1 "ip6tnl11" +#define PING_ARGS "-i 0.01 -c 3 -w 10 -q"static int config_device (void )
@@ -513,6 +516,11 @@ static void ping6_veth0(void)test_ping (AF_INET6 ,IP6_ADDR_VETH0 ); } +static void ping6_dev0 (void ) +{ +test_ping (AF_INET6 ,IP6_ADDR_TUNL_DEV0 ); +} +static void ping6_dev1 (void ) {struct nstoken *nstoken;
@@ -1046,6 +1054,55 @@ static void test_ip6geneve_tunnel(void)test_tunnel_kern__destroy (skel); } +enum ip6tnl_test { +IPIP6 , +IP6IP6 +}; + +static void test_ip6tnl_tunnel (enum ip6tnl_test test) +{ +struct test_tunnel_kern *skel; +int set_fd, get_fd; +int err; + + skel =test_tunnel_kern__open_and_load (); +if (!ASSERT_OK_PTR (skel,"test_tunnel_kern__open_and_load" )) +return ; + + err =add_ipv6_tunnel (IP6TNL_TUNL_DEV0 ,IP6TNL_TUNL_DEV1 ,"ip6tnl" ,"" ); +if (!ASSERT_OK (err,"add tunnel" )) + goto done; + +switch (test) { +case IPIP6 : + set_fd =bpf_program__fd (skel->progs.ipip6_set_tunnel); + get_fd =bpf_program__fd (skel->progs.ipip6_get_tunnel); +break ; +case IP6IP6 : + set_fd =bpf_program__fd (skel->progs.ip6ip6_set_tunnel); + get_fd =bpf_program__fd (skel->progs.ip6ip6_get_tunnel); +break ; + } +if (generic_attach (IP6TNL_TUNL_DEV1 , get_fd, set_fd)) + goto done; + +ping6_veth0 (); +switch (test) { +case IPIP6 : +ping_dev0 (); +ping_dev1 (); +break ; +case IP6IP6 : +ping6_dev0 (); +ping6_dev1 (); +break ; + } + +done: +delete_tunnel (IP6TNL_TUNL_DEV0 ,IP6TNL_TUNL_DEV1 ); +test_tunnel_kern__destroy (skel); +} +#define RUN_TEST (name, ...) \ ({ \ if (test__start_subtest(#name)) { \
@@ -1075,6 +1132,8 @@ static void *test_tunnel_run_tests(void *arg)RUN_TEST (ip6erspan_tunnel,V2 );RUN_TEST (geneve_tunnel);RUN_TEST (ip6geneve_tunnel); +RUN_TEST (ip6tnl_tunnel,IPIP6 ); +RUN_TEST (ip6tnl_tunnel,IP6IP6 );return NULL ; }
tools/testing/selftests/bpf/test_tunnel.sh +0 -88
112 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH v2 10/10 selftests/bpf: test_tunnel: Remove test_tunnel.sh
In reply to Bastien Curutchet (eBPF Foundation)All tests from test_tunnel.sh have been migrated into test test_progs. The last test remaining in the script is the test_ipip() that is already covered in the test_prog framework by the NONE case of test_ipip_tunnel().
Remove the test_tunnel.sh script and its Makefile entry
--- tools/testing/selftests/bpf/Makefile | 1 - tools/testing/selftests/bpf/test_tunnel.sh | 179 ----------------------------- 2 files changed, 180 deletions(-)
tools/testing/selftests/bpf/Makefile +0 -1
@@ -100,7 +100,6 @@ TEST_FILES = xsk_prereqs.sh $(wildcard progs/btf_dump_test_case_*.c) # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \ - test_tunnel.sh \ test_lwt_seg6local.sh \ test_lirc_mode2.sh \ test_xdp_vlan_mode_generic.sh \
tools/testing/selftests/bpf/test_tunnel.sh deleted +0 -179
179 lines not on this page · raw message
Signature · 1 line
2.48.1
This series was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Hello:
This series was applied to bpf/bpf-next.git (master) by Martin KaFai Lau <[email protected]>:
Quoted 9 lines · On Mon, 03 Mar 2025 09:22:48 +0100 you wrote:
Hi all,
This patch series continues the work to migrate the *.sh tests into
prog_testsframework.The
test_tunnel.shscript has already been partly migrated totest_progsinprog_tests/test_tunnel.cso I add my work to it.[...]
Here is the summary with links:
- [bpf-next,v2,01/10] selftests/bpf: test_tunnel: Add generic_attach* helpers
https://git.kernel.org/bpf/bpf-next/c/6829f3c51baf - [bpf-next,v2,02/10] selftests/bpf: test_tunnel: Add ping helpers https://git.kernel.org/bpf/bpf-next/c/7289e59a7667 - [bpf-next,v2,03/10] selftests/bpf: test_tunnel: Move gre tunnel test to test_progs https://git.kernel.org/bpf/bpf-next/c/08d20eaa0727 - [bpf-next,v2,04/10] selftests/bpf: test_tunnel: Move ip6gre tunnel test to test_progs https://git.kernel.org/bpf/bpf-next/c/1ea01a806e4c - [bpf-next,v2,05/10] selftests/bpf: test_tunnel: Move erspan tunnel tests to test_progs https://git.kernel.org/bpf/bpf-next/c/0ecd1e9d3237 - [bpf-next,v2,06/10] selftests/bpf: test_tunnel: Move ip6erspan tunnel test to test_progs https://git.kernel.org/bpf/bpf-next/c/cae41f74b778 - [bpf-next,v2,07/10] selftests/bpf: test_tunnel: Move geneve tunnel test to test_progs https://git.kernel.org/bpf/bpf-next/c/d89542d2534f - [bpf-next,v2,08/10] selftests/bpf: test_tunnel: Move ip6geneve tunnel test to test_progs https://git.kernel.org/bpf/bpf-next/c/8d8609430576 - [bpf-next,v2,09/10] selftests/bpf: test_tunnel: Move ip6tnl tunnel tests to test_progs https://git.kernel.org/bpf/bpf-next/c/680a75248df7 - [bpf-next,v2,10/10] selftests/bpf: test_tunnel: Remove test_tunnel.sh https://git.kernel.org/bpf/bpf-next/c/c8d6d78cea6e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html