[PATCH bpf-next] selftests/bpf: Create the vxlan devices of test_tunnel with their MAC

From: Qiliang Yuan

Date: Thu Oct 08 2026 - 21:49:02 EST


The vxlan tests of test_tunnel create a tunnel device in the initial
netns with "ip link add", and then give it the MAC address that the
static neighbor entry at the other end points to with "ip link set".

systemd-udevd assigns new devices of the initial netns a MAC address of
its own, following its MACAddressPolicy, when it handles their uevent.
When it gets to that after the test set the address, the replies sent
to the configured MAC are dropped as meant for another host, and the
ping of vxlan_tunnel fails after 10 seconds.

Pass the address to "ip link add". udevd leaves alone the address of a
device that was created with one.

Fixes: 1ee7efd40abf ("selftests/bpf: Move vxlan tunnel testcases to test_progs")
Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
---
tools/testing/selftests/bpf/prog_tests/test_tunnel.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_tunnel.c b/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
index eb93099312720..7b35bf9498056 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_tunnel.c
@@ -161,9 +161,9 @@ static int add_vxlan_tunnel(void)
IP4_ADDR2_VETH1, MAC_VETH1);

/* root namespace */
- SYS(fail, "ip link add dev %s type vxlan external gbp dstport 4789",
- VXLAN_TUNL_DEV1);
- SYS(fail, "ip link set dev %s address %s up", VXLAN_TUNL_DEV1, MAC_TUNL_DEV1);
+ SYS(fail, "ip link add dev %s address %s type vxlan external gbp dstport 4789",
+ VXLAN_TUNL_DEV1, MAC_TUNL_DEV1);
+ SYS(fail, "ip link set dev %s up", VXLAN_TUNL_DEV1);
SYS(fail, "ip addr add dev %s %s/24", VXLAN_TUNL_DEV1, IP4_ADDR_TUNL_DEV1);
SYS(fail, "ip neigh add %s lladdr %s dev %s",
IP4_ADDR_TUNL_DEV0, MAC_TUNL_DEV0, VXLAN_TUNL_DEV1);
@@ -198,11 +198,10 @@ static int add_ip6vxlan_tunnel(void)
IP6VXLAN_TUNL_DEV0, MAC_TUNL_DEV0);

/* root namespace */
- SYS(fail, "ip link add dev %s type vxlan external dstport 4789",
- IP6VXLAN_TUNL_DEV1);
- SYS(fail, "ip addr add dev %s %s/24", IP6VXLAN_TUNL_DEV1, IP4_ADDR_TUNL_DEV1);
- SYS(fail, "ip link set dev %s address %s up",
+ SYS(fail, "ip link add dev %s address %s type vxlan external dstport 4789",
IP6VXLAN_TUNL_DEV1, MAC_TUNL_DEV1);
+ SYS(fail, "ip addr add dev %s %s/24", IP6VXLAN_TUNL_DEV1, IP4_ADDR_TUNL_DEV1);
+ SYS(fail, "ip link set dev %s up", IP6VXLAN_TUNL_DEV1);

return 0;
fail:

---
base-commit: e1d84a37cba984388988d2f1ddc84561413f0db2
change-id: 20261009-selftests-bpf-tunnel-vxlan-mac-6beb8f462156

Best regards,
--
Qiliang Yuan <odys.yuan@xxxxxxxxx>