Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1161082lqt; Fri, 7 Jun 2024 09:35:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUM1t5oedLUaUa5vCNF8cJl84vsowHZlP6ldf8OvL67O1VH+7uLmcNhBeoqiVGKyLRewwAhhcbYKH1iXCVsiqTLgwDts1YCrJC0sdnQDA== X-Google-Smtp-Source: AGHT+IGHEwqf4NLy0lm4eBFV0IzqLf99EEwfYxGjdfm1vD3EAbzNRtPDwIZYYmz2FhIrLHxxWjBI X-Received: by 2002:a05:6358:98a8:b0:183:90a2:f4ce with SMTP id e5c5f4694b2df-19f1f780cdcmr354679655d.0.1717778125962; Fri, 07 Jun 2024 09:35:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717778125; cv=pass; d=google.com; s=arc-20160816; b=NTc/1VT4Wxo7MlsKovOVADdRmKcrISsEQ01ZZcWaQXK4fjz4zY7Qfd/KqeagNs6B22 DSWGbnMul2VSHMM2ctwQk0NYZJBWZH5d06c9PzXx2ZSBL5O/gaN7570xWvlA81xKkdMu gFsQYy+b12M4/sLwx2QtL+ssPo48jRCy2h4N7mWFnIVwRCRcSS23K8ynCDo2W8K0lZHp OlkLQB5zqgzMZqGLsOMJqz7OMjBKs6VnS6UhCuAhHQKMgwNHcWcRP+/Pmq+muMUatcIE Dg7u27P9OH3aOS15iHlggf/+tGDKPX0TU7mFocF6H1PVtbJm3GBwYGYd8zFFE7XOFj7E bnKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=AeXX4e605Mcp0EVH5dcO2xlyRUkdZLzqH9+5M3ndF4o=; fh=O76ApABepEK3jjzBIa2lna0SNQprzYLk2J+YQI/CEhU=; b=ipNlYGVpl95M5FRs0G0UB9yqnVwOBl1FSBxEML6oxxCaDcMg6IAagSBDZXFzCi2Pwq VEPnyaM7A8oyQ3c6usbZZOb5on+YzJS089GDuOjuXyCb2Emkw/nkF4iSxqK4obzMet8i Ey4w4eGQSXA5VedzX3gWEH8FWAGlah9UUoMOOrRYT47OGy4DnqNPZI3ToaxM9e5/l5MA FDWhRNXJ6uGR+zfasJN+8nRkdqfCX1gPorq25Zb1Fl5eEKsonLZlHN31x0bTTU6RRseo jO0C8uIfq2+ObmqH0M36toeEdFUUWnWvogzeCmLDqEAvc9jUjaH4khwBBMYe4323d3k4 bLYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u6rxhvIF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206490-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de208317fcsi3399397a12.14.2024.06.07.09.35.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 09:35:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206490-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=u6rxhvIF; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-206490-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206490-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 889C12862D1 for ; Fri, 7 Jun 2024 16:35:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFEA21A01C1; Fri, 7 Jun 2024 16:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u6rxhvIF" 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 CF3DA19FA96; Fri, 7 Jun 2024 16:31:32 +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=1717777892; cv=none; b=Kp+DSgwjJBgbs7HYlxRtCeSnjbLGxm2GWP92j5gnyemovnTBPsiw1tnJ9gk3VTziFGbjRTi3s9AIzOu5j2xBxZAgZ9A1NHIG51gUOffSex4x5zxHb38R81TOpmxZTopDgQtZAyJNmkzQTFg947zSRuA2EI5VzFJj8LBAxVuUzNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717777892; c=relaxed/simple; bh=wQfj7qGRvIbdxyBHMllxfwfWwHu6K8la+zAXvBAGPhw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dfPbIHWSxlkUboUbx/idZeWmOTwAvQNYdilMqggz9GFmFZZ8UczQru4aWp0NEH8A5Ie00xeH67S0q9NAMjhYwXjNukG5sRsgQmdvdGpOc6qhLmSWbUU7DzchbuPQPTjvByJE2zQlhQ+XKZOm8zlXw+iiNTCAryBLhFFw1V31L0Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u6rxhvIF; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCE4FC2BBFC; Fri, 7 Jun 2024 16:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717777892; bh=wQfj7qGRvIbdxyBHMllxfwfWwHu6K8la+zAXvBAGPhw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u6rxhvIFAWPwvagwDcc3jbZfhN2UdYverQrMmjDQ2Q51Gmd2QFlaLqdnLrpssza8d CKMG/v6KwfjmjmugdNW2Lb+T6qPMi9kIoKHNtXcTi2FrTNlfn2j1YMUtsamT6xM0+C S6GmSWvm5bsd5nuprq7t/N/KNIyRJ+9E3pNAZz1Hv/FfhWTzCd9kxVi3XkrmPwwLGH 26oxhX4SaqDjJEyoLz0XlOeUvvTR9Z0gB+XrUpPI2AngsxyBB98XzlxrP0oMS90sbK b5WAP+awRlCYEhmkvjzziJRGRwtKHFfJq5y6+538n0DTVEMG7XDo8cjwsHL0MHWzI0 wJTHVgZmriiaw== From: "Matthieu Baerts (NGI0)" Date: Fri, 07 Jun 2024 18:31:07 +0200 Subject: [PATCH net-next 6/6] selftests: mptcp: lib: use wait_local_port_listen helper 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: 7bit Message-Id: <20240607-upstream-net-next-20240607-selftests-mptcp-net-lib-v1-6-e36986faac94@kernel.org> References: <20240607-upstream-net-next-20240607-selftests-mptcp-net-lib-v1-0-e36986faac94@kernel.org> In-Reply-To: <20240607-upstream-net-next-20240607-selftests-mptcp-net-lib-v1-0-e36986faac94@kernel.org> To: mptcp@lists.linux.dev, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Mat Martineau , Geliang Tang Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Geliang Tang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1644; i=matttbe@kernel.org; h=from:subject:message-id; bh=hTVnbzEs/VsxAGCcCO2AuB217Q1JKbIP3pRwVKJ7PZs=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmYzXPBcA4sCxBfarG1xUmQxlXn00WagQs+0cnG Bvz5J5yA4aJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZmM1zwAKCRD2t4JPQmmg c9mkEACVy5tLLQfLIZnrOaRPz5yK4BDZvZJWeWO4rxg4yBH/tdAIZSqGzWmefLVbg0x1wJVj4sj KiVB+sFZdDX3a/WITR6wU5ze5HveNiRBRDbFjLYe0ALNNxvRna6WL/nfk/1o1wZl/Y0mrHJg13K l0d6ZR1IRynKefzs6xAv8dtwDik6KA7h/EWbyefIZd56PHmM3SwHffiQG0tD/mBAhrT/XvQ5V8e 3kF/ANYpGmnlfJdAcQY+0gpMC6PIc8LkbcJLmQRjGgnaGA7Nk1O8v7diEf5Nz6hVkvoA/CloFGU eYcM/SpYR2jtb2Cqa/v9IKOHMaDXX9Vnr/K61G/0rQHjfhiOj0a8vNw1xKtU/eT2aG6Sv3M8uN7 uTdEE9mPGVC1RHF86ZB80KQ05G9gN9NBlQOx7W1H+hjzrSCPEa7lwpTGcRZWBzD4PC2nbt7MNn8 LAtkCx+me0kyE17XYT7nlCVNBIX3zdn7HmtzxlvDVM8BdplCDxBqj6zGH3GtPsd8aZlfwwsFx97 efUL/9qfZ3qn+DUvi6UlWOGEv8q4ildvas/qo6UrNT5VEw5ovZLb1N6klRLVs9uy653HttvAnde trzopBm5hHZcgeKjBlAITSmgsF4O4SNL4pC5COQGZlZaum9Oq3TdEol7O0OOJSshDz8Ji5pLNBd VcX9eTKX5m1K0nQ== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang This patch includes net_helper.sh into mptcp_lib.sh, uses the helper wait_local_port_listen() defined in it to implement the similar mptcp helper. This can drop some duplicate code. It looks like this helper from net_helper.sh was originally coming from MPTCP, but MPTCP selftests have not been updated to use it from this shared place. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_lib.sh b/tools/testing/selftests/net/mptcp/mptcp_lib.sh index d9e30516dc72..194c8fc2e55a 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_lib.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_lib.sh @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-2.0 . "$(dirname "${0}")/../lib.sh" +. "$(dirname "${0}")/../net_helper.sh" readonly KSFT_PASS=0 readonly KSFT_FAIL=1 @@ -363,20 +364,7 @@ mptcp_lib_check_transfer() { # $1: ns, $2: port mptcp_lib_wait_local_port_listen() { - local listener_ns="${1}" - local port="${2}" - - local port_hex - port_hex="$(printf "%04X" "${port}")" - - local _ - for _ in $(seq 10); do - ip netns exec "${listener_ns}" cat /proc/net/tcp* | \ - awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) \ - {rc=0; exit}} END {exit rc}" && - break - sleep 0.1 - done + wait_local_port_listen "${@}" "tcp" } mptcp_lib_check_output() { -- 2.43.0