]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Set MACs during veth creation in tc_redirect
authorIlya Leoshkevich <iii@linux.ibm.com>
Wed, 16 Apr 2025 12:47:58 +0000 (14:47 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Wed, 23 Apr 2025 23:41:49 +0000 (16:41 -0700)
commit60400cd2b9bed537e6a2a8b580cfc3271e1aa672
treeee93aaf1203612d9b7abe9324d6150baf50c78e9
parentb9c09fb206a781b8933f93f530b9c03877dcef8b
selftests/bpf: Set MACs during veth creation in tc_redirect

tc_redirect/tc_redirect_dtime fails intermittently on some systems
with:

   (network_helpers.c:303: errno: Operation now in progress) Failed to connect to server

The problem is that on these systems systemd-networkd and systemd-udevd
are installed in the default configuration, which includes:

    /usr/lib/systemd/network/99-default.link
    /usr/lib/udev/rules.d/80-net-setup-link.rules

These configs instruct systemd to change MAC addresses of newly created
interfaces, which includes the ones created by BPF selftests. In this
particular case it causes SYN+ACK packets to be dropped, because they
get the PACKET_OTHERHOST type - the fact that this causes a connect()
on a blocking socket to return -EINPROGRESS looks like a bug, which
needs to be investigated separately.

systemd won't change the MAC address if the kernel reports that it was
already set by userspace; the NET_ADDR_SET check in
link_generate_new_hw_addr() is responsible for this.

In order to eliminate the race window between systemd and the test,
set MAC addresses during link creation. Ignore checkpatch's "quoted
string split across lines" warning, since it points to a command line,
and not a user-visible message.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250416124845.584362-1-iii@linux.ibm.com
tools/testing/selftests/bpf/prog_tests/tc_redirect.c