Re: [PATCH bpf-next/net v5 3/3] selftests/bpf: Add mptcp subflow subtest

From: Matthieu Baerts
Date: Tue Sep 10 2024 - 10:55:49 EST


Hello,

On 10/09/2024 16:13, Matthieu Baerts (NGI0) wrote:
> From: Geliang Tang <tanggeliang@xxxxxxxxxx>
>
> This patch adds a subtest named test_subflow in test_mptcp to load and
> verify the newly added MPTCP subflow BPF program. To goal is to make
> sure it is possible to set different socket options per subflows, while
> the userspace socket interface only lets the application to set the same
> socket options for the whole MPTCP connection and its multiple subflows.
>
> To check that, a client and a server are started in a dedicated netns,
> with veth interfaces to simulate multiple paths. They will exchange data
> to allow the creation of an additional subflow.

(...)

> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index d2ca32fa3b21..c30f032edaca 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -335,10 +339,132 @@ static void test_mptcpify(void)
> close(cgroup_fd);
> }

(...)

> +static void wait_for_new_subflows(int fd)
> +{
> + socklen_t len;
> + u8 subflows;
> + int err, i;
> +
> + len = sizeof(subflows);
> + /* Wait max 1 sec for new subflows to be created */
> + for (i = 0; i < 10; i++) {
> + err = getsockopt(fd, SOL_MPTCP, MPTCP_INFO, &subflows, &len);
> + if (!err && subflows > 0)
> + break;
> +
> + sleep(0.1);

As reported by the CI, we are not in Python, usleep() should be used
here. I missed that one during my review. I will send a new version with
the fix tomorrow. Sorry for the noise.

Cheers,
Matt
--
Sponsored by the NGI0 Core fund.