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: 48101 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp207578wrn; Wed, 25 Jan 2023 02:49:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXucZEVS/AU8aNCWGtm7KIU+MbOU7XFkxdq5+DUfGSRcoHepddpnjSQlD/ARgaZfvhNDubBu X-Received: by 2002:a05:6a20:4285:b0:b8:9e3a:a3fe with SMTP id o5-20020a056a20428500b000b89e3aa3femr44684135pzj.41.1674643775074; Wed, 25 Jan 2023 02:49:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643775; cv=none; d=google.com; s=arc-20160816; b=drHPsByTUkIL975Z12cgiHA57D30CNBK3Sf6PYwLP2xV/3SZBK/wFNRGl3dM//kpx2 MYl0Gg8Q2yKDUx8awDut71LBodnbH/vgCKuKWGnp8gKe5fZgpaXWvlrTv0ql033Wx1Kj qRMm5Qbqqwn0wvwCMOunJedWG8/e03asnEviR/Qe6xCElB2jLGn1iNtpdCKa6DVnL+vs CfMfA9H09/A6tktbFKOFqnkIEec8REWlPsPk2XlzQiSk/HVjVaffqkeAJpiBJyFwW7j3 eKp+Om9KAH/rwCr84YQZGnZwO6UMmEKFklQmIlFCZckMVifqfiQsiOBewwHx6lqDzXBo S/HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=1z1B/1JOxMW/1pI2Wr97ucv1iX3/JwBnig2uQUdIcTc=; b=KtjD5O2A4s8d6vNr/+XGx/mTyMCqw1qbc0TyPUT793zbAZtgcAuCPw7fcylxlI4DAy Xw1TmBPgHIflf1zai51lB9wgpz7FxdTbqZp2bLgqFqZd6Tr0W/EDoYnFUQFx0tzxkD4w AAZbVbm4GFkCDJhIMK9qY7zzGeVTUz5wGkD7MXrr96UD3orqhptdIxZE+bZ2NE910b7u 1zQsXg9199SMTzEri/GYaFLdfKeqYmTDXNtf5WN/hauEWbT+AwxYxnoI8QC56dkypviF EIlFtsK2BaaC49xcIPL1zXstW03SvxKNeR4CzO2fzfRZRR3ZTvwmo/B1AS+ps4lBuFHH 1gpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=5AlvuidX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a638c47000000b004d2f381e57esi4881230pgn.666.2023.01.25.02.49.23; Wed, 25 Jan 2023 02:49:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=5AlvuidX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235735AbjAYKsp (ORCPT + 99 others); Wed, 25 Jan 2023 05:48:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235736AbjAYKsi (ORCPT ); Wed, 25 Jan 2023 05:48:38 -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 01E1F48A08 for ; Wed, 25 Jan 2023 02:48:09 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id j17so13442196wms.0 for ; Wed, 25 Jan 2023 02:48:08 -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=zzXS1abJZPVzIJ0/IlyebR8h5vilPs4uJHggb6LYBjEMr+6YP4YeGplII1i2bf1Qam kCTx8lsoeXFpV/JaHxRc4aGHYKdpGD7NL4fVPqMGLwb2or9H0BINaAj31usjgMgBFowP bwdQVFvEE4vuvrvfwmoV6thSZhiSfCzStCKsCh85czI0H5L8PlN0iMEmWSnX/+LtkqBb 1+D6QtnrLlUK+a9HFrPxNYArBcuesa1rAggyDIwlrlNIBDv++m/AL6t8kgyzlzKidrN9 1Fms2VBOyrYTQ+BQAn41hPynxSSI59q7kPSIwpWD/myWn4D5715XbVosXGU+lxDqe1ue s72A== X-Gm-Message-State: AFqh2kpGUrxTwpsE/xd1P/PY4kHo52sfk7kPeMx6VaDqwknajdJqe+li sk8PYpoX5vem5srPJuHo1EFVMw== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991271447248435?= X-GMAIL-MSGID: =?utf-8?q?1755991271447248435?= 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: 48102 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp207608wrn; Wed, 25 Jan 2023 02:49:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsX3y9zpT5QNOdOrp3jAQRTxJVKGrG9UhpCHuFZgVw7kN5k+bsl4MHg7INJaVAya7hShilD X-Received: by 2002:a05:6a21:7890:b0:b8:827c:42bd with SMTP id bf16-20020a056a21789000b000b8827c42bdmr39586867pzc.17.1674643780459; Wed, 25 Jan 2023 02:49:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643780; cv=none; d=google.com; s=arc-20160816; b=gjIUbNON3Jsj08AijfwOo+nXdgCgCR+BK5zxjuIOfXHr/88b3rzkeOOy3MTikrymYr h9pqiMmsyVuFZUe4m+ZbWm84GNfUnXeinRdkqlJly/+7H2Y0JyUNL+ERtmhORc+vCh0W HQ3ht0c/BIhnna488e6UQxt3UfOkTUsPWMEDrKepXlOaxhqSSoerUqhCA8DnDsUtNry4 7CCT27zMdAfYwtM3qbTTujhbVY1vBc99/4wePkI0OCExngq8dMQVP5DglxUrKbiiclLz wN2cTFCOEBouUHz4F+bByXkDtY5FatAYpe3a3CHU3/JcAPA8yDJ58lmP5tnF6q2DFf6B 9gog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=iwuYRtkt97pXgnGKWsmcpjqW50hTCzYJA93KmtVKokc=; b=nVeFsIz1Hkl7QG6XezTNV8OHFvziBJNLNIFS3IoM+oB7zs31m/P9Y12ZF/SJIkb8aW 0K87F53FiuclZhy5yZywgIOEF910dljryLxRydfvi4ihubCCtx+2AS9dXo3AwPnxzjtT X+w59tSaLpwJV6iUnNhTuKFmWkzc0Z3JLfpoT64TUV95emjhMls4n3pcdsh7rtO+jlT4 OzmTJFTx206coF/9QyCrJEn8FiYEC9L+jDABVuQVFT7doGuyRT7asM8GHFSE2Q2hUtuk BTlsoH+etlrVwi4dLKLYJLUDscfJzkrADoCsQdBtZ8ex4eJrgeOYlMfBdydWHma9BdMc Jh3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=HlBx+O22; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i128-20020a628786000000b0058dbfcd8d30si5074363pfe.367.2023.01.25.02.49.28; Wed, 25 Jan 2023 02:49:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=HlBx+O22; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbjAYKsy (ORCPT + 99 others); Wed, 25 Jan 2023 05:48:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235740AbjAYKsk (ORCPT ); Wed, 25 Jan 2023 05:48:40 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4973656EFC for ; Wed, 25 Jan 2023 02:48:10 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id fl24so110660wmb.1 for ; Wed, 25 Jan 2023 02:48:10 -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=Si3zyolcvbBuckykmHUX4eZzz+Bfr0kFk3X316/6TPWD/0sKWKzgafDAqxiV5l5g1W 6xEa/EadbNPU42/WkZFWXprXnCfx3fPuMGYxOXf/+NA29Kn2HlJuVuh010ozQPin5qwv cN+pwWALoNOZ4sheWJ49oqKZdVRZp36GtGldrTnl4QnZn0atThQQ8vbaNUQ2Ko1RlNt2 fhGcddsYi7cCgBv0LFulZqxE2L8R54h6CwkCV0Rrkw2KH7vN6oixF89i3hNXgylRQrj+ R0k9eITJNy9sy4WQyF2304KGVzbrXo1g3GHmY+/m9FnY2uGJAiosoLaQ9pQKvK7x3+FA RCwg== X-Gm-Message-State: AFqh2kr06EuPyj6rTigMO4X5uLNO/A32k+fCJmQgEEcZeGdnw1p7E/gS BPX1cHPhz4GoIrAD4vR8axkXQA== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991276536068636?= X-GMAIL-MSGID: =?utf-8?q?1755991276536068636?= 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: 48103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp207715wrn; Wed, 25 Jan 2023 02:50:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXv2tdsSixnR82XkKo/8AhVZwE5h6n7TVoW1Somi76STCo6D8Faf0VUE/YWQE7kLXLn4q1ii X-Received: by 2002:a05:6a20:441:b0:b8:9f05:5216 with SMTP id b1-20020a056a20044100b000b89f055216mr29500066pzb.57.1674643805098; Wed, 25 Jan 2023 02:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643805; cv=none; d=google.com; s=arc-20160816; b=CxOL6aV0RvHMKTsud2OA1jorsgdniyzFTPvLxjcG+/BYajz3jXSm+cgg2mvsdquTP1 3ar0yZszlrfV+A6hThL6ycSu4y2zhD5+eNqL8L47cCER+kiaW1vjgQjREt49MFhh3/WB Bo/Pd+eT7oxr3Zb0TlFgQ5xcje1DEvKXh0mkFWfsoMsWs8Z7f37yufnw0pgCqq/QIO6R 6J1Y+z15+Ij77ABiux+zSHqebJYvsV6XMTKeGmHbDijMl4cvGQVqsCkWY6SzTwbQ9tzw wJHeX2PFZpqpz4xtXhf/+MTBa1iXWiAyNG177D6mTwCESIe6DAlmbQAGNhryRkX8ubJ+ pEDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=mjFauu1ty8EOKl/zKVHOIwAbYvDY0AH2ut63+GQyyss=; b=o5uDSIRv/XeDj9IftFl3YUKKwzN7YHy0ndHBRT4fifZfBbFXRqQyv2Trt3u69Ia2Ko qvTKIL9HZenh7ylDRz0dbIUMNuI6v9FvLwqANqOOupiwuS8aWuNag779CLrueB6st/Vh GXs97UlPOcigbU9hXTPJx4lPk6kqg2EoBcZrzmhf1zCbG9GW4EIo5JLHXLUJZsUj9WLN ROyyFvicimtKAhJOJmIQb4ktV6km5TMZHh2gsqaWO4CCAidVB4anOPwWT+GlOG+bWWj3 qu64iNvHOQRP0xAW6tJICvvSF6yJfQBR83k9HmaTGs57Dz3+nGDRtUz1+zlOHmJCrCIR P8rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=HyC9KJ++; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o12-20020a63730c000000b0049148558226si5386598pgc.681.2023.01.25.02.49.52; Wed, 25 Jan 2023 02:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=HyC9KJ++; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235794AbjAYKtQ (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235770AbjAYKsp (ORCPT ); Wed, 25 Jan 2023 05:48:45 -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 44D38577C6 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id bg13-20020a05600c3c8d00b003d9712b29d2so928406wmb.2 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=Pve4Ik1xjFFX2HtRMmcXqCyfSnsDlkCTFHUIgQKm4dNyBDqjqL7mNelJL/HGl4iDgE Mv/eb6IeuezQpCbBbPjK1czJipDZEPYazdbeaBGAoOY2xeUtKn0bbsSc8mSce82/y1KP teCqdcQrMMuRklbWuh+5ujrUWyWq3giOxIik+LSHWeW5s9m8CkP6swg82D2oG3hqIxT5 yUrznRUezrgkNi2BvQTG1n3yqGdbIsIQ8xg0FzV2CnrSZ2kTEI3qiUa36gzdRt1i3NFR ttA80txubIY1vlXLYcvafzyhgRW0UORspsMlDTvypLfBMWJ2GxkkNAZ2aGu0+GXjm6TU l5Rw== X-Gm-Message-State: AFqh2ko8Xb+MpYc6oq4lGU4AKtmITzZx/RdQHBa/rNsVj2Q1uQlqu64X UHfkVy1enhYeR8AY97KweSTgbw== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991302431162153?= X-GMAIL-MSGID: =?utf-8?q?1755991302431162153?= 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: 48106 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp207805wrn; Wed, 25 Jan 2023 02:50:21 -0800 (PST) X-Google-Smtp-Source: AK7set/R+Z7GWS7+gYlCJ1uVnlHsXKlqSFMeaozfO7coD4IMWtWDYLLKozGDczcIsttd7nv6qL9f X-Received: by 2002:a17:903:1205:b0:196:1f80:105c with SMTP id l5-20020a170903120500b001961f80105cmr4246254plh.64.1674643820774; Wed, 25 Jan 2023 02:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643820; cv=none; d=google.com; s=arc-20160816; b=X2CxHd81HIjXW/9lJFGBP9Je2XZO1X+5/MzkyhE5umGDM6UWL1SUy2qJ5iD2/wRnML VD2NFiL4/YnSs2QmJ41ER4EPk5ppRfxXTre/udcWXsu+i5qS+l8MEqfoOHP+uzxLRD3w Y25Zjg7CpaaFneZZyL44NWB1GE3ck31vViR72Av1RcplvoEPcMIANRtbY5DhiNpSA9/D XDCOL6k2K5KMVHp0ybYiUXLeZ2+oDze2lVQWGEMtQc61vPBeaItA/xBPT1JLsDl6sFGA BY2p/t+WQOFJvu/dHJ6yz1Cl0funEnde2GOKB4MKc8063d0KyyKOdVPVxh+JMF8bM2Fn diZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=rXq3Avj7Ia8STiRseUvkMdz+nkGFrD8MDyDhjItUgZ8=; b=Fm8Q0bKNYwxY6cC+hlzoKK33rIb4u/KQeu75oJaxzoVhBeg4bzZZQoHeBP5JLl5LfB bWyAW9SWCOBeEvZALyeqaD8WD/MiAcSJtb2muh/zpn4SeuxHbe4o32a36o6+eBrK85OA MZyHBr/s1VMgAfWtdR+1p1gQ7YEA7RCCb5zVdiBK0b/I4EpCae/NQjf25OguvqTuFbbf dRxy6ZgL2XdymF3K+A5OxYyoVeuoZLJwIaGjcKnkJ/Ufz5zJ0B7nKPNsd+eUpoCzky1C F8Gpbldk7Gmf8hVla1VZseakACNkdtseEzLdG+w0hgbRPX7lcht5W18M4lT2y3eNRZd2 vY4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=Wur4C2zW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a170903110600b00189cbf6953dsi6132924plh.300.2023.01.25.02.50.08; Wed, 25 Jan 2023 02:50:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=Wur4C2zW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235592AbjAYKtV (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:21 -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 S235777AbjAYKsr (ORCPT ); Wed, 25 Jan 2023 05:48:47 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49418577C9 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j17so13442303wms.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=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=oAh2+EnAmSdFV26bYhd9eMUHyxIrobGDBNbPwyGd2P5EDNE9WEDC1pYZ8qlJt+UJE7 3dLS/4zRXry24lPk2HVm3x2iIX6h8KZ3fOLSj31zvODQdCaiswqL7FKosvVekLIgKosp qMOmP9ICUSODwMm4JD69vIEZSo3jf2iGF2djLZMyBHCNAG+fQvlevlj362UoEXmrYQ8Q wY3EU6s7nFolh4S1TtOw8QO6YcZYqkHDopGFSiCJa6zmoj+HnDHigrqQvZTkYl2lAp+o S4XnGfxR4QsF4Fd4bC+w1RqiOEigio7jOqyJLyyjlSXZ4bR24A5H1qpeHWobY0zbKJ7I Os6A== X-Gm-Message-State: AFqh2krOFXe/K4BnlfSetbeTThvRhSBtXmOGlBof764PA9m/3PgnTCg4 MzQcpolxKhL1Y5tmoX7SAmjsrA== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991319244773661?= X-GMAIL-MSGID: =?utf-8?q?1755991319244773661?= 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: 48105 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp207793wrn; Wed, 25 Jan 2023 02:50:18 -0800 (PST) X-Google-Smtp-Source: AK7set/TbJnc8hmPPTby1T74rEP21nsHbmlTghqCO84qHITr7ruPHDFTbzJFgjyspQyAUFb1kO7E X-Received: by 2002:a05:6a20:8f20:b0:bb:9ad9:4967 with SMTP id b32-20020a056a208f2000b000bb9ad94967mr7468212pzk.44.1674643817697; Wed, 25 Jan 2023 02:50:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643817; cv=none; d=google.com; s=arc-20160816; b=MkuAJ8T4UPaDxDoAGH52Q/uREYL1irj5ho2i4Az5WGNZLcgHhfnOGaBIfyjg/voMEY EZ01cu1QngsBip9IwkFM9pRi9XDo3QkSfeQ8/YlDNZ+L94zRIm6f96ZwrX6sovT8t33E iG/2STTCKsWNJyhYkkkCj/h6ZNHsFLCmHBl2w8vNjIzTY7C1ONiZ2WFPYZvqq5VogfBF v1++fsYuUjjb57gsw8JFee2kVAv2h/+Y1QwJlAZlCYqiKRTOnzROXHfIeef9qtKy/nmr gX+wDV3adK8ueLrpUrJ23FIo6HFMlzL+UlOn68xoFYBPgFWv2/Ly83p2W02W4u/zZjfm OsmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=RV58zA+SCkILm0XZPHyNHRUHK+pvhsdLrbaM8qBjSmQ=; b=YkrgfDLeVdmPifskOlnMVZpH2cwu9/+UU1dCtiaHMQepE3MmkZ+0/0p4GGB8DZhM96 OtdIyik5AtlYFEmKj/Y9meGIvGIbNOaZL7Gm6u+crihB13vupsapcUGcV5T+blUxu/i3 +o7NAxPy/nSEeubWopcotiPbWXHS4dcWBGuXpp5rR03ZJD7VfR0NIxTr8fx7l1wY5/fn c8RIhu0fb+xDvW35WOyb/kTCN31tXwMkAJ9wRHKidX8Qhj6Zhz7IF5ZA4wc06tXp4psX 38bBkYQbz9Q4J5xIIdQKySnGWyyNjA/yRav1j6BDNPxRs7/dGycL0ue+xXcSizJU4Njb iWGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=OwVPRCZN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m26-20020a63941a000000b004ce5301edd9si4657988pge.120.2023.01.25.02.50.05; Wed, 25 Jan 2023 02:50:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=OwVPRCZN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235778AbjAYKtT (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235773AbjAYKsq (ORCPT ); Wed, 25 Jan 2023 05:48:46 -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 4AD55577CD for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id m15so13409514wms.4 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=ukXCLMZP6AkoQxF/8pI2i9REfr8Ij3lYwNeIi34XltSj7jk80NIjkaYlFK99WgL7RP 9qhrPH8rnyjDaekeKwx3s4J8hdq2d40ASLnxTVBKtwQf3G1Yn9C6sfXh30Xoy4T53ine 8f4L+pSUM2cmsCGd8lyfZeLTN6jvK2jcnuHE5qYsugNted0XvqFweLZW0ofyj1mGR2V1 6BWXX7ksfl345+hvg1PunrY/2aFvZhoSOUMrNubosPODurWo6l0LKvS7e8Cvc3GRFxrk tJnYh58j36RgZHWMkZSkGKHWQiFOr4A0RmloyCwCQfao68R52UMitieAulXOquYUuKA8 2HIA== X-Gm-Message-State: AFqh2kpuYP8+m2tjXHqOxKNLjvJd7acDVbpGfsOsRfD4G920lYqSCPqv uv+jeScxjfQr/G5iB5elquBpDg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991315792928005?= X-GMAIL-MSGID: =?utf-8?q?1755991315792928005?= 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: 48107 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp208007wrn; Wed, 25 Jan 2023 02:51:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvOKN24TmRCWAEQyRIjBKrReh7rnqBXHSCKKi9Z9mWDx8G1TF45Qw6YMmm+JZfnIYGRoS/E X-Received: by 2002:a17:906:354c:b0:86e:2dd4:6655 with SMTP id s12-20020a170906354c00b0086e2dd46655mr29199773eja.51.1674643861184; Wed, 25 Jan 2023 02:51:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643861; cv=none; d=google.com; s=arc-20160816; b=te9WgBKtAqD0pqy3gH6xFKWe+cyUI+89qUWo6SFV9aJSwIWqx/tSc/TOQbAYhl/i2I xQeKxt8St6lNn5kta5cgXYUr7ho8O9E86MZ2TkPewEMMhqno0q4wG7QOI0vxUhRIRsoP QK0LIYzX1AYB7pCZ5CYp/eGOUB1LeriE1mMEghI3DPXthO77mnFapRbQ0kR++VQSH4Tw 79xlbMifYQiKB6k8XnKMMBDetkQ7ynVvS/heHjx3oZldcYDLCFGcl4ZCr7EpJt3z1RKX Qa16zzMb2NkFJDsUuYI4fkAmvGv9v7oA8GDN77UvyoLjLNtzB3yjegW6g2ZeVV1tzSAY OQOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=YQermjS6R/5XAyAu5/q5M18B1G6CnrMggCM48+JT+NI=; b=BjZWcAU66u//OpctGccJuIES4TDg62TFlZ62z8WoSgCnsMz8E4+IwC71TxFgex//qq baw7gFhOi56Gmps290cn1G+c3So7kmW0GBT9ITZVrcwxOLNOEIp7bYP6w7YK24ZPy27S Fhcwps9hIFYwGiGCsGSY7d0wtfeNfC6hkeCZDRjh+P7zYuqNtvErgtyCj2WtEGA2gK5q 3L+k12DDaFciAWBl4mJ7oFfSoQ3TpgKhpjF4LIj6jU1m1RMIWLE3cVHpGySIgACXDesd 6cFklLx6aTDlnLD96MA3IWtIjXDXI1bqnPsZbESJ6kogWtgBOUAvTaTX9q98rEzqxl4y zttA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=ggZDxTUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 29-20020a170906001d00b0087329ff5940si5291600eja.770.2023.01.25.02.50.36; Wed, 25 Jan 2023 02:51:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=ggZDxTUW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235820AbjAYKtX (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235433AbjAYKtN (ORCPT ); Wed, 25 Jan 2023 05:49:13 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B121156ED3 for ; Wed, 25 Jan 2023 02:48:11 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id o17-20020a05600c511100b003db021ef437so961824wms.4 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=H1isQt535fx17dtToKL7NRmJ3aJE6mhO7BlxGmSixl91+Bl3qV63PdmcctycSovYXo AstqY9Y21Gjc53+JBNQsdESKpG1OfFln99jRQQJ/8scHun+gwxMnHTRf4T9coQxJMgja AWs11tw0qvKslBXu0cPvkscK55y9YVIx2bPtxf5oJbcaRhT/G4pW/wUxeqj37a+EswX/ esosrmu4NhfyaBQdKza8Xo4QuJIZ4MWuOet7DHtqKXvnufvTXfMrDcXBMe1C7Irm5zSZ RE60/fizb2kogYlixDfXCsGWYATixH6Ih0hWdMCnPOOVRGkzH9FAaD/5+zSvkGxl0W0B RBgw== X-Gm-Message-State: AFqh2kpcunDOwUM1nuAU9MllWWKXv5x5Z39+71b4ZDl0GYpo9OcEtx2z kh/EHDK2CKP5VMaNvhhILPEuLA== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991361377055377?= X-GMAIL-MSGID: =?utf-8?q?1755991361377055377?= 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: 48108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp208046wrn; Wed, 25 Jan 2023 02:51:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXsyraBoXbQSQvvfYZe0nPS3pZnVthq1YGXco7MMi0SIYdg5L/9KD9hKI2r7A5DlU+smIbnS X-Received: by 2002:a05:6402:4d5:b0:49d:a60f:7827 with SMTP id n21-20020a05640204d500b0049da60f7827mr35235802edw.6.1674643866357; Wed, 25 Jan 2023 02:51:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674643866; cv=none; d=google.com; s=arc-20160816; b=tXR+Aa0KcU5EOxn7vlLs3adKePVJnyDT1ld/jEIWvhawiawWeNAgmLEZqnKE52T4rJ c/poLMWGtk05ioIH563X7VQedGtIwthvCqH9L/ZXe4wkTBAKUXYf8gfpQmnM1X6kcxIO rMs/JwWJuG7UKSdm6jgPfBgEkkKXzJjoOGkJqNDV2b7RDf4wEkaB7ga/7YgYV84PvAQB mlLM5ZTe4xQZ5YaRlArE0MVhzdul/od1IUrUwyAi4ufbd0xtg4DvnNNozrPYnEhXhZOS bolDOOwQMNN0CqXCwhHzSJYHY+H2f84FZXUwL9Wl6/yI78BNulwhCuuKHREwI1ZqFTY1 S3hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=lFeFjlVyq7czxhjI1VZOkS1166vM8kNK7PFQZae9ZFw=; b=AbUpZfAHqlYMs/MY5uNQoOca0H1QNw8+idgRYgWd0emmJqWmzXBjZGThXa0JDTer02 pWUsouLT673dJX4U9cy+vSYidsrwsCFW6RtBsfeYhS9Xer+NUWXSBCd1Ia4IZKYLUXHL BhHvKitiQ0WqRUdqfjwD2WSe/i+aUdKzQxVoYvJWmOgfx4gRYKVsWhpvjD0RDOmyWyZB 4b9Ke/Ru21yyvR5y/mOJqdWRYHykKQgJ3wKNaCrCEXZr/lNYoC5XB7zMsu7Qx174h2+z agEg+F6zatAfDpglqJAsjHcq4vnfUP8Sk1eCytcX2bXuu3D30kqvxetR/izT8XnZWqxf et2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=0iKPrMjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ge11-20020a170907908b00b008706dceb60fsi5281121ejb.106.2023.01.25.02.50.42; Wed, 25 Jan 2023 02:51:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=0iKPrMjv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235825AbjAYKt1 (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235652AbjAYKtO (ORCPT ); Wed, 25 Jan 2023 05:49:14 -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 7CEAD577E2 for ; Wed, 25 Jan 2023 02:48:12 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id o17-20020a05600c511100b003db021ef437so961866wms.4 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=i6+yaRtJJaro68qsbBPOy8awcXVdnjTP7MRdHqFPkO4Ee8W7I2LO0KuTiTC/VarCpD Vcvr+yWTesJBWw3bqDtPfvhn0TpM0hoCDGoY3VQjFZXc3XluHlJa2+mGBt17DeDq05JU qYtfwQhoB5m2CESbqbwOPJOYqJp88ZGqasoEyx5UiMq4A23BeGCLtm4tta47upcTXK9X wzZK8X44UJrc3pyWrDygFQX9MusZWSxoqk7cB6mzVA4NQu3+F0wb3C/EblnjmJy01+NQ ZVfM5bfnxthukAXcfIcRY4iGw+JQaF4aYWZ7Kep4qj/W1vwVajKPzxTqf7iWUkONohob ZJlg== X-Gm-Message-State: AFqh2kojALt+5nHa5ghNXmCAj93mTR5n7iB0ui3QGouogdQQEActqVpU sVrh4GBauTEbL2eSSCYa1CI8fQ== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991367004269641?= X-GMAIL-MSGID: =?utf-8?q?1755991367004269641?= 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: 48109 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp211361wrn; Wed, 25 Jan 2023 03:00:34 -0800 (PST) X-Google-Smtp-Source: AK7set8jMTind3XpK4hr+OXVtfVOVRX6X5VWOc4ZNOm8IYCuUlvxGKkfkD9uNFYUiZbVIOg++jh9 X-Received: by 2002:a17:90b:4f43:b0:22b:fd18:f333 with SMTP id pj3-20020a17090b4f4300b0022bfd18f333mr3869221pjb.40.1674644434477; Wed, 25 Jan 2023 03:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674644434; cv=none; d=google.com; s=arc-20160816; b=qsTKoz9XUiIDHO5dt7Cg8J/G7O+R1FqbD06FQE21Zj+AriH0WrHiw9YPkC8f/8N0B7 7o0fwNN++XU872eE6pKgVxAtOwOjLp9QmZ38qfHGnQtGIDQg6PzgIae8bSAq8wHTdGR0 HpkHWe0vJ19cqaP49xD090GTbzK8EuvbL1RW6Jr+CK9JCV+km2jE1qOy0ZMJH7U4TXgZ TAYBYnQVfsCTkSi28zNbXN1oA1xZx6Co85jvzqUzN/gYaq6M1wy6BYoQJ4H6WXKQYZ2A GuxkC6sYptJHy3AQwA7kcfboy79WFnE1TrwdR8mkY4muqxD+XkvMKtrSlKQvz0Y6PleI 2ddw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=3qynjSOc6nz4Nf6cQvYVVmdAvys7aqe1bFN8sKVYTz8=; b=Hseji+w2eg5akPtTiELjb6XQ4rIDUf6gqknfBNO1kaPUMyyumDnx2GIHYy26GexNba 10HDcNku0s3p2wKVreGAurBlWe1webT+4SLh+Qlh1dumjz2395rkzifbAYDmquRAKYzi ut6shdVx5EFg1L9JnK77XROSj1Gj0ln1nekppOrXwapPKBJuirmA9OI0bt18KrEnwXr+ cei2p3voM+uxuw34HV0OZH5sLuG46dZjP0Ui7mvP0yCkb9Q8KpdKYFpilCjLSdFTY98k GLVY096bKA3p4IEXKdo/c6EFv2aPJEDcanZyTKf5mq9WhCjf1sAqrVkiZOD/EnAf/UV7 +LLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=mvgkbs7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a17090adc0d00b00225f9fff787si1652549pjv.146.2023.01.25.03.00.20; Wed, 25 Jan 2023 03:00:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares.net header.s=google header.b=mvgkbs7E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tessares.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235830AbjAYKtf (ORCPT + 99 others); Wed, 25 Jan 2023 05:49:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235731AbjAYKtO (ORCPT ); Wed, 25 Jan 2023 05:49:14 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F708577E5 for ; Wed, 25 Jan 2023 02:48:13 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id m5-20020a05600c4f4500b003db03b2559eso961542wmq.5 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=0TxavutZULPlu8YOsMbQxlRHb8r/j5Kni/ZKWnHjqVzl4t+Xu0V4p5nHdruDw+kD5l ukMx3Gg1v2VkQUfD1M7oCanjm4r2aNy2YpLKgxjG86bHx7+7djVpR6mXXcNAI9ivQdpt 8cnl0J1z2++c67tQiBKKfoAYJQRGHXQ6Y6NQAsDhOhkZBx85k9BGQifDTylAaqxlK0TG hbw+mmEgq1j/XMZk4WYs4ZiF1RBrwxV6QX0FLh5rUlUuZKohhr33piENSkdkhL4zyx91 yDh+BzePJa2tnuSgzH/cdlO0oY4uF7QJvt3Mb6kKpN1H8kzKIIaFItCVvyvslLiTjrZ2 OLZg== X-Gm-Message-State: AFqh2kovpHcEFctf11NK+/iSzKMlpnvzv6VfOjiw4Wd0z6bVB77qbDc0 L+jbrv5Mt8cQLrt3bTzFtUW2Eg== 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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755991962671777494?= X-GMAIL-MSGID: =?utf-8?q?1755991962671777494?= 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" }