From patchwork Wed Jul 31 11:05:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815820 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 4D5671AE85E; Wed, 31 Jul 2024 11:06:20 +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=1722423980; cv=none; b=n5crIwsjtL/02P+IrQLxmIppqTd3nHBHmwoYYCDeF7qLSz0m1gEd0tURx3QAhWQ+zCa9ia6OYqCsjCtV9OV379soFyB9UQYmnKWchiNEtzgO5IbDyFYQMEgoQjvyh0GAuYS3ITZS36An2/NrVojQGRHIhb8J75cpLBMxBLijVB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722423980; c=relaxed/simple; bh=FmkH0+f1Fqx4WtwJID1fgBwuFioKVrOh3mCO/tO4RrU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bMqbEzElKP+ks+2359mpP8VOjxaJrXobzYVG0NvF+Cpe7SNW5u3ClwXLPEJK3EemG8HgcH9o/oHrmEHo7QBPsocXofDuoAQuqqVtKUin2RdtX1LvYZBig7M5F+0Ckldw4HzaVwRkq3hU47INjMuggEXHnu2/vUlkhYUQlgdNe9g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TC4Ulg+E; 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="TC4Ulg+E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DDABC116B1; Wed, 31 Jul 2024 11:06:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722423979; bh=FmkH0+f1Fqx4WtwJID1fgBwuFioKVrOh3mCO/tO4RrU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=TC4Ulg+Ep18OVuVjeJqfiIHM+AlZU1WKCBpGwlVjGdHRDSV4I+FKkLOEVQh57HTt1 FRB/zMftzBCFNTVoIJPyXi5ityL6J099RqDuqQubcPovJ9TlVzmdgyF9kcECwMBs27 j3ydHFgDcqQ6W7IyRnKWQKR0PpnJZuXQbMnaabyMdyjpE8li0yPlH1X/df5ZeaEK2G zKTWPQN6BB0/ZzmalygLDYUlQmknPm3lXzN3Y53ZiTBHNvk3aHtcJoZR0p7S65ABK6 C9I4/kp31/fHH/453Ac5/agficbQtZOUZMVFx9vbjVViG7kpS6QSz2nwOGIjMt6v+D 1v3+SPBKiPI3g== From: "Matthieu Baerts (NGI0)" Date: Wed, 31 Jul 2024 13:05:54 +0200 Subject: [PATCH net 2/7] mptcp: pm: deny endp with signal + subflow + port Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-2-c8a9b036493b@kernel.org> References: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> In-Reply-To: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1468; i=matttbe@kernel.org; h=from:subject:message-id; bh=FmkH0+f1Fqx4WtwJID1fgBwuFioKVrOh3mCO/tO4RrU=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmqhqiivhaBZFFCirPtnI6jP4wm2uKizquuPbib xIyyx1//iWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqoaogAKCRD2t4JPQmmg cz/7EACEnXwJ1umzoiyD9o6ZCfopCepktNq5klK8Rk5aNR4qDozgW8JbjVHV0XOgKmlY8BC2/Wk WuWCpcbSVjUzfE1/CcPRXC5XsnNkW0CNByHkUsNW+K+IPzNrvZIIkc1hwuZ50K3Gc0M0AzU2heP 5V+8LKYsGVdtJn6X97cwrp4v8NRricaFB0tgP58QsuOfsYuPDrN5SessXS2j6R9g9DpsCHD1C1o EMDzaPqxIPnUUYjq7wCWIs6fprzwEYfKK9XNN0zHrmAY/OI/DGvOXfrWqeoaC2qPfTK9mWW0He+ ZMo4ef0sZMeaNkFlfDTcl6V5EFK2vBd8fkfDEGkWig6h9/CzuiF3GERIHpddrppjBNwWAvCLQ1Q scQavo/1IjME/xpr92ngC7YdLGN3gySCCeoyjN7JhU7ceEwxhYiIgo9gqLd6bzYtYKfkoYnyTMW Fp+LLhA2pQ+IxhodHyONLV87trUXki/8+ut7kPUi/D9ftZuezDg5nwuuvykUSMJs1ocGornoRuh 4FQOq/t5e3/lQJ/GpXMbwUhoKTkDRVcryeiH18a6zocm+KSqMnVN33UuI7pUVdpe7vKy78N/mxX hLpew1Ux8MmoKqxv7PsginwfJEAc4HSAhEH6p9YZ6QGLYgKsWI7itcXtgQ/yK9Mi3VMQaWOJwGi WAUqf2ouyge8G0g== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 As mentioned in the 'Fixes' commit, the port flag is only supported by the 'signal' flag, and not by the 'subflow' one. Then if both the 'signal' and 'subflow' flags are set, the problem is the same: the feature cannot work with the 'subflow' flag. Technically, if both the 'signal' and 'subflow' flags are set, it will be possible to create the listening socket, but not to establish a subflow using this source port. So better to explicitly deny it, not to create some confusions because the expected behaviour is not possible. Fixes: 09f12c3ab7a5 ("mptcp: allow to use port and non-signal in set_flags") Cc: stable@vger.kernel.org Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 37954a0b087d..c921d07e5940 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -1328,8 +1328,8 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info) if (ret < 0) return ret; - if (addr.addr.port && !(addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) { - GENL_SET_ERR_MSG(info, "flags must have signal when using port"); + if (addr.addr.port && !address_use_port(&addr)) { + GENL_SET_ERR_MSG(info, "flags must have signal and not subflow when using port"); return -EINVAL; } From patchwork Wed Jul 31 11:05:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815819 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 C5EBF1AD9C6; Wed, 31 Jul 2024 11:06:26 +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=1722423986; cv=none; b=moS+5P6DqM7pQgh6mWhNJUpAWY7fjXqyNmtGua04F7EgQt+7pbMJedlvlLgcbr6xadATgsYvngkBej34ToMtGFwNIQtFnXzkrmnax9jMb6y3tiWGvSP5dsQgvc3wVrnnGSTaEk/awiHbOSG51P42N5bQqAtIgSTihuOCA0hCMsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722423986; c=relaxed/simple; bh=ucPLpyidAabxDmr1HFVxowabnIMprlmWSuibzybqmAA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WP1ogo+ROg9PfA2f060o+ECfz43Tlai3lm7LxW0yjVUmXAw4iVQ0nlxl0Vlz05vFX2m7po6Orv/9CP4q6rcFZd6N4FAYoQLrkqB8bT81cuJJ5JS/1J4UdAujv1dHILcPDFpn+KOl+JCCErJtNl16sAdfCROWEUxh+9hWm1IyvJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AyXPVGwE; 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="AyXPVGwE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BDF3C116B1; Wed, 31 Jul 2024 11:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722423986; bh=ucPLpyidAabxDmr1HFVxowabnIMprlmWSuibzybqmAA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AyXPVGwEjyG6x+3m+yBeLcssWdtZx2ABrkQYAA0Fm7BFn+BV2znAMxYk35LdEPXyQ MckvKrBJ/qtHrWeR4onoYTm7hW+HCcyAdUmn0QURcJcABGa80cmPL2pZan5Ytev8k1 94tY4dobSSLKeohEjI7jyzgdDPL7icn6gt7sMxf/H4icIGV+LPCL1lAL4zwOxDhHAk RYbx/V9cZ6CDsuFQYsm/V6equZ4Cxt+3NYShC6u5EOPHV4mFtu6tgwocSciVWddmX1 njFIPM06MDqITCH71qy59vPnhM0cQf+R+6THxRK6H3VFLjMq53URlIfeCclPAjrMfM Zk4j1aiuDFV1A== From: "Matthieu Baerts (NGI0)" Date: Wed, 31 Jul 2024 13:05:56 +0200 Subject: [PATCH net 4/7] mptcp: pm: don't try to create sf if alloc failed Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-4-c8a9b036493b@kernel.org> References: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> In-Reply-To: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2240; i=matttbe@kernel.org; h=from:subject:message-id; bh=ucPLpyidAabxDmr1HFVxowabnIMprlmWSuibzybqmAA=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmqhqiEzR0/Bx3PYsDk6c9qKT1TOf03HKnCKWrW Cp4i7OpwJSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqoaogAKCRD2t4JPQmmg czScEADD382M04ZC2EZjc7pwk7OJrYE+/GJgo4BQnBAINQofX8YQT+krva4UQS6haHZ82kfqABO H7VEUSRBeu71jEGsp2CwopTcR/gRr20BBKyOOAAmY9nA9Ti2uMFFzOt6UFz7PQN6X/8i8jWfMGz M+Y59imDUwedWHR4eZ1a2KazMmcm+Y4Ly6ng+RcVNYD8eI5oZAOpVP88IOJUe1oa0sMB5PCfON6 cJPZVooOMsIz69eFJWzkWN1vEksvNHZ2ERkCga+dJjE8AmezLISVbonVyFOdtrnKb4/pMyK+xlz 6P49u9GLh11YZOiUPeSaARr1dnFeYbZhxqFi4a2IXzCHbYsWF0ObCDGFPjDZPx/Lsrvp/Z56E19 vIerovE3Y1g8YklatplfGvTbwTtZHbriakjhJ9Vl9C25siqJR5tVmKRTCNH5bTWUH6eH4jJ3R+W gaFyz/gZmoxTKqiacZW4GyYIhvY1et9KJLH7J2ihTffK9XQHCok2Yx1BRzeoKlApx91Yxo0QHiu 8BkszTlx2b2OOudk913MIxmaKYHdWvA5FbDsXBZgrBk1Xgicj9vYLJXsp/Wn4nmjilkMJ/LTQBn sPMquwWb5eMWpaHfikM0xs4Y09eHAnwLa/yaFgEQTW1EB7UJLeoNd3LlgrpIo+Aa1DVkddkWTfT 5bTgstTLYFGt35w== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 It sounds better to avoid wasting cycles and / or put extreme memory pressure on the system by trying to create new subflows if it was not possible to add a new item in the announce list. While at it, a warning is now printed if the entry was already in the list as it should not happen with the in-kernel path-manager. With this PM, mptcp_pm_alloc_anno_list() should only fail in case of memory pressure. Fixes: b6c08380860b ("mptcp: remove addr and subflow in PM netlink") Cc: stable@vger.kernel.org Suggested-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/pm_netlink.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 780f4cca165c..2be7af377cda 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -348,7 +348,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, add_entry = mptcp_lookup_anno_list_by_saddr(msk, addr); if (add_entry) { - if (mptcp_pm_is_kernel(msk)) + if (WARN_ON_ONCE(mptcp_pm_is_kernel(msk))) return false; sk_reset_timer(sk, &add_entry->add_timer, @@ -555,8 +555,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) /* check first for announce */ if (msk->pm.add_addr_signaled < add_addr_signal_max) { - local = select_signal_address(pernet, msk); - /* due to racing events on both ends we can reach here while * previous add address is still running: if we invoke now * mptcp_pm_announce_addr(), that will fail and the @@ -567,11 +565,15 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL)) return; + local = select_signal_address(pernet, msk); if (!local) goto subflow; + /* If the alloc fails, we are on memory pressure, not worth + * continuing, and trying to create subflows. + */ if (!mptcp_pm_alloc_anno_list(msk, &local->addr)) - goto subflow; + return; __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); msk->pm.add_addr_signaled++; From patchwork Wed Jul 31 11:05:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthieu Baerts \(NGI0\)" X-Patchwork-Id: 815818 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 6D2A41B1417; Wed, 31 Jul 2024 11:06: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=1722423992; cv=none; b=XeOFRgVAWlTwqX4kaVgbaQddRoSTsOalT9t5J5UqDEaUmsN7IdkUkKVguIY7flEzCHqGF+1MyLsGopV6PrPDQEDPZnVQwGWHbQ1z2u4VGOrJJ0t/9j0/2xJSXC0Tca2Ski52dLS7jnnlqo+b/jSQA760w4N65nU3uAv1liBsHzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722423992; c=relaxed/simple; bh=GF9ZuUb1kC7ALkbKTAdDrcfBWVUj2E5ba2obD4Bwp5I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IXkJzxQ6YjSZcEPv3j1GMuSBQn9nOKxVHAevvJB0f3+P6STIC2mC9zuxhbeVKqzXGlLFBwAM2fForf386spArSQn3N7qLRytEVDWL12tNzVLJaPm1WoPoLff72GHP89YgzggZPNKx03+YceEHbHn5poenbQd9pQxDE51HvHUjZA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QkFaRPmT; 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="QkFaRPmT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAF6DC4AF10; Wed, 31 Jul 2024 11:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722423992; bh=GF9ZuUb1kC7ALkbKTAdDrcfBWVUj2E5ba2obD4Bwp5I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QkFaRPmTofrGDHBzophnwvQs52/o8dLjL0DgIPiWuJczP+laDoqk7OXtKnfe5Mxwi 7b5m8nT8CXvoCyk2kT22SGtQfl5JoJA+GLVaK5ajQrxPnBnUltNGcThT+fB+5c9c3n MrJUsByVIbr6+wu1U74nmLoDtXZZ7FfUOSsmv2ICaKiqEd6+Q7A82KWQYZyPuU7HMQ gzVzikARQTxyDEwwY9sprCy7yEd5XQLa3iJO6IwOIGWirNCmpzesr0ek5JL8aGc/T1 PAk7VcFgLWlAm7z99bwkWGf9jW3788qf+r56OiMoLSeMZ2I/ideLmxI6hFA8SV90Hm NSlGe74BUpWlg== From: "Matthieu Baerts (NGI0)" Date: Wed, 31 Jul 2024 13:05:58 +0200 Subject: [PATCH net 6/7] selftests: mptcp: join: ability to invert ADD_ADDR check Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-6-c8a9b036493b@kernel.org> References: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> In-Reply-To: <20240731-upstream-net-20240731-mptcp-endp-subflow-signal-v1-0-c8a9b036493b@kernel.org> To: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, "Matthieu Baerts (NGI0)" X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4336; i=matttbe@kernel.org; h=from:subject:message-id; bh=GF9ZuUb1kC7ALkbKTAdDrcfBWVUj2E5ba2obD4Bwp5I=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmqhqi7s6RNgEUk85ovrvmaAHGLEk++7ljJcA+U gRV0bKTKpSJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZqoaogAKCRD2t4JPQmmg c3IrD/9Mut2dYeV3HYEKGvVtEvg9Dw5pWHvinVqlI5nSmsAR762+NtDsAhS6VYokYzNFfyScwAj w2rDoeUHAUdaLa5BoDwm1Gjq9kpmqLt0ygyGDcPJSf7cKG9XphnPhWg8NtsQQ92X9V6vm7nNCyZ 70jfKY5WCHEzGJmBR8N8fIpGoPnVQUKXm8s6KdpsIZOvpxdkuy5e/v7jWypLiSeAR2saRGq6Dz9 Pcq1lOU4PWQBjq2hKd+3BLc32byM6ZAJrepCoSB9oZbZTseQ4JoK+l3CrfdbFURrfcPCOJttE1L XOk2eTESQ0Z8owjCo1YFHjJotOUv+EnQjKhTculjT3y7L0/WFVuXF/RmpogVg+0WuykuWQehRlU IFTUpayFSdZAnjCuxezntCXgf+qaP4XKPqbSnnN1s4YjHDGi2AA6+mhFFkE28tO+zXn4mRyzyg/ DrFIC4hKBgtn+DcZ2+6hCOUyu9XMReHA2pFWw0ewoXDAxh+AQEsh4Kxr2zTgmfXLeLhK+DJ1KVd iHm2nd7Id/3Mki2aaZwqcxK3OtjKcHC0Kkos+RrnVDCIN1B8zUqWKM/tRh/e80Lx4XqGv/+RZGD 83PncMgDHzGHpNhXHii6jAzonT9+5rCTYpHAox66/8hBR0yOUQ0V9TgNXob88Y/foEWA3RVdfHH ZENFvLZeX+BHu6Q== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 In the following commit, the client will initiate the ADD_ADDR, instead of the server. We need to way to verify the ADD_ADDR have been correctly sent. Note: the default expected counters for when the port number is given are never changed by the caller, no need to accept them as parameter then. The 'Fixes' tag here below is the same as the one from the previous commit: this patch here is not fixing anything wrong in the selftests, but it validates the previous fix for an issue introduced by this commit ID. Fixes: 86e39e04482b ("mptcp: keep track of local endpoint still available for each msk") Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts (NGI0) --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 40 ++++++++++++++++--------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 4df48f1f14ab..52a25ac43d10 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -1415,18 +1415,28 @@ chk_add_nr() local add_nr=$1 local echo_nr=$2 local port_nr=${3:-0} - local syn_nr=${4:-$port_nr} - local syn_ack_nr=${5:-$port_nr} - local ack_nr=${6:-$port_nr} - local mis_syn_nr=${7:-0} - local mis_ack_nr=${8:-0} + local ns_invert=${4:-""} + local syn_nr=$port_nr + local syn_ack_nr=$port_nr + local ack_nr=$port_nr + local mis_syn_nr=0 + local mis_ack_nr=0 + local ns_tx=$ns1 + local ns_rx=$ns2 + local extra_msg="" local count local timeout - timeout=$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) + if [[ $ns_invert = "invert" ]]; then + ns_tx=$ns2 + ns_rx=$ns1 + extra_msg="invert" + fi + + timeout=$(ip netns exec ${ns_tx} sysctl -n net.mptcp.add_addr_timeout) print_check "add" - count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtAddAddr") + count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtAddAddr") if [ -z "$count" ]; then print_skip # if the test configured a short timeout tolerate greater then expected @@ -1438,7 +1448,7 @@ chk_add_nr() fi print_check "echo" - count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtEchoAdd") + count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtEchoAdd") if [ -z "$count" ]; then print_skip elif [ "$count" != "$echo_nr" ]; then @@ -1449,7 +1459,7 @@ chk_add_nr() if [ $port_nr -gt 0 ]; then print_check "pt" - count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtPortAdd") + count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtPortAdd") if [ -z "$count" ]; then print_skip elif [ "$count" != "$port_nr" ]; then @@ -1459,7 +1469,7 @@ chk_add_nr() fi print_check "syn" - count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortSynRx") + count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortSynRx") if [ -z "$count" ]; then print_skip elif [ "$count" != "$syn_nr" ]; then @@ -1470,7 +1480,7 @@ chk_add_nr() fi print_check "synack" - count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtMPJoinPortSynAckRx") + count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPJoinPortSynAckRx") if [ -z "$count" ]; then print_skip elif [ "$count" != "$syn_ack_nr" ]; then @@ -1481,7 +1491,7 @@ chk_add_nr() fi print_check "ack" - count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMPJoinPortAckRx") + count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPJoinPortAckRx") if [ -z "$count" ]; then print_skip elif [ "$count" != "$ack_nr" ]; then @@ -1492,7 +1502,7 @@ chk_add_nr() fi print_check "syn" - count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortSynRx") + count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortSynRx") if [ -z "$count" ]; then print_skip elif [ "$count" != "$mis_syn_nr" ]; then @@ -1503,7 +1513,7 @@ chk_add_nr() fi print_check "ack" - count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtMismatchPortAckRx") + count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMismatchPortAckRx") if [ -z "$count" ]; then print_skip elif [ "$count" != "$mis_ack_nr" ]; then @@ -1513,6 +1523,8 @@ chk_add_nr() print_ok fi fi + + print_info "$extra_msg" } chk_add_tx_nr()