[PATCH] selftests/bpf: fix tunnel option size in ip6geneve_set_tunnel()

From: Faisal Bukhari

Date: Fri May 15 2026 - 11:31:47 EST


Pass the correct size to bpf_skb_set_tunnel_opt() in
ip6geneve_set_tunnel().

sizeof(gopt) returns the size of the pointer instead of the
actual Geneve option structure, resulting in an incorrect
option length being passed to the helper. Use
sizeof(local_gopt) to provide the proper structure size.

Signed-off-by: Faisal Bukhari <faisalbukhari523@xxxxxxxxx>
---
tools/testing/selftests/bpf/progs/test_tunnel_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
index 30f1de458669d..ca04d1d1ade4e 100644
--- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
+++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
@@ -674,7 +674,7 @@ int ip6geneve_set_tunnel(struct __sk_buff *skb)
gopt->length = 2; /* 4-byte multiple */
*(int *) &gopt->opt_data = bpf_htonl(0xfeedbeef);

- ret = bpf_skb_set_tunnel_opt(skb, gopt, sizeof(gopt));
+ ret = bpf_skb_set_tunnel_opt(skb, gopt, sizeof(local_gopt));
if (ret < 0) {
log_err(ret);
return TC_ACT_SHOT;
--
2.43.0