From nobody Tue Feb 10 11:32:48 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDD0E32ED44 for ; Fri, 31 Oct 2025 09:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761901322; cv=none; b=ukLSf3Fad48FlyroMlvpkgLXjI4iNAxc+6nVmp1R+v8NeGGWjQkeMR/yBgnxHgazAEye0/BQwj80TQI6qFxOLIlMCl80YDewna5Bc+wjSytdyrWPiNSkOBptR/1xaHM3v7ancNB9NLVY9MboGwPFjhz6p1cQkZ2zRf0tSC4EeEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761901322; c=relaxed/simple; bh=pMUGzYjbOegFHkT1FuYNVbyBzYCy/Ejns06DI02dhcI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qrlC+xTDj4/Y2zlYrmB7c8ZxPhd62Rf190RC/w44X/sbKF53X9hzGcHIWs/WpVzjiCKiqpC55enUTaVaKtasuU6YolgJ8ErxIys9Q4u872DH27vwuk+soIlHbUIOA7pA1OqvTo6a1bHxao20gCZahgzg6XqVu9GhWbgXK2Ud1hI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=k3w+Tc2/; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="k3w+Tc2/" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 168C7C0E94E; Fri, 31 Oct 2025 09:01:38 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 92B7160704; Fri, 31 Oct 2025 09:01:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B7BEE11810848; Fri, 31 Oct 2025 10:01:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761901317; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OV3wcdNzU1YfXWJ7DsorNSNJWoONphM2tAJI5bX7CJo=; b=k3w+Tc2/LyqKRzh1F8MYwVSx5Bxpx9fY2jfwXYZsifPPCvZ1EPX48l88hxNgeQDiJ8I57J Rycs1WbQDn97olU+mvf5877HinAi/sAGpgFU1vyhNR5t1dpsvW+0gme1Qb6ZaQxnNlp7RP Bf+PX6Q8sowyJ7TLXZvraxD5oNlkWyLZ/EOGwMnDzIb0abGstJMc7RPxJrGaxtLbck+qxz RNa5En15rOzkAgQuzibPgvQkRUT6dbRrH9AMudxxUUS5Tiae9lJWIasRFplRPDgN/edpOA ljzOqea+BcIrCped1Tzw+C1q9ZUvFVPnA66J41U66Mktbaock+Tw+rnjdJe9ig== From: =?utf-8?q?Alexis_Lothor=C3=A9_=28eBPF_Foundation=29?= Date: Fri, 31 Oct 2025 10:01:43 +0100 Subject: [PATCH bpf-next 3/3] selftests/bpf: use start_server_str rather than start_reuseport_server in tc_tunnel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251031-tc_tunnel_improv-v1-3-0ffe44d27eda@bootlin.com> References: <20251031-tc_tunnel_improv-v1-0-0ffe44d27eda@bootlin.com> In-Reply-To: <20251031-tc_tunnel_improv-v1-0-0ffe44d27eda@bootlin.com> To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: ebpf@linuxfoundation.org, Thomas Petazzoni , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Bastien Curutchet , =?utf-8?q?Alexis_Lothor=C3=A9_=28eBPF_Foundation=29?= X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 test_tc_tunnel currently uses start_reuseport_server because it needs to frequently start and stop the server, so we need SO_REUSEPORT to avoid getting errors on server restart due to the socket being in TIME_WAIT state. But the test is only using one server at a time, so it is a bit confusing to use this API. Replace start_reuseport with start_sever_str, and provided the relevant callback to set SO_REUSEPORT. Signed-off-by: Alexis Lothor=C3=A9 (eBPF Foundation) --- .../selftests/bpf/prog_tests/test_tc_tunnel.c | 24 +++++++++++++++---= ---- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_tc_tunnel.c b/tool= s/testing/selftests/bpf/prog_tests/test_tc_tunnel.c index deea90aaefad..8e3fe6dc6221 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_tc_tunnel.c +++ b/tools/testing/selftests/bpf/prog_tests/test_tc_tunnel.c @@ -69,7 +69,7 @@ struct subtest_cfg { int client_egress_prog_fd; int server_ingress_prog_fd; char extra_decap_mod_args[TUNNEL_ARGS_MAX_LEN]; - int *server_fd; + int server_fd; }; =20 struct connection { @@ -131,20 +131,30 @@ static void set_subtest_addresses(struct subtest_cfg = *cfg) } } =20 +static int reuseport_cb(int fd, void *opts) +{ + int one =3D 1; + + return setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one)); +} + static int run_server(struct subtest_cfg *cfg) { int family =3D cfg->ipproto =3D=3D 6 ? AF_INET6 : AF_INET; + struct network_helper_opts opts =3D { + .timeout_ms =3D TIMEOUT_MS, + .post_socket_cb =3D reuseport_cb, + }; struct nstoken *nstoken; =20 nstoken =3D open_netns(SERVER_NS); if (!ASSERT_OK_PTR(nstoken, "open server ns")) return -1; =20 - cfg->server_fd =3D start_reuseport_server(family, SOCK_STREAM, - cfg->server_addr, TEST_PORT, - TIMEOUT_MS, 1); + cfg->server_fd =3D start_server_str(family, SOCK_STREAM, cfg->server_addr, + TEST_PORT, &opts); close_netns(nstoken); - if (!ASSERT_OK_PTR(cfg->server_fd, "start server")) + if (!ASSERT_OK_FD(cfg->server_fd, "start server")) return -1; =20 return 0; @@ -152,7 +162,7 @@ static int run_server(struct subtest_cfg *cfg) =20 static void stop_server(struct subtest_cfg *cfg) { - free_fds(cfg->server_fd, 1); + close(cfg->server_fd); } =20 static int check_server_rx_data(struct subtest_cfg *cfg, @@ -188,7 +198,7 @@ static struct connection *connect_client_to_server(stru= ct subtest_cfg *cfg) return NULL; } =20 - server_fd =3D accept(*cfg->server_fd, NULL, NULL); + server_fd =3D accept(cfg->server_fd, NULL, NULL); if (server_fd < 0) { close(client_fd); free(conn); --=20 2.51.1.dirty