From patchwork Wed Jan 25 10:47:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115478 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65E21C27C76 for ; Wed, 25 Jan 2023 10:48:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235174AbjAYKs5 (ORCPT ); Wed, 25 Jan 2023 05:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235742AbjAYKsl (ORCPT ); Wed, 25 Jan 2023 05:48:41 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CB4048A12 for ; Wed, 25 Jan 2023 02:48:09 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id m15so13409378wms.4 for ; Wed, 25 Jan 2023 02:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1z1B/1JOxMW/1pI2Wr97ucv1iX3/JwBnig2uQUdIcTc=; b=5AlvuidXbJf9QcpdTpFTQ3XIvsxA6QM3J2QVvXeO2oPBk4JwRg48JkQA1aGwinnijW bnjnVjpYS1LMR/uISaOqqytr6izXowhbrkqZCQCXp7Td41nS1jyuIbavzAid3YdzBYYn R/ISuQg+LWzuTxdOvc1NLagXN2peIqRwXRV6Zufh8OcEuKVJK29wwgT9LloXkATkbl5f qpQ6DmcADoRfvt2XlUU3atKvuwhCViq6xzWpFL4opA9jsrUAAfh/v+5K9k2BUCqv5nOg +lJEeg7H4wBxy7dRbUpmtn89dE/98UQNZ53DvF58Df2Wq3MSc1is9iyfvg3+EvYu32fM Xg9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1z1B/1JOxMW/1pI2Wr97ucv1iX3/JwBnig2uQUdIcTc=; b=nBuD505WgOQN3f113iyflDVDI/0ljezHxAQERfy/V+sxrAMq3Xu53mxNetNF40htZE Nrmygg/aif5VRlfECUm+HodpuM/jzutp6qK4741gCjEVQwEtUM6txtCK79CY98ac0axH ixOeyF3AOiYKD5hQUguiJLVZO5rZi56H6oGR7VtlzdvTy7WyTmoV+u3E7DRLPpyJJWkp dD0WgJykZlReQn/8UyXNiRrig2VBPsqWo7wJE5sl90RO1oDbR0+0uUcLVBIKehJynTdg VX4CP9TpaY1PxGDkOiSPLyaeDV29oNr1F2sg8p+oZXkX7WGObkIVqDQrVEErDsblKV3a V52A== X-Gm-Message-State: AFqh2kohK0kR20LTq2quZSDTvpRw3D98YpKgiXoeHTlW6XXNEt+j2Hk4 rlGgURoOnSGTAnX37K3L0DhA8Q== X-Google-Smtp-Source: AMrXdXuqjbPK/+LEXjfmBwGtWXg1dSi14zWHaxjHnmbQSe6swgeyMJidojtv4zBnigQIFxETLsw7jw== X-Received: by 2002:a05:600c:3d16:b0:3d0:6a57:66a5 with SMTP id bh22-20020a05600c3d1600b003d06a5766a5mr31466298wmb.0.1674643680203; Wed, 25 Jan 2023 02:48:00 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:47:59 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:21 +0100 Subject: [PATCH net-next 1/8] mptcp: let the in-kernel PM use mixed IPv4 and IPv6 addresses MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-1-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6003; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=phB3Quqjf5qDr2/ijmhFJn3RK2f2//PZBhh2fNKOcGY=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdhQO4IK1wDoBVMgenu8k8FVw5u/Xdg9QAlMfS i7JjdoiJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc9iJD/ 99TD5UCm4XypLquMD/xCMex5l7ycoRiuRYtSMXW/9P5dhgVPcmvcqiJENb4EyOqIYvargib+B7Q5r4 eClS38P7Q4w3JA6K+pT6ofjUX9fN0CU4B3R4ql4LRKrA9Bj0fOFNsHJal+Z+7FefXQjbYfUqwMnCHe tdLJ8ji6y0FLQBwjTesMEPxLDH+mwWAPtQvLes+bTaGjpUALKOpQLEs4aCrMKBH2fGY1MtOXrdWqWz L5ESpeMTAKEOcZUGWrgEfj/HBbCJXEtwp878jXzs6oG91hQhkAEK6DhQeUcsh4R7UHYM03zXT26jwq wSaxUd6VPKT7HLjTmShqy+gFkLU+CcRjbAB69QvrqgQuO3BpJIzZMyiR5Vrm8MnWr4alh2o+8EEEwY AOGY3OVN0lBUKciSC3ve2XjjsbREHJJUA30YNOhXF8sd0dQhvLUmzqoj1HN309hm/SI1VRVXDv4ZTY QH4guWqs6VuSsizRQCtYTKlNzhEhpssa1fnBGIo8Kxd1f+6pDTwGObhkjDE7Euhs9GGuDTErtptLAu JZXwnss96Wrprd3nrYn8/GDfoDZutI0Hruyt1J5Qv6yGaktw9Xqjeb9QVoZj/voR45RFcGs3ghO+QH RoyBIZpi/hnLYM4bsi0OgrciAzJ296raz7A9WsO+t1MnDJUhkiO1mqWlgxMQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Paolo Abeni Currently the in-kernel PM arbitrary enforces that created subflow's family must match the main MPTCP socket while the RFC allows mixing IPv4 and IPv6 subflows. This patch changes the in-kernel PM logic to create subflows matching the currently selected source (or destination) address. IPv4 sockets can pick only IPv4 addresses (and v4 mapped in v6), while IPv6 sockets not restricted to V6ONLY can pick either IPv4 and IPv6 addresses as long as the source and destination matches. A helper, previously introduced is used to ease family matching checks, taking care of IPv4 vs IPv4-mapped-IPv6 vs IPv6 only addresses. Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/269 Co-developed-by: Matthieu Baerts Signed-off-by: Matthieu Baerts Signed-off-by: Paolo Abeni Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- net/mptcp/pm_netlink.c | 58 +++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index b5505b8167f9..db07cc5b4fcb 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -152,7 +152,6 @@ static struct mptcp_pm_addr_entry * select_local_address(const struct pm_nl_pernet *pernet, const struct mptcp_sock *msk) { - const struct sock *sk = (const struct sock *)msk; struct mptcp_pm_addr_entry *entry, *ret = NULL; msk_owned_by_me(msk); @@ -165,16 +164,6 @@ select_local_address(const struct pm_nl_pernet *pernet, if (!test_bit(entry->addr.id, msk->pm.id_avail_bitmap)) continue; - if (entry->addr.family != sk->sk_family) { -#if IS_ENABLED(CONFIG_MPTCP_IPV6) - if ((entry->addr.family == AF_INET && - !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) || - (sk->sk_family == AF_INET && - !ipv6_addr_v4mapped(&entry->addr.addr6))) -#endif - continue; - } - ret = entry; break; } @@ -423,7 +412,9 @@ static bool lookup_address_in_vec(const struct mptcp_addr_info *addrs, unsigned /* Fill all the remote addresses into the array addrs[], * and return the array size. */ -static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullmesh, +static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, + struct mptcp_addr_info *local, + bool fullmesh, struct mptcp_addr_info *addrs) { bool deny_id0 = READ_ONCE(msk->pm.remote_deny_join_id0); @@ -443,6 +434,9 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullm if (deny_id0) return 0; + if (!mptcp_pm_addr_families_match(sk, local, &remote)) + return 0; + msk->pm.subflows++; addrs[i++] = remote; } else { @@ -453,6 +447,9 @@ static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, bool fullm if (deny_id0 && !addrs[i].id) continue; + if (!mptcp_pm_addr_families_match(sk, local, &addrs[i])) + continue; + if (!lookup_address_in_vec(addrs, i, &addrs[i]) && msk->pm.subflows < subflows_max) { msk->pm.subflows++; @@ -603,9 +600,11 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) fullmesh = !!(local->flags & MPTCP_PM_ADDR_FLAG_FULLMESH); msk->pm.local_addr_used++; - nr = fill_remote_addresses_vec(msk, fullmesh, addrs); - if (nr) - __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); + __clear_bit(local->addr.id, msk->pm.id_avail_bitmap); + nr = fill_remote_addresses_vec(msk, &local->addr, fullmesh, addrs); + if (nr == 0) + continue; + spin_unlock_bh(&msk->pm.lock); for (i = 0; i < nr; i++) __mptcp_subflow_connect(sk, &local->addr, &addrs[i]); @@ -628,11 +627,11 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) * and return the array size. */ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + struct mptcp_addr_info *remote, struct mptcp_addr_info *addrs) { struct sock *sk = (struct sock *)msk; struct mptcp_pm_addr_entry *entry; - struct mptcp_addr_info local; struct pm_nl_pernet *pernet; unsigned int subflows_max; int i = 0; @@ -645,15 +644,8 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, if (!(entry->flags & MPTCP_PM_ADDR_FLAG_FULLMESH)) continue; - if (entry->addr.family != sk->sk_family) { -#if IS_ENABLED(CONFIG_MPTCP_IPV6) - if ((entry->addr.family == AF_INET && - !ipv6_addr_v4mapped(&sk->sk_v6_daddr)) || - (sk->sk_family == AF_INET && - !ipv6_addr_v4mapped(&entry->addr.addr6))) -#endif - continue; - } + if (!mptcp_pm_addr_families_match(sk, &entry->addr, remote)) + continue; if (msk->pm.subflows < subflows_max) { msk->pm.subflows++; @@ -666,8 +658,18 @@ static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, * 'IPADDRANY' local address */ if (!i) { + struct mptcp_addr_info local; + memset(&local, 0, sizeof(local)); - local.family = msk->pm.remote.family; + local.family = +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + remote->family == AF_INET6 && + ipv6_addr_v4mapped(&remote->addr6) ? AF_INET : +#endif + remote->family; + + if (!mptcp_pm_addr_families_match(sk, &local, remote)) + return 0; msk->pm.subflows++; addrs[i++] = local; @@ -706,7 +708,9 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) /* connect to the specified remote address, using whatever * local address the routing configuration will pick. */ - nr = fill_local_addresses_vec(msk, addrs); + nr = fill_local_addresses_vec(msk, &remote, addrs); + if (nr == 0) + return; msk->pm.add_addr_accepted++; if (msk->pm.add_addr_accepted >= add_addr_accept_max || From patchwork Wed Jan 25 10:47:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115477 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A52CC27C76 for ; Wed, 25 Jan 2023 10:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235776AbjAYKsr (ORCPT ); Wed, 25 Jan 2023 05:48:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235738AbjAYKsi (ORCPT ); Wed, 25 Jan 2023 05:48:38 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFA1356ECA for ; Wed, 25 Jan 2023 02:48:09 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso961280wmq.5 for ; Wed, 25 Jan 2023 02:48:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iwuYRtkt97pXgnGKWsmcpjqW50hTCzYJA93KmtVKokc=; b=HlBx+O22XMPaRLdCY8bRkkNnoQJ3DAxxgJTt7+b3L5EnG+s9hHIj24S3udDB+1KfW7 HZ0hL+LUIfBGb1uKFmNhFDiNCII356m1bfIK6t0E2xQznWe0FEXZIx8dgzuwgEZeMOwF /hcSGndz1WVTXeHHHppYGMiA21hiCtFhh8urKHlrj/vPURK/VCRSWGO6sN8J/tG2V6Xm mFBS/amTW0N87ynwbWdMtAZPzV0N8GTJy5hwEMNd8fUSAmzHuliy7L+dbWamv14dzCc3 Qkehd+7bhHzWXbkT41nYaeVpbt77GgCDR3zVmcqLTLDoGPfdVietxdIm/74TVc1hkFST l5oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iwuYRtkt97pXgnGKWsmcpjqW50hTCzYJA93KmtVKokc=; b=GT6BqnKDJgOVGVgTG3t2LaPJX2umMPKg9p32Aul+I6Hg6T23DWSnqtFkNedr+vR61e 7Cczq17b/pcGhRaH7yrJlRrkVaE1h5Bix4enl93zxO8A46iVbUyd1HC1un4+8j7ZzN6N ZPL1cfMbbml6Gt/b5/u7YSLOS0S5uI40S9z+Bp2vSDHKf0eQMTYaPjXFwDrpw2kAd12d GZv5ap64VvE7gdsAJ/MD3npDIrrwFKYCyjUv0oHjQvW7E+XahhxzHGNbhHbEzsDKx1kJ GEhMvrBXinc3dXMSA/BwiNnj0oi4fwBz2vnrY7lzE2alGOq6VFWasWQ/vVGLmpT/sMmn T6MQ== X-Gm-Message-State: AFqh2koLfFVtJcd3oqtf4sCRVgCXY7VD9pw1fDN8aLPxTU+WfP2yPcjT FCrecVcceKNY0Oi9OM5gM0Tfmw== X-Google-Smtp-Source: AMrXdXu1N0sNPouw7E9jGQXXTooMoM8qqp8aPt8Kz6TIc+lbChljM7ALrlyaIpvd2IlXeB30KE+ILQ== X-Received: by 2002:a05:600c:1d89:b0:3d9:f37e:2acb with SMTP id p9-20020a05600c1d8900b003d9f37e2acbmr28251589wms.20.1674643681186; Wed, 25 Jan 2023 02:48:01 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:00 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:22 +0100 Subject: [PATCH net-next 2/8] mptcp: propagate sk_ipv6only to subflows MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-2-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=934; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=iniaX7WemA+f5FmXFhQpwMPskZ2OOjDI5WzLlog0AB0=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdHh80nGr6vqKKMF2Ns21cQ6F9LNF4+fGARnIu So5WZVaJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc3bzEA CmmmRHlTlgzud6oeE9klZQXjAG/8elx0t/GIPA7wHH2EQK004iT1piDLDA7KFbf59FjKqe1u0bGK9b 5HwJ0jeOUp1yuZ2bjmhp224fuCwe/dlsle9Al55jQKL5f0V7wM2r6eQCiD/zSkiKUSPJlO/o9uUmnY lh2rtI1Hg1QjOoN/zpLop2TkeT+gg/jJaFOD/fdNGVJHjLn5mgloZnsGVfOxzkR397K5jHuIhqAdyN /2uv0Q4loGyCTBjV8MK+QNzk5uWh3gb8gbDy/bYknm7DYuvgp1bNTP7P7vw7hdPZwhpQ8vu1TLupzL ttDBxwQAGNW2py7qtmU8yE+DlonogGH925IT6d1Aj25NuT9JJljZegjZ1N/3/uEiNKFWZqYXNue+RV jBlnNOVM1sK2aBUK2jAchjbn+si1VndP4cMkVoxsx/w8Mor+E95Cq9cCucNKlVlcL05/4l4vFlUfp5 aQgwIp27S9fn8svwPgdhNxS/dKLkRwaWY48LWagW5xpn30Kru9T5rufLyDtju8ofPCaXCj1z8iYKr/ Cke1t4uOSgxWUF+oXY8DMsl7M2o9uEpJI3gmuEjutwwAkwy9c/HiSEHnjbprdcHxulcYOLHdh3IiX2 g6wo/shmcYvnxUGDQZ8epmYG1dTu+6mBe2KbJtBzeMEbP5jlONGzjjuJlwkQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Usually, attributes are propagated to subflows as well. Here, if subflows are created by other ways than the MPTCP path-manager, it is important to make sure they are in v6 if it is asked by the userspace. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- net/mptcp/sockopt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c index 582ed93bcc8a..9986681aaf40 100644 --- a/net/mptcp/sockopt.c +++ b/net/mptcp/sockopt.c @@ -1255,6 +1255,7 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk) ssk->sk_priority = sk->sk_priority; ssk->sk_bound_dev_if = sk->sk_bound_dev_if; ssk->sk_incoming_cpu = sk->sk_incoming_cpu; + ssk->sk_ipv6only = sk->sk_ipv6only; __ip_sock_set_tos(ssk, inet_sk(sk)->tos); if (sk->sk_userlocks & tx_rx_locks) { From patchwork Wed Jan 25 10:47:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115480 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD67C54E94 for ; Wed, 25 Jan 2023 10:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235798AbjAYKtQ (ORCPT ); Wed, 25 Jan 2023 05:49:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235758AbjAYKsp (ORCPT ); Wed, 25 Jan 2023 05:48:45 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4240856EE6 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so932657wma.1 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=mjFauu1ty8EOKl/zKVHOIwAbYvDY0AH2ut63+GQyyss=; b=HyC9KJ++wPd79JT3e3Qj+7xb4QbvFGvjgEC93RX+0LRO3IvjUyFbu98HL12BDWijfg V9rl/j/+T+IRK2Au/LWPs6yPXW5rg1iKTb2mTnyL0MQ9CsZL5NjZumRMjqibqvQ0sMdB q9z1+gUsTsHxOzHqvcFtVxhpESMuDzBdEX0bvLVnzflMiOI890oJvvOzO80me8t1dYBI 80JsEJZ+fF4xJ/JOR7UFgGAHlD8ZL7fIUdbujDrFEu2SG9NcsjRf5wxixv+TeZVg1WcI cwaaZ/nVKUHfasrzFU78oY6xpJJjWfZ4LMsSdyYGGw1OX+3dtyuzt5t45E9EZELs1fda a5aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mjFauu1ty8EOKl/zKVHOIwAbYvDY0AH2ut63+GQyyss=; b=FuslyXGXymyb44L5c55046aoKybGOY+UrqVRw9Lo7x627/8lm+AmWGPmqiFY1hL9SW e52onbGMEE2+kjA3M2C6zf5acfSQ1upKuyjOb+KsBNH7pWReGQ939Q4RicL0TY6ET5Py 6hIK8rRR5W+tKik5eKA18dGVhqAMrses0ZhrcozPieHlTR+EHR8jSaFTe1RdPcAyViYz nUjLq5ze74GKTD0DDPzP0aoxHpjNWX++dmmWCiqnJTcsOI+NQR6tgNzCNOQ3ThT9P5KJ xdM/ElKillEE1gZqtpk3WiRspHrKMNGttAW+BlcQfawsdxnsr5DcrXIiFTawhoO5gosn S+/Q== X-Gm-Message-State: AFqh2kpv6ycUOss0rySb+Z3jHYe+mjpLcP08AMW6KYtgTAmY0AjmCV3T HwYXTwjz19NtNBkilm7UT7VmDA== X-Google-Smtp-Source: AMrXdXsm6QiSIL1qqdqKiXpYNpiBJkeGjOybgfRqpEtAKDjWn6+pasYOOg9Y/LTMg49h5Xho9eyrmQ== X-Received: by 2002:a05:600c:1c01:b0:3c6:e63e:23e9 with SMTP id j1-20020a05600c1c0100b003c6e63e23e9mr31559003wms.24.1674643682135; Wed, 25 Jan 2023 02:48:02 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:01 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:23 +0100 Subject: [PATCH net-next 3/8] selftests: mptcp: add test-cases for mixed v4/v6 subflows MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-3-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3323; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=Svwm/hHROTGkPV1oEQjfcOQoXpkUYph8n6kw7hTzaOQ=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdQmoYk+cbOI+cC/+J4PUVg46ofuGSiHtcZEX/ 2OH+ZVyJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc4oUEA C/7IaxF/dQF3FtSHdqXw/vY0N98/sb2efy3A1nA/RWfkRFiA3Zr2vLyXEkXk9JdxgeXWALgDAcivbJ r3hEBDiZ734LGnzYz4dq2jPNgn7PDJsR+ypB6fKRYWzGsoaBS0McHnwrEcLCowLsAVuS1jk9j4KuWq 73/X8JG/euwgYo86Ycs3HydoVaEjs4ngfIiO5Ut1vEkuqWoX4o8BLDkkh0YNHoq12XZ7JYyPgVi2+7 vPM45W00RVk9ikMdgem+v1+xeTOgBC4F0kD2tod2IBfQEZ7vyH/i0jKMBXdTY8sjFTIz8vs1QvejT/ xIunWCXjsoY4RGXjM3PZEUx2Vtk7rI+bEQnMOA2E4N4LtVEm3gvJSAuGCQvQ+53S4zxpCVRxNXm6T5 dv20gWN83Aghk9QOdlut0H7NZ4UhZFTYTgF+BlMuiiUusg/P4G8IKllI+YN+ZrIeD5aS7ehUAX+3eX VXm/AMsMUJLRUH0LmC7YL76NvxMRX1xfoZ1CqgNpYlz/6rtdMT53lCd+0+q0kuxzLnJalTyABXEgy+ DWEWwtvgH+G7OjU6jLdRCdhMcGkDyhQf9Va3Me5fzIHcamaF7kWXlpe5LnCDBT+fLTytTQ5KL2KSRe cbbQQzey8TYYXR27jPO2oT7btDBkPRXLePPxs1SCPWOkqr9L6eNdokQ+rhkA== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Paolo Abeni Note that we can't guess the listener family anymore based on the client target address: always use IPv6. The fullmesh flag with endpoints from different families is also validated here. Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 53 ++++++++++++++++++++----- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index d11d3d566608..387abdcec011 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -774,24 +774,17 @@ do_transfer() addr_nr_ns2=${addr_nr_ns2:9} fi - local local_addr - if is_v6 "${connect_addr}"; then - local_addr="::" - else - local_addr="0.0.0.0" - fi - extra_srv_args="$extra_args $extra_srv_args" if [ "$test_link_fail" -gt 1 ];then timeout ${timeout_test} \ ip netns exec ${listener_ns} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ - $extra_srv_args ${local_addr} < "$sinfail" > "$sout" & + $extra_srv_args "::" < "$sinfail" > "$sout" & else timeout ${timeout_test} \ ip netns exec ${listener_ns} \ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ - $extra_srv_args ${local_addr} < "$sin" > "$sout" & + $extra_srv_args "::" < "$sin" > "$sout" & fi local spid=$! @@ -2448,6 +2441,47 @@ v4mapped_tests() fi } +mixed_tests() +{ + if reset "IPv4 sockets do not use IPv6 addresses"; then + pm_nl_set_limits $ns1 0 1 + pm_nl_set_limits $ns2 1 1 + pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr 0 0 0 + fi + + # Need an IPv6 mptcp socket to allow subflows of both families + if reset "simult IPv4 and IPv6 subflows"; then + pm_nl_set_limits $ns1 0 1 + pm_nl_set_limits $ns2 1 1 + pm_nl_add_endpoint $ns1 10.0.1.1 flags signal + run_tests $ns1 $ns2 dead:beef:2::1 0 0 0 slow + chk_join_nr 1 1 1 + fi + + # cross families subflows will not be created even in fullmesh mode + if reset "simult IPv4 and IPv6 subflows, fullmesh 1x1"; then + pm_nl_set_limits $ns1 0 4 + pm_nl_set_limits $ns2 1 4 + pm_nl_add_endpoint $ns2 dead:beef:2::2 flags subflow,fullmesh + pm_nl_add_endpoint $ns1 10.0.1.1 flags signal + run_tests $ns1 $ns2 dead:beef:2::1 0 0 0 slow + chk_join_nr 1 1 1 + fi + + # fullmesh still tries to create all the possibly subflows with + # matching family + if reset "simult IPv4 and IPv6 subflows, fullmesh 2x2"; then + pm_nl_set_limits $ns1 0 4 + pm_nl_set_limits $ns2 2 4 + pm_nl_add_endpoint $ns1 10.0.2.1 flags signal + pm_nl_add_endpoint $ns1 dead:beef:2::1 flags signal + run_tests $ns1 $ns2 dead:beef:1::1 0 0 fullmesh_1 slow + chk_join_nr 4 4 4 + fi +} + backup_tests() { # single subflow, backup @@ -3120,6 +3154,7 @@ all_tests_sorted=( a@add_tests 6@ipv6_tests 4@v4mapped_tests + M@mixed_tests b@backup_tests p@add_addr_ports_tests k@syncookies_tests From patchwork Wed Jan 25 10:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115479 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A092C27C76 for ; Wed, 25 Jan 2023 10:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235783AbjAYKtP (ORCPT ); Wed, 25 Jan 2023 05:49:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235761AbjAYKsp (ORCPT ); Wed, 25 Jan 2023 05:48:45 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F617577CF for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so918077wml.3 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rXq3Avj7Ia8STiRseUvkMdz+nkGFrD8MDyDhjItUgZ8=; b=Wur4C2zWjCI8Asl5c9hZMTT3sZn9cjfsd/imODr8jiIbWg2utFuKle7NCMyqROPvCg KOtHVC3thoZsYqOUe5p+cL2vr09XxgnjsFI0zPki+QNPZPqJUNbrKj8wReonZO6gp0m+ Dsf+iFk4nCPHeH+eEkJK+s1Zbh+p1rYEv8kTHvODVdnL6jFQGVFnbzjeiRSkcpyt+B+U QVjYPjQijYkWd13c7oZ7Mpqv+I57Te2nn5bjx0f28CYqS1ma0+clOA0cX0+sAyPylkit r59ch+f9QuDRd3NoRBiVaS4/sXNfkzcHDu2lZYmaCJBZ0140IMWu6g3N7WUS8YOqW2pT /9Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rXq3Avj7Ia8STiRseUvkMdz+nkGFrD8MDyDhjItUgZ8=; b=TsX3EzdpcoqKe1YZao8vaoU89i8qbWPN15i+RfDDcl50j+qHcIxpl7lxV0g1WlJ6oG BFL8Xh+/guS+8vvFZoaK2xp15gA2B6fx1vrNkMnEs+zkTk0og58fYRdUA+0K/DcDgpUM B120ea3a4eGPNMbjJbonQOk1Ok1ickty4FhEFyFqLHJbpc4AVl4shbChU7Xxx5SRyzJd 0N1et/kenKkZU9eoJ0pS0JNoHHYfm4/286vU0B199uk2bg4tXr5z25+toJRTfXCacFVa XXV9nys6wzqa8QMOFHojHAHPYONb5uR2Zo2QQTF2XlLAM6uVYIbGOi7Y54Z7lJ5ZE8qF yHqQ== X-Gm-Message-State: AFqh2krzZVtQsv+jX8lNvORnpy/7stUzk78x6QnodtZtfnrYUdtiWefO ia6xhWWKoQui/Ff0MonL/3mxpA== X-Google-Smtp-Source: AMrXdXvn0HACeS8LJ/C2jvP/y57b5wioOgNRDiLdlZnr54wRNnVsnWwx5JQQUzoKyMJ9Ps9wUypvWA== X-Received: by 2002:a05:600c:995:b0:3da:f4f5:ad0e with SMTP id w21-20020a05600c099500b003daf4f5ad0emr30563030wmp.9.1674643683112; Wed, 25 Jan 2023 02:48:03 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:02 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:24 +0100 Subject: [PATCH net-next 4/8] mptcp: userspace pm: use a single point of exit MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-4-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1180; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=dfU/VzhUn11O3qEpjl/vqz1Tgffa83ykPXnKKZNhRsI=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdSynCqBueplEAutVxF8XpEvKj6AH25SGaDR3Z VpY4GTOJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc5ixEA CiGP0kDzZIj0bLp9ngOjBvEPvfF9YM8bXqPIcY8jWVvF4fYVDH4r6xt01AUeffQ9sxPIjZop0mfrmM IrLc4aJ0xJTbct88AjPMZ3aUVLw86f2kkqsdwJlDTHmtSLYQajARUE0sAleD+w/L5sCHPFlMz8MGaE 7gC4Aqha0tNoOKA0yTHqB8sQH9y0in6G8qJYUCXbIlBGFsfkK1quqyo8LSVzIlw8WsFvt1LJmRxhlt pumUAC9rNWh0cgL7DVaYiajL5FpduyVfj6NrMCN1lQWXLSeUq38eJswGkzIG7upaoE5i9W+lN8dDHC 6IBV744XVoViuyxUP0ftPpHsFJWnc7AR+TGjsGHGJwwaV5SuDV7ZX7hRsb35bFMEvr6zSgBYM88tdF 75TKxe4Xvs/t2YGBS9jzbSFPGJYM8Xx5oNob33G6RL8A4r6lgLEj1zKlbdEOhea6cWpNn8dHXud6N3 ws93sn6Donfu2euV3zCxVrEj/fkCTKxLE+lDEQOZQpQuTrN2tWMza94s/zMVKW4Ty9oJZQsVL3P032 ZhOm7obdLJqpWKx3g991D+CRYIHTWbBtAf925Fbj4EZVxdFCEv++k2k/1oqy980ymkNLDtjHsPswOf oA4bqSm1A3eCycjEFmp1hWOUOa15lxgD3mVQfATAwxRo6Iw3PuyjxvaFTQ5w== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Like in all other functions in this file, a single point of exit is used when extra operations are needed: unlock, decrement refcount, etc. There is no functional change for the moment but it is better to do the same here to make sure all cleanups are done in case of intermediate errors. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- net/mptcp/pm_userspace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c index ea6ad9da7493..a02d3cbf2a1b 100644 --- a/net/mptcp/pm_userspace.c +++ b/net/mptcp/pm_userspace.c @@ -59,8 +59,8 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, */ e = sock_kmalloc(sk, sizeof(*e), GFP_ATOMIC); if (!e) { - spin_unlock_bh(&msk->pm.lock); - return -ENOMEM; + ret = -ENOMEM; + goto append_err; } *e = *entry; @@ -74,6 +74,7 @@ int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk, ret = entry->addr.id; } +append_err: spin_unlock_bh(&msk->pm.lock); return ret; } From patchwork Wed Jan 25 10:47:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115481 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E42B4C61DA2 for ; Wed, 25 Jan 2023 10:49:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235803AbjAYKtR (ORCPT ); Wed, 25 Jan 2023 05:49:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235778AbjAYKsr (ORCPT ); Wed, 25 Jan 2023 05:48:47 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9650122A00 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id j17so13442337wms.0 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RV58zA+SCkILm0XZPHyNHRUHK+pvhsdLrbaM8qBjSmQ=; b=OwVPRCZNbCTLA52WGubCMcVDU60TsNctH4H52salJ2Q7Gdz2w8Yt25Xon0pQtOB61H D1NANQo8JZWdJHfJq79yGdGbMIgYZ+6HeUhFox+EDZLTwrQ0Yzjz0xo1VJzUyv+DTokM NV33WouA/XJUizV94qleUrEpbUvcrfcBwd/3r+g1AXiHKHZAATqSbwLPjjwQz7xuyBEN lcaMX/yIsxypXHrJHAlP5AnSMfRRDixWhcOCvHQkj1Qe8l2GQRbU7YOUf4Ul6I1dw28e MoH++G9CZTTNjw6AfdxE7mnl0k1orQ2l6oEtMpRUyyBzlayJFaFnT36bpxhAOkLYpg80 zoNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RV58zA+SCkILm0XZPHyNHRUHK+pvhsdLrbaM8qBjSmQ=; b=qBjRjWWfxwv5n499RmmSOBe9eYpgulU1PwqVRt4juSyc1DXir37W7JzSzGy8IgpB1w IeRpFbNT4LBz+h0scxm9C+w8KxZyYPLa0hfppI4oYRjSZcKzJS5qmjKXknK8OkkR2cCR RFa2KOpv1CscFEKLEVN3FH/wbjfcyXr6Ii/FoxA0YyRDISzk/A5uRZHduEtWYFwUcoXv B7mQt3L+jeKGk3qctU2dUo+3TZgZj0ZvSIFquk27L2bdLZ+BZxS+HjCSwlqxc8PquPLe MZcS2xIbwS/iPTiHfdtYaIyZ7wPYaop/YkVYNfnmswGhOC0DLsI0AuUKlH2c3tJdrG6r npOA== X-Gm-Message-State: AFqh2koVixRDFWIDfw1dCoYEMlhoWT2SbtUSCfwWbItUipQWyqEhoW5H 2Kefpl2Dwqwuaw8kVKk/kLyStm7VTcQ5ge/knCpEQA== X-Google-Smtp-Source: AMrXdXtLCWuwItXB+ckW/oTvPU1xdVUu7w/DaWjCAMc9Lv9MEwvEQhUGAEmBQ6t+gqOD9oZC/V4nGA== X-Received: by 2002:a05:600c:4248:b0:3d9:7667:c0e4 with SMTP id r8-20020a05600c424800b003d97667c0e4mr30794094wmm.31.1674643684026; Wed, 25 Jan 2023 02:48:04 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:03 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:25 +0100 Subject: [PATCH net-next 5/8] selftests: mptcp: userspace: print titles MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-5-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2983; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=P3VM/iCNu8iP43PEXa6tfD1YO3fGT98t37TeXBvPP7A=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0Qjdo0FMtsrErT4zXkcmyHJwfc9WvK2QpqSwU2eH hOKZmn+JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc8JjD/ 4lpfj++M+BTlwMX8u0XpEr3FNE9Lw/PDWGnraa1zPHiOg1kW1k0lGMTalnWAvy+sPj9vECtXnJpIhN Xd1JpH4+SoYGNdP6L8NxqYG68YusvEFWeIG1G/+Dk8Ok+1f09XloxVzDuAe05fqKNd3KxYtST42BSy IrNBZTXsd/ifqVjBj1iBZwO+/EF9KDEJ/SPzsCIz5Be4Jj4iv3B1jMN0RgxoD6XsXFEz1LUT2YPiuM +vo4h2i25DodmyPmPzYHqWWthDnqtSx+6GQZN3qDN1i+vS/iOKGkLII8HVbqyfXpX4BJmq+SE91Zb1 6avWRahqKRWJSipYGHQ60QR/xtm7DZG3oeYyohT18/egCMoTb9ai2kmRLdWDEhohBUznchN7D+aDi6 ARzvH8K9nrLl7gAuj4EFPyufUDHq7Va30661tdV+x/s5js2yVIpEIIlIn4PP4ClJfACEVJEhsBHgP1 6nsxAPVg7ijJzHyIEbViNdBR/NZ0gFRTasqyjSsMnf+fEXp15LXW3GCInoOLtRkdyVwZ8HJn86mXnd +OXQcNfIZUM7+MiPIrRmFaZahsYZpSEUQzdtiguNaKWnSrCtChSPwF5xVO1PzTAj9iI8LRBXX7TNkq qEm0DXd31HF6pfOQMfY6D0NQwPT+KkuwfE02/v3kfb5yw9maJefvEHaqJ6vQ== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This script is running a few tests after having setup the environment. Printing titles helps understand what is being tested. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index ab2d581f28a1..7b06d9d0aa46 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -43,6 +43,11 @@ rndh=$(printf %x "$sec")-$(mktemp -u XXXXXX) ns1="ns1-$rndh" ns2="ns2-$rndh" +print_title() +{ + stdbuf -o0 -e0 printf "INFO: %s\n" "${1}" +} + kill_wait() { kill $1 > /dev/null 2>&1 @@ -51,7 +56,7 @@ kill_wait() cleanup() { - echo "cleanup" + print_title "Cleanup" rm -rf $file $client_evts $server_evts @@ -78,6 +83,8 @@ cleanup() for netns in "$ns1" "$ns2" ;do ip netns del "$netns" done + + stdbuf -o0 -e0 printf "Done\n" } trap cleanup EXIT @@ -108,6 +115,7 @@ ip -net "$ns2" addr add dead:beef:1::2/64 dev ns2eth1 nodad ip -net "$ns2" addr add dead:beef:2::2/64 dev ns2eth1 nodad ip -net "$ns2" link set ns2eth1 up +print_title "Init" stdbuf -o0 -e0 printf "Created network namespaces ns1, ns2 \t\t\t[OK]\n" make_file() @@ -255,6 +263,8 @@ verify_announce_event() test_announce() { + print_title "Announce tests" + # Capture events on the network namespace running the server :>"$server_evts" @@ -359,6 +369,8 @@ verify_remove_event() test_remove() { + print_title "Remove tests" + # Capture events on the network namespace running the server :>"$server_evts" @@ -521,6 +533,8 @@ verify_subflow_events() test_subflows() { + print_title "Subflows v4 or v6 only tests" + # Capture events on the network namespace running the server :>"$server_evts" @@ -754,6 +768,8 @@ test_subflows() test_subflows_v4_v6_mix() { + print_title "Subflows v4 and v6 mix tests" + # Attempt to add a listener at 10.0.2.1: ip netns exec "$ns1" ./pm_nl_ctl listen 10.0.2.1\ $app6_port > /dev/null 2>&1 & @@ -800,6 +816,8 @@ test_subflows_v4_v6_mix() test_prio() { + print_title "Prio tests" + local count # Send MP_PRIO signal from client to server machine @@ -876,6 +894,8 @@ verify_listener_events() test_listener() { + print_title "Listener tests" + # Capture events on the network namespace running the client :>$client_evts @@ -902,8 +922,10 @@ test_listener() verify_listener_events $client_evts $LISTENER_CLOSED $AF_INET 10.0.2.2 $client4_port } +print_title "Make connections" make_connection make_connection "v6" + test_announce test_remove test_subflows From patchwork Wed Jan 25 10:47:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115482 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 352C1C61DA4 for ; Wed, 25 Jan 2023 10:49:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235810AbjAYKtT (ORCPT ); Wed, 25 Jan 2023 05:49:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235780AbjAYKsr (ORCPT ); Wed, 25 Jan 2023 05:48:47 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7C9577D9 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id q8so13402423wmo.5 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YQermjS6R/5XAyAu5/q5M18B1G6CnrMggCM48+JT+NI=; b=ggZDxTUWMIwQvaTBH2CZcOfeTvRCdWuADNjhZcfFap1M949alWd3/4b9fWRaM9tH1K ghQ/wiXkjQKkZaq/i1aeftBsmFznh7bBBzvn+MJ8sNwonGzt48c19jki/2guEt7Zl/25 /stBVVIg8ei84QtoHPZs9xXShdyrNwFf96apttX9xHyDpE1apgQSfRrT/bTYd0/fHx70 uRvdUVvZwUrm+ZDVVB4ZzyRDka387efi+CFChL0oUzjjES2yU6fb51fbF4WLNjSJGnvh eNKEo5+ik/vQSQlj6mKcYkUlDj8Trdbd1cfUiqolXdu00896na0LxaRi7PjgMYFHKRKm zjCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YQermjS6R/5XAyAu5/q5M18B1G6CnrMggCM48+JT+NI=; b=LnvBtDo0JOOue9R8/tWwkQh0qHdlQM1I1QqxolfCE81pBW5oTsjR0sbGViQVdaXK9y zeVzoq0zpzbRuiZj1FhHX1yPK2LP0aqrY46IDVMLjpDEfZP6O7PQcKyZN3Ki5MA3dc5h 6T+eT5brkBCGqBd/EcmOlTznBtdM8DmL2msHbEupmDTRFQAuOZt7AMazUPTGJ6Ta/kUD bqa6e0YOQ9Hg7I6BgJOd09+iGxLDIS6nNr6SAl10fdOrYEZmJ3KghZtgFpYGWYMVQWQ9 hOuDpAcXe4YMnGobdt8kxXxD3KvKHoD6gGrk2UxUenSyMlUCkvPotgttnn3iXGDq8Il+ q7kA== X-Gm-Message-State: AFqh2kp/9SIZ++KurVm6yLKlsNOAF+zVnzvde/vmx6sQZk5ylHVV0DQy 2OtFat5r+RG90bK60/p/Btj3ow== X-Google-Smtp-Source: AMrXdXuui7o5XomraQFAlr7lyLVPyS9M6wBZA7G6RnRCu1XS4gQi7YwZWKtbpcdx771dtX7zXn5UIA== X-Received: by 2002:a1c:6a10:0:b0:3da:f665:5b66 with SMTP id f16-20020a1c6a10000000b003daf6655b66mr31652426wmc.6.1674643684973; Wed, 25 Jan 2023 02:48:04 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:04 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:26 +0100 Subject: [PATCH net-next 6/8] selftests: mptcp: userspace: refactor asserts MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-6-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3530; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=m1DWBx6mmyT/LHJ7/zf16MtXVb6plkJtMvBgtaF7t54=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0Qjd5OjtyhttPPtPx2kgV8v1cOHuklyXsgPTPqaO kigK4kWJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc7nHD/ 49UjDr+Utp/YdqroKfnfrSFLdVtSuMSge9A7+yIwV+68DIPDNtUQU/I6i5q1+OBPjJWrDcN/Acxnt8 e1E8IMVlIZi0uGk/YeJ+h+HXPLfjFCU0zEKBRe0pank5fJ3aAo+YWVoFf9faGJY8/OM8QxjLmpaFa5 2aD/M8K9itFbM+xvYpCrwZvsTnt8x7E1ybRFhVw7l9chsz5KPL7jAmtbVmxgLC/5GidpnKGDhbCxDY w6b73VjH6fZYE0GBXl+8DMvJ8dMlz4UciuitK3Y4J564eVqCoMGZEDB0ZUSZ+ZX+V+m+AYl58TMS4N hZ8WeT05bvrS4KZe+WVlY70VnhgdkOWUGy8zfEILGZa3MZIgP0kHnWah7k8mR0JMB8GieqG03bv49d +wCH/o6oHY7ynAS+YU0EQknUBGvClWrn24znxEaDn+iEnTKBiToJ9fKt8YgRtsIzsL2SmmnHU/Bljs OUTWMrny1oYS/QugaFp+45h+BtbXvWrrCE28T2m/yj/F7+EadqZU+zmO0USriKT5CocAax3poLy8Dt wSDjmw0FQvQ5I2C/LEVjsumQ2BFeUafewPL8qNjmWkZV3KDw6IBdA8MyahWahWH8d6LIhNaF1qh6wv xlmLHW451210sfawI+uU29kOSGaT9kT12S9ATD+F+Gf17AQ4NpnUAtPbyr5g== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Instead of having a long list of conditions to check, it is possible to give a list of variable names to compare with their 'e_XXX' version. This will ease the introduction of the following commit which will print which condition has failed (if any). Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 72 +++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 7b06d9d0aa46..2f2a85a212b0 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -225,6 +225,36 @@ make_connection() fi } +# $1: var name +check_expected_one() +{ + local var="${1}" + local exp="e_${var}" + + [ "${!var}" = "${!exp}" ] +} + +# $@: all var names to check +check_expected() +{ + local ret=0 + local var + + for var in "${@}" + do + check_expected_one "${var}" || ret=1 + done + + if [ ${ret} -eq 0 ] + then + stdbuf -o0 -e0 printf "[OK]\n" + return 0 + fi + + stdbuf -o0 -e0 printf "[FAIL]\n" + exit 1 +} + verify_announce_event() { local evt=$1 @@ -250,15 +280,8 @@ verify_announce_event() fi dport=$(sed --unbuffered -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q' "$evt") id=$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$evt") - if [ "$type" = "$e_type" ] && [ "$token" = "$e_token" ] && - [ "$addr" = "$e_addr" ] && [ "$dport" = "$e_dport" ] && - [ "$id" = "$e_id" ] - then - stdbuf -o0 -e0 printf "[OK]\n" - return 0 - fi - stdbuf -o0 -e0 printf "[FAIL]\n" - exit 1 + + check_expected "type" "token" "addr" "dport" "id" } test_announce() @@ -357,14 +380,8 @@ verify_remove_event() type=$(sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q' "$evt") token=$(sed --unbuffered -n 's/.*\(token:\)\([[:digit:]]*\).*$/\2/p;q' "$evt") id=$(sed --unbuffered -n 's/.*\(rem_id:\)\([[:digit:]]*\).*$/\2/p;q' "$evt") - if [ "$type" = "$e_type" ] && [ "$token" = "$e_token" ] && - [ "$id" = "$e_id" ] - then - stdbuf -o0 -e0 printf "[OK]\n" - return 0 - fi - stdbuf -o0 -e0 printf "[FAIL]\n" - exit 1 + + check_expected "type" "token" "id" } test_remove() @@ -519,16 +536,7 @@ verify_subflow_events() daddr=$(sed --unbuffered -n 's/.*\(daddr4:\)\([0-9.]*\).*$/\2/p;q' "$evt") fi - if [ "$type" = "$e_type" ] && [ "$token" = "$e_token" ] && - [ "$daddr" = "$e_daddr" ] && [ "$e_dport" = "$dport" ] && - [ "$family" = "$e_family" ] && [ "$saddr" = "$e_saddr" ] && - [ "$e_locid" = "$locid" ] && [ "$e_remid" = "$remid" ] - then - stdbuf -o0 -e0 printf "[OK]\n" - return 0 - fi - stdbuf -o0 -e0 printf "[FAIL]\n" - exit 1 + check_expected "type" "token" "daddr" "dport" "family" "saddr" "locid" "remid" } test_subflows() @@ -881,15 +889,7 @@ verify_listener_events() sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q') fi - if [ $type ] && [ $type = $e_type ] && - [ $family ] && [ $family = $e_family ] && - [ $saddr ] && [ $saddr = $e_saddr ] && - [ $sport ] && [ $sport = $e_sport ]; then - stdbuf -o0 -e0 printf "[OK]\n" - return 0 - fi - stdbuf -o0 -e0 printf "[FAIL]\n" - exit 1 + check_expected "type" "family" "saddr" "sport" } test_listener() From patchwork Wed Jan 25 10:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115483 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79ACAC54E94 for ; Wed, 25 Jan 2023 10:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235835AbjAYKtj (ORCPT ); Wed, 25 Jan 2023 05:49:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235734AbjAYKtO (ORCPT ); Wed, 25 Jan 2023 05:49:14 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D478577E3 for ; Wed, 25 Jan 2023 02:48:12 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id f12-20020a7bc8cc000000b003daf6b2f9b9so918160wml.3 for ; Wed, 25 Jan 2023 02:48:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=lFeFjlVyq7czxhjI1VZOkS1166vM8kNK7PFQZae9ZFw=; b=0iKPrMjvnojdKykTl3Y1/BU4/slXFwnpzJfWxjP/I6zsxmz+F29haKh3nobyfuI3IW bqjYJVtT+5ztCCfSntHJQ5SJx03uRFH5pXXIq22DgpzpQa1eLr9i07J+Y7LiEyCkNKm6 NThUMF6I1qgnneftd36p7AXonkFZ4fjDx2Cf0GIecMi1hMTV3YBQ5uJ4PB7HlvaiSi1/ oRBrCGHNDowu8v/piALnxn7JEwYsqZAhjMoxbUauoLUMyiZadI3OJ+BMojvSf0L5s5uK XQk/E7ICtR3IbxMTP2hu/t721fxMCZ8AQF50hOY1pH5CCOtPnvfkkO4/LRJ3YqSxranL dpUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lFeFjlVyq7czxhjI1VZOkS1166vM8kNK7PFQZae9ZFw=; b=zOotiRHPU2q+ApNeV1DPF755Qm3DXeqVmOeO0jc7IAMswGCTa9MLrYS6BFs0K11qvP QK3ZFmVXqtXI6pCWb/zDixQ2hyttqj7hMZhwsDCwku7/9hgTQNl8cIfof1SV+RPBlMd2 ZhUqdsQnE3d7ACWpugVdCYG6WXOlOVUpCguRhfg05qkBk8VoRV0cqXB9keNMJKMBVkVB h4eEbGu7iRY0CU1OHQbE/TCm8zWQLP48GDCQKxIUhhHwu8pCs3Ffz5quC8Ii701HhPNW fuzOIBeagIkG9hYIwcwqLYxXS41o0Wo8Y7tjNp6I1C5h7+wkUF/oXVE9q69VJJNSTrCb 35Rg== X-Gm-Message-State: AFqh2kpy+gIQ/YehDeXsX6KmiS783kdcHUZbAI407O/crhSWbITPyLWs ri43Dl9PCXFAX/72bK5fa5Hj8Q== X-Google-Smtp-Source: AMrXdXvptRbQHSP6hhhCBCs0bBJe/vPxgaB1q3PVPjyhxjrcTt5/sIY7sxrQUXPnGUYSw/uRN2tP3A== X-Received: by 2002:a05:600c:5390:b0:3d9:a145:4d1a with SMTP id hg16-20020a05600c539000b003d9a1454d1amr28227018wmb.34.1674643685887; Wed, 25 Jan 2023 02:48:05 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:05 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:27 +0100 Subject: [PATCH net-next 7/8] selftests: mptcp: userspace: print error details if any MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-7-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3263; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=XsnNPL7z5dm5JxMwwYbNAIpkerjh8rYMC069ugPLZRg=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdsdzWwXQUyHiKXSu4ihI82o0WJpcgSCoHmMK1 TvyVCcCJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc6gPEA CMqwG7nLxieLA3rVdb76ZtJbgSbkOBnNKeFZCBy+C+1vwjyq8I9ZE9IxbcI1U4udabCNQFs9/k/K1k FJ+70fvbjcD3nF8+lNvlo5RPnO/lcGNePYs/IhrkvXEPtdlAeQZhS0Igj1ImL6fSoMKFJG+22UExot zUWug7JQlV7DFzJi09ZGJVaM2e9AoMMUucEJ2deTa7/+rXzxK0ChVf0q4PLzZwZEUJbNwAMLdk9boM dM/YiempXCSjy3Pfvt3nYJgXkVpUweoEatxVmV3L5QnI9WZCwbw6ctDJZ5qM5WrDrbPClmP6+I8hpu pkABtE85NQkphA23jxYZCQmX+M82xcfQbueyTyAvrs8x3hS4tFrX8mkfWHmn7zYdvjtShDNqmvaFhW +oXDlNB3uA+Qu8kgQO7kPCJAwgLqNXFukdk4zOlSoxCNZiwKQL7R2W4AF4ukYcYEgr8vkc3zyvYqN3 07DIPkX2JIl1aDRQ+3L/kS0SXoerW8AdnqSQTwOEKPprQb2jytyGNiXgq48izc4EKMDcW09OYBpQp+ 8LFqzkTUoc31Bl+oO9w4/UxTAsi7iJ28IMhjtiYCXcSQ6rA9qorzoycBaQ8xW0FRISWiBTpOnm84de cg9MTYafJrq+JNNeVCWgxbMYRK9/1GjEOV+abhHHCI2vSgLYGcT03PB8XgMw== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Before, only '[FAIL]' was printed in case of error during the validation phase. Now, in case of failure, the variable name, its value and expected one are displayed to help understand what was wrong. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 33 +++++++++++++++++------ 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 2f2a85a212b0..259382ad552c 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -201,11 +201,16 @@ make_connection() server_serverside=$(grep "type:1," "$server_evts" | sed --unbuffered -n 's/.*\(server_side:\)\([[:digit:]]*\).*$/\2/p;q') + stdbuf -o0 -e0 printf "Established IP%s MPTCP Connection ns2 => ns1 \t\t" $is_v6 if [ "$client_token" != "" ] && [ "$server_token" != "" ] && [ "$client_serverside" = 0 ] && [ "$server_serverside" = 1 ] then - stdbuf -o0 -e0 printf "Established IP%s MPTCP Connection ns2 => ns1 \t\t[OK]\n" $is_v6 + stdbuf -o0 -e0 printf "[OK]\n" else + stdbuf -o0 -e0 printf "[FAIL]\n" + stdbuf -o0 -e0 printf "\tExpected tokens (c:%s - s:%s) and server (c:%d - s:%d)\n" \ + "${client_token}" "${server_token}" \ + "${client_serverside}" "${server_serverside}" exit 1 fi @@ -225,13 +230,26 @@ make_connection() fi } -# $1: var name +# $1: var name ; $2: prev ret check_expected_one() { local var="${1}" local exp="e_${var}" + local prev_ret="${2}" - [ "${!var}" = "${!exp}" ] + if [ "${!var}" = "${!exp}" ] + then + return 0 + fi + + if [ "${prev_ret}" = "0" ] + then + stdbuf -o0 -e0 printf "[FAIL]\n" + fi + + stdbuf -o0 -e0 printf "\tExpected value for '%s': '%s', got '%s'.\n" \ + "${var}" "${!var}" "${!exp}" + return 1 } # $@: all var names to check @@ -242,7 +260,7 @@ check_expected() for var in "${@}" do - check_expected_one "${var}" || ret=1 + check_expected_one "${var}" "${ret}" || ret=1 done if [ ${ret} -eq 0 ] @@ -251,7 +269,6 @@ check_expected() return 0 fi - stdbuf -o0 -e0 printf "[FAIL]\n" exit 1 } @@ -303,7 +320,7 @@ test_announce() then stdbuf -o0 -e0 printf "[OK]\n" else - stdbuf -o0 -e0 printf "[FAIL]\n" + stdbuf -o0 -e0 printf "[FAIL]\n\ttype defined: %s\n" "${type}" exit 1 fi @@ -837,7 +854,7 @@ test_prio() count=$(ip netns exec "$ns2" nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}') [ -z "$count" ] && count=0 if [ $count != 1 ]; then - stdbuf -o0 -e0 printf "[FAIL]\n" + stdbuf -o0 -e0 printf "[FAIL]\n\tCount != 1: %d\n" "${count}" exit 1 else stdbuf -o0 -e0 printf "[OK]\n" @@ -848,7 +865,7 @@ test_prio() count=$(ip netns exec "$ns1" nstat -as | grep MPTcpExtMPPrioRx | awk '{print $2}') [ -z "$count" ] && count=0 if [ $count != 1 ]; then - stdbuf -o0 -e0 printf "[FAIL]\n" + stdbuf -o0 -e0 printf "[FAIL]\n\tCount != 1: %d\n" "${count}" exit 1 else stdbuf -o0 -e0 printf "[OK]\n" From patchwork Wed Jan 25 10:47:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Baerts X-Patchwork-Id: 13115484 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65492C27C76 for ; Wed, 25 Jan 2023 10:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235588AbjAYKtw (ORCPT ); Wed, 25 Jan 2023 05:49:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbjAYKtO (ORCPT ); Wed, 25 Jan 2023 05:49:14 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D3F0577E6 for ; Wed, 25 Jan 2023 02:48:13 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id f19-20020a1c6a13000000b003db0ef4dedcso919268wmc.4 for ; Wed, 25 Jan 2023 02:48:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares.net; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3qynjSOc6nz4Nf6cQvYVVmdAvys7aqe1bFN8sKVYTz8=; b=mvgkbs7E687JKkTLyPJRpf8Xfh8mSV2+GLd1lNG7xZ/hquVAxxx/ZdarKyszSnvPE+ DBXn/W4v1I2+NKYIqjUPOOorRGG+Kdonx9kWv7PkfHwHg8NakgZhDD5UooSRECRGQDeX tBgY//8TJ1ncc4A1nGHSGMuHVvW6FLrQN/FaPsJSA9xHji44P9/C6IYa9KIuTTDWhkdi ipYwsJGijh9sT/4dflQh12wTP9sf7+iiKdPef3xIM6Sq9EKHcKd3pp+LiAXEFUUKavm6 zXDZMFo+ywL3NJEM4wqelJNC2vv/n2y768gbUPChpXzC/EJ+n0NV8K2eInQsnFhps1Sc BqIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3qynjSOc6nz4Nf6cQvYVVmdAvys7aqe1bFN8sKVYTz8=; b=3G3vIBmFDdDde0MHhyuesBYOYM1eg3RqMJmqfE3wuA0VjnDCZIzeOgc46pzNy4OPjN ISUcxLD2wHog6OIF5CxRb4SK84YK5rqDSimJfvmNofgateRTbUDtRqP2txF2qBhv+OxL AGplLI736PdYnjeKXphTE+Sy7tMEjwSGqvPWoZuRf2pPL63bfOf58sGd8UJnoqrK5x9b RNb3RhbAejPSIzuOIfMv6zt2YV5RqtUKoGQQlTCTtnD7pNVFCHPfDjFyjsX/1b+CFyoP qtADMuHfNvopR88BCgxiDgkZAOjDiXFSg55aGU1uzpFK160gkunkLFjYdqoe0W9+PNib D/+g== X-Gm-Message-State: AFqh2koaiq0GHRtZFpmKZEkkXGoKomCGPXsLV6KGA9fWttWcUCQU3g5h dwC4d/ci6kGuUSPPHgbUTtxaKw== X-Google-Smtp-Source: AMrXdXue8fHvsLjHuYjJlYDZFc9m+OmNq0Yo/E91IxOqD8Lm3kf4A9yMhzqoxJAjsplHCLG0SdGLoA== X-Received: by 2002:a05:600c:1713:b0:3da:fd90:19dd with SMTP id c19-20020a05600c171300b003dafd9019ddmr31052393wmn.26.1674643686984; Wed, 25 Jan 2023 02:48:06 -0800 (PST) Received: from vdi08.nix.tessares.net (static.219.156.76.144.clients.your-server.de. [144.76.156.219]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c424100b003d9a86a13bfsm1423692wmm.28.2023.01.25.02.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 02:48:06 -0800 (PST) From: Matthieu Baerts Date: Wed, 25 Jan 2023 11:47:28 +0100 Subject: [PATCH net-next 8/8] selftests: mptcp: userspace: avoid read errors MIME-Version: 1.0 Message-Id: <20230123-upstream-net-next-pm-v4-v6-v1-8-43fac502bfbf@tessares.net> References: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> In-Reply-To: <20230123-upstream-net-next-pm-v4-v6-v1-0-43fac502bfbf@tessares.net> To: Mat Martineau , Matthieu Baerts , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2122; i=matthieu.baerts@tessares.net; h=from:subject:message-id; bh=6MOG1ZEazJbpV3v3EchrO329puIDO6dd5lQxjWDGRMo=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBj0QjdROHosjdgthf7sJ7fwTT7T291txcJlOXdMy83 0OLZ1G6JAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCY9EI3QAKCRD2t4JPQmmgc7csEA CbPf+IRNTcrGZQC9QI7Yjf/aCMXKOxRtzRhttRiohq7mKvymkfTT4g70DdGz+uRLKD+cK9TkMqd2mv HVH3WfEd+OSehw0Vk/yr3fYuXQewl8dVbg+DA1EagE3EDeUJ0Ztm/y5N2f7Zud34C5b1mWqKShx+dF wg1ybzUvvQu+GCkGL/SqRVNkVSK37EfnYB65gIikXED5CDt/I+wqCi/cOQcmFpjk7/Pfdaj4uhS2mP A/6iMw32sesJ2BMqCVuyCDRxPCOPEiFD22/45KINjXTfVOZGtBYchOynwxDxpTGsOnrWANUWay21xs 7KJ7eIIXLiv+OJM+6+8Fyjl6vW2h5z1msYmcBZjmJMdKFFAGvnx6XGVji524YO3uQECONQolvJoItm Op86B/1iTSVmGpwB7wJJNCTcgWuEB9+GSbRWYyfuKPWgf1YpK4AEHBOCJn74qFvXd0qhHZ8bzKZ6D1 0O/nrR+CJGb4HlMQCrzrr6Xe0KFPfx7UMZg/RiCG9APdhw3Viamh03zD8WfI1Bs0Ocb5x/0K9dwW48 22UiCsU1M11LYEkINUw65f6XsqPO/uwWh7fGmXFHzM9gCg0HeHRi75RV1ztTqey69uMSk5d0aDKuRp RvfrKxDXEYcTaQAG+/nA/RXn78aCdfwHL6oHShYKJXZMf/Mm/6OLUsCoaNNA== X-Developer-Key: i=matthieu.baerts@tessares.net; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org During the cleanup phase, the server pids were killed with a SIGTERM directly, not using a SIGUSR1 first to quit safely. As a result, this test was often ending with two error messages: read: Connection reset by peer While at it, use a for-loop to terminate all the PIDs the same way. Also the different files are now removed after having killed the PIDs using them. It makes more sense to do that in this order. Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- tools/testing/selftests/net/mptcp/userspace_pm.sh | 32 +++++++++-------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/userspace_pm.sh b/tools/testing/selftests/net/mptcp/userspace_pm.sh index 259382ad552c..66c5be25c13d 100755 --- a/tools/testing/selftests/net/mptcp/userspace_pm.sh +++ b/tools/testing/selftests/net/mptcp/userspace_pm.sh @@ -50,6 +50,9 @@ print_title() kill_wait() { + [ $1 -eq 0 ] && return 0 + + kill -SIGUSR1 $1 > /dev/null 2>&1 kill $1 > /dev/null 2>&1 wait $1 2>/dev/null } @@ -58,32 +61,21 @@ cleanup() { print_title "Cleanup" - rm -rf $file $client_evts $server_evts - # Terminate the MPTCP connection and related processes - if [ $client4_pid -ne 0 ]; then - kill -SIGUSR1 $client4_pid > /dev/null 2>&1 - fi - if [ $server4_pid -ne 0 ]; then - kill_wait $server4_pid - fi - if [ $client6_pid -ne 0 ]; then - kill -SIGUSR1 $client6_pid > /dev/null 2>&1 - fi - if [ $server6_pid -ne 0 ]; then - kill_wait $server6_pid - fi - if [ $server_evts_pid -ne 0 ]; then - kill_wait $server_evts_pid - fi - if [ $client_evts_pid -ne 0 ]; then - kill_wait $client_evts_pid - fi + local pid + for pid in $client4_pid $server4_pid $client6_pid $server6_pid\ + $server_evts_pid $client_evts_pid + do + kill_wait $pid + done + local netns for netns in "$ns1" "$ns2" ;do ip netns del "$netns" done + rm -rf $file $client_evts $server_evts + stdbuf -o0 -e0 printf "Done\n" }