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

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: Support when CONFIG_VXLAN=m

If CONFIG_VXLAN is 'm', struct vxlanhdr will not be in vmlinux.h.
Add a ___local variant to support cases where vxlan is a module.

Fixes: 8517b1abe5ea ("selftests/bpf: Integrate test_tc_tunnel.sh tests into test_progs")
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260115163457.146267-1-alan.maguire@oracle.com

authored by

Alan Maguire and committed by
Andrii Nakryiko
47d440d0 999b2395

+13 -8
+13 -8
tools/testing/selftests/bpf/progs/test_tc_tunnel.c
··· 23 23 (((__u64)len & BPF_ADJ_ROOM_ENCAP_L2_MASK) \ 24 24 << BPF_ADJ_ROOM_ENCAP_L2_SHIFT) 25 25 26 - #define L2_PAD_SZ (sizeof(struct vxlanhdr) + ETH_HLEN) 26 + struct vxlanhdr___local { 27 + __be32 vx_flags; 28 + __be32 vx_vni; 29 + }; 30 + 31 + #define L2_PAD_SZ (sizeof(struct vxlanhdr___local) + ETH_HLEN) 27 32 28 33 #define UDP_PORT 5555 29 34 #define MPLS_OVER_UDP_PORT 6635 ··· 159 154 l2_len = ETH_HLEN; 160 155 if (ext_proto & EXTPROTO_VXLAN) { 161 156 udp_dst = VXLAN_UDP_PORT; 162 - l2_len += sizeof(struct vxlanhdr); 157 + l2_len += sizeof(struct vxlanhdr___local); 163 158 } else 164 159 udp_dst = ETH_OVER_UDP_PORT; 165 160 break; ··· 200 195 flags |= BPF_F_ADJ_ROOM_ENCAP_L2_ETH; 201 196 202 197 if (ext_proto & EXTPROTO_VXLAN) { 203 - struct vxlanhdr *vxlan_hdr = (struct vxlanhdr *)l2_hdr; 198 + struct vxlanhdr___local *vxlan_hdr = (struct vxlanhdr___local *)l2_hdr; 204 199 205 200 vxlan_hdr->vx_flags = VXLAN_FLAGS; 206 201 vxlan_hdr->vx_vni = VXLAN_VNI; 207 202 208 - l2_hdr += sizeof(struct vxlanhdr); 203 + l2_hdr += sizeof(struct vxlanhdr___local); 209 204 } 210 205 211 206 if (bpf_skb_load_bytes(skb, 0, l2_hdr, ETH_HLEN)) ··· 290 285 l2_len = ETH_HLEN; 291 286 if (ext_proto & EXTPROTO_VXLAN) { 292 287 udp_dst = VXLAN_UDP_PORT; 293 - l2_len += sizeof(struct vxlanhdr); 288 + l2_len += sizeof(struct vxlanhdr___local); 294 289 } else 295 290 udp_dst = ETH_OVER_UDP_PORT; 296 291 break; ··· 330 325 flags |= BPF_F_ADJ_ROOM_ENCAP_L2_ETH; 331 326 332 327 if (ext_proto & EXTPROTO_VXLAN) { 333 - struct vxlanhdr *vxlan_hdr = (struct vxlanhdr *)l2_hdr; 328 + struct vxlanhdr___local *vxlan_hdr = (struct vxlanhdr___local *)l2_hdr; 334 329 335 330 vxlan_hdr->vx_flags = VXLAN_FLAGS; 336 331 vxlan_hdr->vx_vni = VXLAN_VNI; 337 332 338 - l2_hdr += sizeof(struct vxlanhdr); 333 + l2_hdr += sizeof(struct vxlanhdr___local); 339 334 } 340 335 341 336 if (bpf_skb_load_bytes(skb, 0, l2_hdr, ETH_HLEN)) ··· 644 639 olen += ETH_HLEN; 645 640 break; 646 641 case VXLAN_UDP_PORT: 647 - olen += ETH_HLEN + sizeof(struct vxlanhdr); 642 + olen += ETH_HLEN + sizeof(struct vxlanhdr___local); 648 643 break; 649 644 } 650 645 break;