From patchwork Mon Jun 17 08:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13700321 X-Patchwork-Delegate: bpf@iogearbox.net Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0874D190679; Mon, 17 Jun 2024 08:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718613241; cv=none; b=gPht25t4oQWKoOzlgz8/IeqUBLXW00GLwzR2uDjagucmvSSdEo+3mZW1BxFcYLppvMwrNx3sGOOfSVbR9XDWdMX1Ia6VcFBtL10+/UChAq89znLhbKCwlHUJWGL7uj6+MIrUHeVYu/estxw5AQGoX0gC2E2ScETYWoyI5VyznRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718613241; c=relaxed/simple; bh=ek0iCBSuhwxmBUkXZ25YiD2CARKWMEhFftoQUiEh56g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H+Qx16PsShcJFbOAbImIJMFTMOvkQoqc+I9EZpqDcC641l0X563liBd8ovaf5naOQGjVFxqPlO2UnwfpQObcocarCF4Mz+Wfrbxkxn8nIn61qAS2Jr3zaQGgfWsSRd9yTYhsb1R0myIgupbw3bPeV0u7jl1XkMMrYL4sTrYNSxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PAUys201; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PAUys201" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB4A0C4AF48; Mon, 17 Jun 2024 08:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718613240; bh=ek0iCBSuhwxmBUkXZ25YiD2CARKWMEhFftoQUiEh56g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAUys201J8c7+ROTjLTWwfsb8nz/U2qXjomVQzIoxGNWOUcvPqxrPkY3b64Vc7B9R pluexHMy56kqg8Vh5JkZeyJPZlJCndTDS8laqsglMGzjYbvYG04jniXmYlXINwuoWZ zubNlHg2rfMF0LR3Ri08zrOjQpIbUsnpZCofGtEfSLWDF9flsRxaUnA/XBp3DZdjU1 5NfiNtNMBCdHjDzWXn4AHYAXz+SGYyiIQkRkpho0QtF12UD6pF9UzPhsC9CfCVW7m9 00xJWNWc5VyHiJv758haO6j7tnu73yIGJQVYLGEfvj+SrD6XZPJdizo5rrVtFX/ZLL a6uRThP2vdC3Q== From: Geliang Tang To: Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan Cc: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH mptcp-next v3 6/6] selftests/bpf: Use start_server_str in test_tcp_check_syncookie_user Date: Mon, 17 Jun 2024 16:33:11 +0800 Message-ID: <5b1f4e6fd899a858d2357c4df7038364b9686176.1718612857.git.tanggeliang@kylinos.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: bpf@iogearbox.net From: Geliang Tang Since start_server_str() is added now, it can be used in script test_tcp_check_syncookie_user.c instead of start_server_addr() to simplify the code. Signed-off-by: Geliang Tang Acked-by: Eduard Zingerman --- .../bpf/test_tcp_check_syncookie_user.c | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c index aebc58c24dc5..3844f9b8232a 100644 --- a/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c +++ b/tools/testing/selftests/bpf/test_tcp_check_syncookie_user.c @@ -156,10 +156,6 @@ static int v6only_false(int fd, void *opts) int main(int argc, char **argv) { struct network_helper_opts opts = { 0 }; - struct sockaddr_in addr4; - struct sockaddr_in6 addr6; - struct sockaddr_in addr4dual; - struct sockaddr_in6 addr6dual; int server = -1; int server_v6 = -1; int server_dual = -1; @@ -181,36 +177,17 @@ int main(int argc, char **argv) goto err; } - memset(&addr4, 0, sizeof(addr4)); - addr4.sin_family = AF_INET; - addr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - addr4.sin_port = 0; - memcpy(&addr4dual, &addr4, sizeof(addr4dual)); - - memset(&addr6, 0, sizeof(addr6)); - addr6.sin6_family = AF_INET6; - addr6.sin6_addr = in6addr_loopback; - addr6.sin6_port = 0; - - memset(&addr6dual, 0, sizeof(addr6dual)); - addr6dual.sin6_family = AF_INET6; - addr6dual.sin6_addr = in6addr_any; - addr6dual.sin6_port = 0; - - server = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr4, - sizeof(addr4), NULL); + server = start_server_str(AF_INET, SOCK_STREAM, "127.0.0.1", 0, NULL); if (server == -1) goto err; opts.post_socket_cb = v6only_true; - server_v6 = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6, - sizeof(addr6), &opts); + server_v6 = start_server_str(AF_INET6, SOCK_STREAM, "::1", 0, &opts); if (server_v6 == -1) goto err; opts.post_socket_cb = v6only_false; - server_dual = start_server_addr(SOCK_STREAM, (struct sockaddr_storage *)&addr6dual, - sizeof(addr6dual), &opts); + server_dual = start_server_str(AF_INET6, SOCK_STREAM, "::0", 0, &opts); if (server_dual == -1) goto err;