From nobody Sat Apr 27 16:28:29 2024 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a02:9f92:0:0:0:0:0 with SMTP id a18csp166731jam; Fri, 4 Feb 2022 04:17:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxa73U4jyQ/8tx8e2icL54N4Qb0qSCYKECxl4Wj6bt03BmlpWWn6d0pJ/JdJISGss2Hrjv X-Received: by 2002:a62:7a0b:: with SMTP id v11mr2918916pfc.22.1643977032113; Fri, 04 Feb 2022 04:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643977032; cv=none; d=google.com; s=arc-20160816; b=J7RDSz/YTp2IWu/qiJc4H6yal+OM9KlN24R+/awTDmNQZnvOt4i1xDKwMz/Ibclfdm 6J06AvQEr3IQTi/QnNiS21A6pWQv5/wFinKFCiLmBEv06OMTvw7SNa4ruBDCvvFk09HW nbAqVs6D3Vx+fwIt6sthq3BB9K9H4Sui97VKTMv7Wxv7GhTum1YRtldk+ThmqDQ0g1jN OtrAOuIRabaiF7vO4feoHo3OkqSgsi+vCt8cmK7jKfcux70Ymm/riEiUBYcMnPCF2zpX 1vfsDpN9dW8Dw0t1i+15yIr8QbiDhfoVja/8OXcz9sOG/gJA4zUzgrKigKaE+wYWX8R0 Uk0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:to:from :dkim-signature; bh=xo9qGmFEA/D5yzoREm3/quxLstqTqHba0dUCg/M2xhQ=; b=tngbCMcPzpIZIfE2z/aNEIcsnjpTN2ew+ebULmMNYyCkfjrt54fucRKYJZkNxgPEqR a/ZXkPciYa9W4poJDG+3z7wCQsMR/nr8f83R024Nfo3C0qAbBR7it6p9g8cw7lISopkl nlGj/godn2Jeu2KtdpmlqA8HjyVMmqmzaXo8IocIAbWrVpYhmF99iGBFBFON2LWUICNA NwU/FHd7bq0nUVPx29yQqswLd4Mlpv6VOqKSerbi7nsPqVpE2rXbb1EPM+UcGoKXgUg7 9nHflvTK5ijl61wxRCXRezGwMz3JwC2jqFajG31bJYfbDh73mj+C0qFFrH9kdaaJC+UK bLIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YcFZnewn; spf=pass (google.com: domain of mptcp+bounces-3464-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3464-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id n16si1129003plc.514.2022.02.04.04.17.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Feb 2022 04:17:12 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3464-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YcFZnewn; spf=pass (google.com: domain of mptcp+bounces-3464-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-3464-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 sjc.edge.kernel.org (Postfix) with ESMTPS id 958233E102A for ; Fri, 4 Feb 2022 12:17:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4B4C2C9C; Fri, 4 Feb 2022 12:17:10 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0E3502F23 for ; Fri, 4 Feb 2022 12:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643977027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xo9qGmFEA/D5yzoREm3/quxLstqTqHba0dUCg/M2xhQ=; b=YcFZnewncJ7hyyv0w2gBJ/rjcrpu2+tUsidU7i+5mx2L6X4L2l2jxQBE6fK8YV9EPpPFLX 33jTBUS3drNkJ5jM8s4+3B+NUxs6bwID9+034Ci9ltV2mJAd0ZYeOAqjIexPKjfj2F4tUf G7eMG33FAuwBob3a0vONIbW8wtq8Hhk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-tMf6halWMDSyOYK-_HMMWQ-1; Fri, 04 Feb 2022 07:17:06 -0500 X-MC-Unique: tMf6halWMDSyOYK-_HMMWQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD29C835B4B for ; Fri, 4 Feb 2022 12:17:05 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.39.194.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C4AD73153 for ; Fri, 4 Feb 2022 12:17:04 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH v2 mptcp-next] selftests: mptcp: fix diag instability Date: Fri, 4 Feb 2022 13:17:00 +0100 Message-Id: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pabeni@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of waiting for an arbitrary amount of time for the MPTCP MP_CAPABLE handshake to complete, explicitly wait for the relevant socket to enter into the established status. Additionally let the data transfer application use the slowest transfer mode available (-r), to cope with very slow host, or high jitter caused by hosting VMs. Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau --- v1 -> v2: - use wait_for_ instead larger sleep - hopefully better commit message --- tools/testing/selftests/net/mptcp/diag.sh | 44 +++++++++++++++++++---- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/self= tests/net/mptcp/diag.sh index 2674ba20d524..ff821025d309 100755 --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -71,6 +71,36 @@ chk_msk_remote_key_nr() __chk_nr "grep -c remote_key" $* } =20 +# $1: ns, $2: port +wait_local_port_listen() +{ + local listener_ns=3D"${1}" + local port=3D"${2}" + + local port_hex i + + port_hex=3D"$(printf "%04X" "${port}")" + for i in $(seq 10); do + ip netns exec "${listener_ns}" cat /proc/net/tcp | \ + awk "BEGIN {rc=3D1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=3D0;= exit}} END {exit rc}" && + break + sleep 0.1 + done +} + +wait_connected() +{ + local listener_ns=3D"${1}" + local port=3D"${2}" + + local port_hex i + + port_hex=3D"$(printf "%04X" "${port}")" + for i in $(seq 10); do + ip netns exec ${listener_ns} grep -q " 0100007F:${port_hex} " /proc/net/= tcp && break + sleep 0.1 + done +} =20 trap cleanup EXIT ip netns add $ns @@ -81,15 +111,15 @@ echo "a" | \ ip netns exec $ns \ ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ 0.0.0.0 >/dev/null & -sleep 0.1 +wait_local_port_listen $ns 10000 chk_msk_nr 0 "no msk on netns creation" =20 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10000 -j -t ${timeout_poll} \ + ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \ 127.0.0.1 >/dev/null & -sleep 0.1 +wait_connected $ns 10000 chk_msk_nr 2 "after MPC handshake " chk_msk_remote_key_nr 2 "....chk remote_key" chk_msk_fallback_nr 0 "....chk no fallback" @@ -101,13 +131,13 @@ echo "a" | \ ip netns exec $ns \ ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ 0.0.0.0 >/dev/null & -sleep 0.1 +wait_local_port_listen $ns 10001 echo "b" | \ timeout ${timeout_test} \ ip netns exec $ns \ - ./mptcp_connect -p 10001 -j -t ${timeout_poll} \ + ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \ 127.0.0.1 >/dev/null & -sleep 0.1 +wait_connected $ns 10001 chk_msk_fallback_nr 1 "check fallback" flush_pids =20 @@ -119,7 +149,7 @@ for I in `seq 1 $NR_CLIENTS`; do ./mptcp_connect -p $((I+10001)) -l -w 10 \ -t ${timeout_poll} 0.0.0.0 >/dev/null & done -sleep 0.1 +wait_local_port_listen $ns $((NR_CLIENTS + 10001)) =20 for I in `seq 1 $NR_CLIENTS`; do echo "b" | \ --=20 2.34.1