From patchwork Tue Apr 23 10:35:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 13639749 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 3C738366; Tue, 23 Apr 2024 10:35:41 +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=1713868542; cv=none; b=AXIpuN1BO/xJRvXJ4Hd6PW2LihPf/xXcZK4rxOZ3bLegNzTkLfY4iEi1eXI0x2GBjdn6sdj0XgWAgtXvxgiOtj2cdrp48KFCRH/GM36bPFomajD6FsF2msvbrTLhuNcpBnDzn3zx8SGWV5HYycucfvaF/z6AQ2wX8q/Tf1ah45g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713868542; c=relaxed/simple; bh=927GFhMfXfYMLNk8yOCLs07K8ZIVRkvX1yZMSNtPvws=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fQQjDlRd3XHKoO4Ml09BqapDL2PhbWhgfC9VY0+S7HFLgPTOdfvAV40ADPQn5tuzIy4KdNwD5oYghKJrjr59991q6HbmU/BeT0rRtxOmgDuATNavF49C2DPjjcTTVmlO0mOl07YmMnGqdPlL6I9FRlgpKoKOVMqwmb3DexLKdDY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PO+sEYic; 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="PO+sEYic" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBB2C116B1; Tue, 23 Apr 2024 10:35:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713868541; bh=927GFhMfXfYMLNk8yOCLs07K8ZIVRkvX1yZMSNtPvws=; h=From:To:Cc:Subject:Date:From; b=PO+sEYicL5QEcnvszlRUvtw3GUAVmOYpKsmwOI/isSBENCuZJKZwil696KwTVz4th Xye1UItw99OduKqTHpfYn/pT4SpiwXZIGtDHGDX02VR/Me4YXm2Ws3AKCrdzr+R06B x7ytVSnRAvSI6/Z7qSOKibFCc90U6OAHPQf9K2id3pAZbYcj5bIEOgbIbNMfvRWrRp 3KN24mks9An7duCumXiPL6b7kj6Lo2SF/Rlf/VvmJ9GiTfM9gO+TrxGTGOV+dN6otb ISSFOJAfwANsZcj3nhxgdJrGlPafWxy7ENVe2HOk3FxrmF+zyy6swxpwektbsSkfvZ lX2+CDPgJ8ywQ== 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, Geliang Tang Subject: [PATCH bpf-next v2 0/5] use network helpers, part 2 Date: Tue, 23 Apr 2024 18:35:26 +0800 Message-Id: X-Mailer: git-send-email 2.40.1 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 This patchset uses more network helpers in test_sock_addr.c, but first of all, patch 2 is needed to make network_helpers.c independent of test_progs.c. Then network_helpers.h can be included into test_sock_addr.c without compile errors. Patch 1 and patch 2 address Martin's comments for the previous series too. v2: - Only a few minor cleanups to patch 5. Geliang Tang (5): selftests/bpf: Fix a fd leak in error paths in open_netns selftests/bpf: Use log_err in open_netns/close_netns selftests/bpf: Use start_server_addr in test_sock_addr selftests/bpf: Use connect_to_addr in test_sock_addr selftests/bpf: Use make_sockaddr in test_sock_addr tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf/network_helpers.c | 20 ++- tools/testing/selftests/bpf/network_helpers.h | 1 + .../selftests/bpf/prog_tests/empty_skb.c | 2 + .../bpf/prog_tests/ip_check_defrag.c | 2 + .../selftests/bpf/prog_tests/tc_redirect.c | 2 +- .../selftests/bpf/prog_tests/test_tunnel.c | 4 + .../selftests/bpf/prog_tests/xdp_metadata.c | 16 ++ tools/testing/selftests/bpf/test_sock_addr.c | 138 +++--------------- 9 files changed, 63 insertions(+), 125 deletions(-)