From patchwork Thu Jul 29 07:20:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407883 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F46B72 for ; Thu, 29 Jul 2021 07:21:02 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id q2so5881035plr.11 for ; Thu, 29 Jul 2021 00:21:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BKvRbtmuJdjfqH2ZpwdzAOGPNsmuuT3RA9iii/z0e5w=; b=XgN7A4cIx8dmB4UKHEsZt4AUlfH1WVLY7U+Ik69OBT12nkgjT5V16bLOEcFOwE+D5R unTDNq8/DC/dsiKV2gzBwk5XbuwIIzuFMMJ8AC0Cr9SFTxb0xxBorPEIzo6a/6ciIMkV Hi8zznvHX7MxNfzFF6/tL4KjxWiW6Y2odRe9fSZnlcE2EZTPgO6fK4j2MA1lLmxMbaTD Ev/mDjZ3nj7hxIiVApMLyV/11zmweM4UnmL7I8WkFEvD4D7U4WR5bDSTwKm0m+P7Hx7x 3/s4DZ3w+fhVwSRwMO5R2sch2VyM1WWAOCd1a6dYUO9hkeW9THQ63F/wSkdGa33VEEDf xOWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BKvRbtmuJdjfqH2ZpwdzAOGPNsmuuT3RA9iii/z0e5w=; b=ni68HlGPROXXgKdz7L0jVHL9U4lMVbZDC8FAWeXfOlQgmKKmFZLpJVW4gZxzB5h38z 2TBpeCF7LYYYVfFtY8M0RbmcIPF7UHipmRuBFe/TJ09+ltYwltsl2Jkf0FYSO6xz7Bmn EZ8w+tQi9/ZKrDXikEoxzVvcnu8N2ORnBA1dKn3YDy3uePzwUVFmJZxXY8tHe7H4hA6T OTWjEjVeTJ9F/9RbTi8hrCnp3IwzQhlBnyHmajLGWDf7Hh3ofol0s7UK9sNE9fd4RI8Z 4q7sNo+Iery2Gk6kiLp6zbNMVFdscvAeRnTFE8enaa3Qk0ZE5kUTRwW/4YVbvzJWgsmA T85A== X-Gm-Message-State: AOAM533O4d/Uq74sCI8V14qNeLNvU3pkucilhlvZCOl9Su9RqLG/RosO tUR1tYXIsNpPT0SL0QHz5s6ipr7qb2s= X-Google-Smtp-Source: ABdhPJyluETiYNNtJOwtTRqU0TxovmUl3utYUS9ljoO2eiQPu58Sr+oGOENjw0cfEeZLv9MjJwNL6w== X-Received: by 2002:a65:49cf:: with SMTP id t15mr2667081pgs.109.1627543262085; Thu, 29 Jul 2021 00:21:02 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:01 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v7 mptcp-next 1/6] mptcp: drop flags and ifindex arguments Date: Thu, 29 Jul 2021 15:20:50 +0800 Message-Id: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added a new helper mptcp_pm_get_flags_and_ifindex_by_id(), and used it in __mptcp_subflow_connect() to get the flags and ifindex values. Then the two arguments flags and ifindex of __mptcp_subflow_connect() can be dropped. Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 25 ++++++++++++++++++++++--- net/mptcp/protocol.h | 5 +++-- net/mptcp/subflow.c | 7 +++++-- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ba0e1d71504d..94c68d6093de 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -462,8 +462,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) check_work_pending(msk); remote_address((struct sock_common *)sk, &remote); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local->addr, &remote, - local->flags, local->ifindex); + __mptcp_subflow_connect(sk, &local->addr, &remote); spin_lock_bh(&msk->pm.lock); return; } @@ -518,7 +517,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) local.family = remote.family; spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local, &remote, 0, 0); + __mptcp_subflow_connect(sk, &local, &remote); spin_lock_bh(&msk->pm.lock); add_addr_echo: @@ -1103,6 +1102,26 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id) return NULL; } +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, + u8 *flags, int *ifindex) +{ + struct mptcp_pm_addr_entry *entry; + + rcu_read_lock(); + entry = __lookup_addr_by_id(net_generic(net, pm_nl_pernet_id), id); + rcu_read_unlock(); + + if (entry) { + *flags = entry->flags; + *ifindex = entry->ifindex; + } else { + *flags = 0; + *ifindex = 0; + } + + return 0; +} + static bool remove_anno_list_by_saddr(struct mptcp_sock *msk, struct mptcp_addr_info *addr) { diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index e8a36ff52af6..d276ce16f126 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -576,8 +576,7 @@ struct socket *__mptcp_nmpc_socket(const struct mptcp_sock *msk); /* called with sk socket lock held */ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - const struct mptcp_addr_info *remote, - u8 flags, int ifindex); + const struct mptcp_addr_info *remote); int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock); void mptcp_info2sockaddr(const struct mptcp_addr_info *info, struct sockaddr_storage *addr, @@ -732,6 +731,8 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk, struct mptcp_pm_add_entry * mptcp_lookup_anno_list_by_saddr(struct mptcp_sock *msk, struct mptcp_addr_info *addr); +int mptcp_pm_get_flags_and_ifindex_by_id(struct net *net, unsigned int id, + u8 *flags, int *ifindex); int mptcp_pm_announce_addr(struct mptcp_sock *msk, const struct mptcp_addr_info *addr, diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 1151926d335b..8c43aa14897a 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1355,8 +1355,7 @@ void mptcp_info2sockaddr(const struct mptcp_addr_info *info, } int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, - const struct mptcp_addr_info *remote, - u8 flags, int ifindex) + const struct mptcp_addr_info *remote) { struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_subflow_context *subflow; @@ -1367,6 +1366,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, struct sock *ssk; u32 remote_token; int addrlen; + int ifindex; + u8 flags; int err; if (!mptcp_is_fully_established(sk)) @@ -1390,6 +1391,8 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, local_id = err; } + mptcp_pm_get_flags_and_ifindex_by_id(sock_net(sk), local_id, + &flags, &ifindex); subflow->remote_key = msk->remote_key; subflow->local_key = msk->local_key; subflow->token = msk->token; From patchwork Thu Jul 29 07:20:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407885 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A26A272 for ; Thu, 29 Jul 2021 07:21:04 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id f13so5938959plj.2 for ; Thu, 29 Jul 2021 00:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XO6UvU39x6gNzTfsUjgQppkqU5MSWbZ1Jhg5k3Ey+xI=; b=T91svLWu61/1N5JiMjJuv9jJV3ury5OOupMP2MCDrj+VGkoQartr3pfn7rcrwSuxq7 jWBwcjsJrQV0wkPuq7+P+FHep5YVRrA0OymhoEEVYSH36UC4qosar5iwoQL1BT7x1xBp xI+PRgUsm2mjxuCh96GNdHzWQMAGAjQkVAe9V1l71ls50rrt28MWHJW6DawTw9P9OQEM BLMoTmdavGk3YHW/G6dFj0IaLMg+ZzYrzJzKP6wSLgZxtFtQ2Ks2UEUqHBXhRnNCva4m 06KgUXhMgc/j5EKddo+Kjks3yDmUef5yzSwwsKUg6VttShw0XjMi/Z1REiDabBriuvR8 CG+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XO6UvU39x6gNzTfsUjgQppkqU5MSWbZ1Jhg5k3Ey+xI=; b=FB4DhuJIny+ZQCT2GsQqG25rZDTrltAVHTRuw+KhdWqt1WcF21F3xgtVr7p9VvTCPP VoRh1VTVlUfDg8QHfP7g6WYfNOpAiPYGwluJIg0tv7Ge/Y54hcZxhycMSXIhboYdKZZi x/PfUwSwOcxsDMs8k56uQtiOIQgIim98Jmx32p4T4wM8NvWwGteNj9uqyjqOHioYQChk jv/PrczVXIoEiXG2/JgqnTTYDDjy+IRF3OoGoePnwrxQ8Fy7MiVyof8JEpOP4e8a6VXV CdzSQEzYuIrMgnit5BB2wJE3zAWTRXP/E+Fasc6aGzHGDxCGwNLhZcn+/APLToK7tR8W ZBCg== X-Gm-Message-State: AOAM533sT7wfB8+ap/rB1xHSejlVwQeXXj0HO+FXchTcQY6dZHl8QcBG Hy9zbBdVyQ2QRcGnRJh9+rEviMOoIhs= X-Google-Smtp-Source: ABdhPJzjzZqDJ1hXTKs0Wd3yQq2DfUDsOI+IczVI66e/hk+oJDvAkL0pTz/yLg8vnI/UFhF0j3sB8g== X-Received: by 2002:aa7:939c:0:b029:377:8bcf:2374 with SMTP id t28-20020aa7939c0000b02903778bcf2374mr3560097pfe.53.1627543264161; Thu, 29 Jul 2021 00:21:04 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:03 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v7 mptcp-next 2/6] mptcp: remote addresses fullmesh Date: Thu, 29 Jul 2021 15:20:51 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> References: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added and managed a new per endpoint flag, named MPTCP_PM_ADDR_FLAG_FULLMESH. In mptcp_pm_create_subflow_or_signal_addr(), if such flag is set, instead of: remote_address((struct sock_common *)sk, &remote); fill a temporary allocated array of all known remote address. After releaseing the pm lock loop on such array and create a subflow for each remote address from the given local. Note that the we could still use an array even for non 'fullmesh' endpoint: with a single entry corresponding to the primary MPC subflow remote address. Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- include/uapi/linux/mptcp.h | 1 + net/mptcp/pm_netlink.c | 61 +++++++++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h index 7b05f7102321..f66038b9551f 100644 --- a/include/uapi/linux/mptcp.h +++ b/include/uapi/linux/mptcp.h @@ -73,6 +73,7 @@ enum { #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0) #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1) #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2) +#define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3) enum { MPTCP_PM_CMD_UNSPEC, diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 94c68d6093de..77cab67e732d 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -410,6 +410,57 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk) } } +static bool lookup_address_in_vec(struct mptcp_addr_info *addrs, unsigned int nr, + struct mptcp_addr_info *addr) +{ + int i; + + for (i = 0; i < nr; i++) { + if (addresses_equal(&addrs[i], addr, addr->port)) + return true; + } + + return false; +} + +/* 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, + struct mptcp_addr_info *addrs) +{ + struct sock *sk = (struct sock *)msk, *ssk; + struct mptcp_subflow_context *subflow; + struct mptcp_addr_info remote = { 0 }; + struct pm_nl_pernet *pernet; + unsigned int subflows_max; + int i = 0; + + pernet = net_generic(sock_net(sk), pm_nl_pernet_id); + subflows_max = mptcp_pm_get_subflows_max(msk); + + /* Non-fullmesh endpoint, fill in the single entry + * corresponding to the primary MPC subflow remote address + */ + if (!fullmesh) { + remote_address((struct sock_common *)sk, &remote); + msk->pm.subflows++; + addrs[i++] = remote; + } else { + mptcp_for_each_subflow(msk, subflow) { + ssk = mptcp_subflow_tcp_sock(subflow); + remote_address((struct sock_common *)ssk, &remote); + if (!lookup_address_in_vec(addrs, i, &remote) && + msk->pm.subflows < subflows_max) { + msk->pm.subflows++; + addrs[i++] = remote; + } + } + } + + return i; +} + static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) { struct sock *sk = (struct sock *)msk; @@ -455,14 +506,16 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) !READ_ONCE(msk->pm.remote_deny_join_id0)) { local = select_local_address(pernet, msk); if (local) { - struct mptcp_addr_info remote = { 0 }; + bool fullmesh = !!(local->flags & MPTCP_PM_ADDR_FLAG_FULLMESH); + struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; + int i, nr; msk->pm.local_addr_used++; - msk->pm.subflows++; check_work_pending(msk); - remote_address((struct sock_common *)sk, &remote); + nr = fill_remote_addresses_vec(msk, fullmesh, addrs); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local->addr, &remote); + for (i = 0; i < nr; i++) + __mptcp_subflow_connect(sk, &local->addr, &addrs[i]); spin_lock_bh(&msk->pm.lock); return; } From patchwork Thu Jul 29 07:20:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407887 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D588C72 for ; Thu, 29 Jul 2021 07:21:06 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id j1so8982867pjv.3 for ; Thu, 29 Jul 2021 00:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B68x7vyF6aiLCTG6YQXZBP4wuxZEGgElPeaKR1afKBk=; b=CCAz2gHr1nuKfxBaOyxz0m/1gMnMoWGOKmS75Z6IA+pGqYPyuvjneYv671uEkMSDWX A6dsoXaD2j7EJE9UkHVQ4GwgBLN9jP9busybo2QcbLIac/x97iVNbhWtG6LQZVzaR4no ifyBoQWMrRVw2JgovHGzEsJUG4epW8ciKSXgSDCvFjzZnkmOkSZJztsyHKjOhVErLyNS FO0/Mct5Jn3wl7Ja0K7sJYcnOHACIbUaWOFYHTuY7KGDmXw79XGnK5QfBB91ihMJZ4Of pvjhJM4AExKhWxZ//khzme/SR4D/84nm80gBDlIVP4sGuGVTAqmPP1TU60GzsM200PcF FCRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B68x7vyF6aiLCTG6YQXZBP4wuxZEGgElPeaKR1afKBk=; b=QBSTCWH+Qvh8JX4wJ0ahwJIHRGfP+eTioBGp//1yGTpnTR5CRTIeYXOZk6S1WzYPpG 1yS8ld6F7gQfNtI4jRMty681DHYQ8IrBts16XAVGPKCPgssWnTJllxcHjfINmOi97PJz TFQ843rme9b0CyL4q9jQE2alOQNtKeKKHolLr73fZZ7S65IYz252BEnTFSzvQwdcYBd/ +hlgaN2yay4VICWolyrjgPO2gHz0/RTK3gkTRYQqfpi6FWTeMbAIOkgkC8zb0k27lpNM sDrFZUkz52h0JbKQp0QNFQIaeAoqBFPvP7c2UbeL6UL1NzBdVTq24/FAToHqOTdlM+Gm R3Qg== X-Gm-Message-State: AOAM533GKBMWpZznVDzVn8agbGdCetdwfaJXeZaQWRn4ZgJBPQPJMjf+ hDcCNDjDBEThbQAXfM41Tex76zKOY1E= X-Google-Smtp-Source: ABdhPJybxpqMdndgWZRTbly8C/hfUjBioTiznTzmtGUZ+DUFKarg30O1CNFlPkXeG+SOGXgVqx+5MQ== X-Received: by 2002:a17:902:c643:b029:12a:e698:f74f with SMTP id s3-20020a170902c643b029012ae698f74fmr3313897pls.60.1627543266313; Thu, 29 Jul 2021 00:21:06 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:06 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v7 mptcp-next 3/6] mptcp: local addresses fullmesh Date: Thu, 29 Jul 2021 15:20:52 +0800 Message-Id: <349c97cf4d1091f28aa62e8200ebfe4fa0f5f2d5.1627543032.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang In mptcp_pm_nl_add_addr_received(), fill a temporary allocate array of all local address corresponding to the fullmesh endpoint. If such array is empty, keep the current behavior. Elsewhere loop on such array and create a subflow for each local address towards the given remote address Suggested-by: Paolo Abeni Signed-off-by: Geliang Tang --- net/mptcp/pm_netlink.c | 73 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 77cab67e732d..b0be7c9477d7 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -536,13 +536,67 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) mptcp_pm_create_subflow_or_signal_addr(msk); } +/* Fill all the local addresses into the array addrs[], + * and return the array size. + */ +static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + 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; + + pernet = net_generic(sock_net(sk), pm_nl_pernet_id); + subflows_max = mptcp_pm_get_subflows_max(msk); + + rcu_read_lock(); + __mptcp_flush_join_list(msk); + list_for_each_entry_rcu(entry, &pernet->local_addr_list, list) { + 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 (msk->pm.subflows < subflows_max) { + msk->pm.subflows++; + addrs[i++] = entry->addr; + } + } + rcu_read_unlock(); + + /* If the array is empty, fill in the single + * 'IPADDRANY' local address + */ + if (!i) { + memset(&local, 0, sizeof(local)); + local.family = msk->pm.remote.family; + + msk->pm.subflows++; + addrs[i++] = local; + } + + return i; +} + static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) { + struct mptcp_addr_info addrs[MPTCP_PM_ADDR_MAX]; struct sock *sk = (struct sock *)msk; unsigned int add_addr_accept_max; struct mptcp_addr_info remote; - struct mptcp_addr_info local; unsigned int subflows_max; + int i, nr; add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); subflows_max = mptcp_pm_get_subflows_max(msk); @@ -554,23 +608,22 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) if (lookup_subflow_by_daddr(&msk->conn_list, &msk->pm.remote)) goto add_addr_echo; - msk->pm.add_addr_accepted++; - msk->pm.subflows++; - if (msk->pm.add_addr_accepted >= add_addr_accept_max || - msk->pm.subflows >= subflows_max) - WRITE_ONCE(msk->pm.accept_addr, false); - /* connect to the specified remote address, using whatever * local address the routing configuration will pick. */ remote = msk->pm.remote; if (!remote.port) remote.port = sk->sk_dport; - memset(&local, 0, sizeof(local)); - local.family = remote.family; + nr = fill_local_addresses_vec(msk, addrs); + + msk->pm.add_addr_accepted++; + if (msk->pm.add_addr_accepted >= add_addr_accept_max || + msk->pm.subflows >= subflows_max) + WRITE_ONCE(msk->pm.accept_addr, false); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local, &remote); + for (i = 0; i < nr; i++) + __mptcp_subflow_connect(sk, &addrs[i], &remote); spin_lock_bh(&msk->pm.lock); add_addr_echo: From patchwork Thu Jul 29 07:20:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407889 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8505872 for ; Thu, 29 Jul 2021 07:21:08 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d17so5885686plh.10 for ; Thu, 29 Jul 2021 00:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VHqxrqWce8Ff+8g7YaCTOBsDy47DahovPrZhAjoSsBQ=; b=cf9V9CDQhnOnmFI1tofQnmltkKzQ3rZIGuq77s4uiWgEjxEK88vsmyaEsSAqjYmr8m ujUFbFr3WqS/skmPR9rYrKmx0VJ12UPkbJBlLgEZgvMnNlZLEWP8fY+8jgXzDcWxS/Ee vpgXypaqe/pAXgLuRl6AvK3x+KAzfJ9/JxwVQMxzm+MZZX36/AhKbqkF/OjzoMLyPhPI CGN/MRAP01+WUoZEEcXWbBJtK5wEdhIuZspz9MXQ/tb6wBCvbKHFFTAYR3rjbGJMbHJ9 hY1G5EytdbqCNgWSPDhM5b46//5RXDrF74Tnoj5sSIjN5XHrqY2w3b8cJ33Enl0W1HGE PIRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VHqxrqWce8Ff+8g7YaCTOBsDy47DahovPrZhAjoSsBQ=; b=HEW64iyAhPukKgpEEvUCn64Ys7rTHfzMwW/2xIw5OSBkaPKu2CjuvYPjFJl/pCnoHQ P0pnGfHACOrhvJ1BpBgJEEgNohak9Mvpv53lXEveuLqN7oN+8I4GhQ5WngN6kQXelp9u Nali8kck25vSsAYDNL3QFjfjUGgyjrzKvy5SuJFDTTBnf/8MCw9/fyS3XAjxx3nx1wcG HLSyqgX12TqfWggDiYZ9RWtr26b8FBNKuVUPlHTb+sQc8CwmEByuambiIHoEL9NcaFs0 Tot28HbPpM3d93XQ0WoSKw5TaTdCyswxUCsEIjhccrjpebymeFy3US4WdOiluf0EayLV FpHg== X-Gm-Message-State: AOAM533EtgsuFfaJKGRi1/K4bMFkgQ367etK2aUBOprWomshCCR1D7NW Gai64CVA3+yV6jFs2IbQF1L2K6UL1iQ= X-Google-Smtp-Source: ABdhPJx4xISORQ31tioMhIlvcen3YGy5nAwzXgddVZOVTqXEpqW9DyD25x7TTSMteZB+SIT6xFLhNA== X-Received: by 2002:a17:90b:378e:: with SMTP id mz14mr3854272pjb.204.1627543268096; Thu, 29 Jul 2021 00:21:08 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:07 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v7 mptcp-next 4/6] selftests: mptcp: set and print the fullmesh flag Date: Thu, 29 Jul 2021 15:20:53 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <349c97cf4d1091f28aa62e8200ebfe4fa0f5f2d5.1627543032.git.geliangtang@xiaomi.com> References: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> <349c97cf4d1091f28aa62e8200ebfe4fa0f5f2d5.1627543032.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch dealt with the MPTCP_PM_ADDR_FLAG_FULLMESH flag in add_addr() and print_addr(), to set and print out the fullmesh flag. Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c index 115decfdc1ef..354784512748 100644 --- a/tools/testing/selftests/net/mptcp/pm_nl_ctl.c +++ b/tools/testing/selftests/net/mptcp/pm_nl_ctl.c @@ -25,7 +25,7 @@ static void syntax(char *argv[]) { fprintf(stderr, "%s add|get|set|del|flush|dump|accept []\n", argv[0]); - fprintf(stderr, "\tadd [flags signal|subflow|backup] [id ] [dev ] \n"); + fprintf(stderr, "\tadd [flags signal|subflow|backup|fullmesh] [id ] [dev ] \n"); fprintf(stderr, "\tdel []\n"); fprintf(stderr, "\tget \n"); fprintf(stderr, "\tset [flags backup|nobackup]\n"); @@ -236,11 +236,18 @@ int add_addr(int fd, int pm_family, int argc, char *argv[]) flags |= MPTCP_PM_ADDR_FLAG_SIGNAL; else if (!strcmp(tok, "backup")) flags |= MPTCP_PM_ADDR_FLAG_BACKUP; + else if (!strcmp(tok, "fullmesh")) + flags |= MPTCP_PM_ADDR_FLAG_FULLMESH; else error(1, errno, "unknown flag %s", argv[arg]); } + if (flags & MPTCP_PM_ADDR_FLAG_SIGNAL && + flags & MPTCP_PM_ADDR_FLAG_FULLMESH) { + error(1, errno, "error flag fullmesh"); + } + rta = (void *)(data + off); rta->rta_type = MPTCP_PM_ADDR_ATTR_FLAGS; rta->rta_len = RTA_LENGTH(4); @@ -422,6 +429,13 @@ static void print_addr(struct rtattr *attrs, int len) printf(","); } + if (flags & MPTCP_PM_ADDR_FLAG_FULLMESH) { + printf("fullmesh"); + flags &= ~MPTCP_PM_ADDR_FLAG_FULLMESH; + if (flags) + printf(","); + } + /* bump unknown flags, if any */ if (flags) printf("0x%x", flags); From patchwork Thu Jul 29 07:20:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407891 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7868072 for ; Thu, 29 Jul 2021 07:21:10 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id a20so5974660plm.0 for ; Thu, 29 Jul 2021 00:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gywm6drJnrkHUyHo4/wfyzlnjnVNvjqM3yXnkmpRCu8=; b=J0yn1MGQylU2WgYui0203QKAHtCi9G5EMsSss0luSgnpNhDc7HS0waiWPO3PnAfC3H laCAplPSTDBU7SUqPzDPh+lg6pY3EH2OeSbMNH/ewyU9cKaDPu1evJpZZF1H3vRh9uRS lLYM1iuJYRywpoyG8KZ8WoaD7aDP9XbxEi90GS9YasLghx4Bffzv1MjkQhNec1tOMRnn F25WSTMY2Da+uo2dQ+MqlZRTkpDX5xvYrQIGBjq/Nq2twSULzDfIP/MrT22SpjDkiIyt WeDIv9JZiVGKxHzRp4lOpbpVWR9clXy/jziFnDb/TIXnsJCQ3FNW0YIszUPJCG/PsHYx M1cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gywm6drJnrkHUyHo4/wfyzlnjnVNvjqM3yXnkmpRCu8=; b=UrKbZkN8HTuGyq9s/KdJA7njTgN4AuhpUvKYakzpfJAVtUZxf/PfHQz2ry0b66fqrl sRI4mwD1wchXwyEr9c6ZrU/kNcz5kABW4pdNcUFfbFbsrF1B2PGjFkDHrYRdLKmp1FAR upL822201kYLd6vf2b/aMhfnalrn81mPf2DP6gtW1izjNdNqS+hxwTaJe4dKdvwz42hd fVaWVyzftnF5UbpDhmukwbookWMyZpYuSl7t/t+ElN5KD2LSupGwZskq3gkoe4belldq ODRgdqyjUWaYiQKn3odCPlRZr/iYGGrBPURmmxVY1pbH90KlYbOxejwPKwznrcnL3jHQ NrHQ== X-Gm-Message-State: AOAM531yAX2xgYhsZCEvTguPpM8XX8Tf/hrJBWxH+/rj7rBQw2VTTIZu 6z2jWNIv94wQfEKFrJIphpd3PlN7OWo= X-Google-Smtp-Source: ABdhPJzKaqR4TzQtcUITwSYutvzB10tmOhRMR2ygePGKgkehiPZIONm2H/0P0Iz9osS7AETGOtyIXA== X-Received: by 2002:a62:4e0f:0:b029:329:20be:287a with SMTP id c15-20020a624e0f0000b029032920be287amr3702283pfb.55.1627543269988; Thu, 29 Jul 2021 00:21:09 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:09 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v7 mptcp-next 5/6] selftests: mptcp: add fullmesh testcases Date: Thu, 29 Jul 2021 15:20:54 +0800 Message-Id: <6acd8786b4c151c4c9f01a0370bd6a12aaae6107.1627543032.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> <349c97cf4d1091f28aa62e8200ebfe4fa0f5f2d5.1627543032.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang This patch added the testcases for the fullmesh address flag of the path manager. Reuse the above 10 address numbers for the fullmesh test. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 66 ++++++++++++++++++- 1 file changed, 63 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 937e861e9490..cb5f9a43baa1 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -367,7 +367,13 @@ do_transfer() fi if [ $addr_nr_ns2 -gt 0 ]; then - let add_nr_ns2=addr_nr_ns2 + if [ $addr_nr_ns2 -gt 10 ]; then + let add_nr_ns2=addr_nr_ns2-10 + flags=subflow,fullmesh + else + let add_nr_ns2=addr_nr_ns2 + flags=subflow + fi counter=3 sleep 1 while [ $add_nr_ns2 -gt 0 ]; do @@ -377,7 +383,7 @@ do_transfer() else addr="10.0.$counter.2" fi - ip netns exec $ns2 ./pm_nl_ctl add $addr flags subflow + ip netns exec $ns2 ./pm_nl_ctl add $addr flags $flags let counter+=1 let add_nr_ns2-=1 done @@ -1697,6 +1703,55 @@ deny_join_id0_tests() chk_join_nr "subflow and address allow join id0 2" 1 1 1 } +fullmesh_tests() +{ + # fullmesh 1 + # 2 fullmesh addrs in ns2, added before the connection, + # 1 non-fullmesh addr in ns1, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 4 + ip netns exec $ns2 ./pm_nl_ctl limits 1 4 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow,fullmesh + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow,fullmesh + run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow + chk_join_nr "fullmesh test 2x1" 4 4 4 + chk_add_nr 1 1 + + # fullmesh 2 + # 1 non-fullmesh addr in ns1, added before the connection, + # 1 fullmesh addr in ns2, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 1 3 + ip netns exec $ns2 ./pm_nl_ctl limits 1 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 11 slow # 11 here meams creating 1 fullmesh subflow + chk_join_nr "fullmesh test 1x1" 3 3 3 + chk_add_nr 1 1 + + # fullmesh 3 + # 1 non-fullmesh addr in ns1, added before the connection, + # 2 fullmesh addrs in ns2, added during the connection. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 2 5 + ip netns exec $ns2 ./pm_nl_ctl limits 1 5 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 12 slow # 12 here meams creating 2 fullmesh subflows + chk_join_nr "fullmesh test 1x2" 5 5 5 + chk_add_nr 1 1 + + # fullmesh 4 + # 1 non-fullmesh addr in ns1, added before the connection, + # 2 fullmesh addrs in ns2, added during the connection, + # limit max_subflows to 4. + reset + ip netns exec $ns1 ./pm_nl_ctl limits 2 4 + ip netns exec $ns2 ./pm_nl_ctl limits 1 4 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + run_tests $ns1 $ns2 10.0.1.1 0 0 12 slow + chk_join_nr "fullmesh test 1x2, limited" 4 4 4 + chk_add_nr 1 1 +} + all_tests() { subflows_tests @@ -1712,6 +1767,7 @@ all_tests() syncookies_tests checksum_tests deny_join_id0_tests + fullmesh_tests } usage() @@ -1730,6 +1786,7 @@ usage() echo " -k syncookies_tests" echo " -S checksum_tests" echo " -d deny_join_id0_tests" + echo " -m fullmesh_tests" echo " -c capture pcap files" echo " -C enable data checksum" echo " -h help" @@ -1765,7 +1822,7 @@ if [ $do_all_tests -eq 1 ]; then exit $ret fi -while getopts 'fsltra64bpkdchCS' opt; do +while getopts 'fsltra64bpkdmchCS' opt; do case $opt in f) subflows_tests @@ -1806,6 +1863,9 @@ while getopts 'fsltra64bpkdchCS' opt; do d) deny_join_id0_tests ;; + m) + fullmesh_tests + ;; c) ;; C) From patchwork Thu Jul 29 07:20:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12407893 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65AF072 for ; Thu, 29 Jul 2021 07:21:12 +0000 (UTC) Received: by mail-pl1-f171.google.com with SMTP id a20so5974757plm.0 for ; Thu, 29 Jul 2021 00:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jw+2gozvuH/YXEW0fIc9lgkZeSSAXLELaUD2N30a1oc=; b=EU8RzYmmp//yawBwdyf2cZJiVCgEtBHo93fU5hbovx71bYMNHX8h4/s1nm/8V4seUU lpRfPaBN5TjJz7nr/8pim1tQAAU916y7xNt7ZUs50yw9aTRcRN5bQdezwT3CGOD2zSfs lwFJ5mabdDylsq2TeaTKDfNdYu+avnt3+3HkGf3LMpG7Rxq9uah7OH+3l5Q3S7cSPlvr +TeUBVNGdCiT0Wm/qtClWC+Lg5nz8XreAcvEDrWFQUNHCdegVdxQRMQOtAjfpDH2BeEB WafUEXOVf/R8EsjZtU3z6IylxwlwRN4Lv9AJUJgxmHys3FLkiPqPugJYLMSChWJZ+UbE 9l1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jw+2gozvuH/YXEW0fIc9lgkZeSSAXLELaUD2N30a1oc=; b=G3XPlxGpOAbKj00g4Cz+wxL8QIq4vDnCT685WY6aB3voq9Y1CoX1U1BvXvxPVVYO9e G72o6VAaxc1bmeezdWHjqqM+FB7ykSHJwjbV5CSitF7StIKeF8PxRsR9VCuKPiRcR7et IdQtjiYR7Y5N/Hquu7f0qqsGN7KJjN+N7UxwVQlVWWkmxsuiLzM3zMNemhrQhK7pxiMx DX4bxunPVyNoEpUH7Y+eJQi+rMFPfb6Zq3WxMLPW67lRF8uprZ9oBH+GbkeyiDyuLxrb aqRCF0ntLFCk/sIX1gLV/nzAlzPHPGPoF3hK/4NRXK8R32daTGOH7DlU+8Yf8xEe2MP6 KgHg== X-Gm-Message-State: AOAM531W5urXXVxU9wJkyw8xW5t6SxZiWcnzI6p9CrHm6x5WJ2bob1XC wN0wGLXVtPpPcIlT9N/tV2bu7Zd59mc= X-Google-Smtp-Source: ABdhPJwlxqywh4n7xk+SJqWn8IEM113CAFTofNOosf5nMkGT01m9ZpjxS47VlpoK0tsyjsBDv9osjA== X-Received: by 2002:a17:90b:3704:: with SMTP id mg4mr13092809pjb.201.1627543271970; Thu, 29 Jul 2021 00:21:11 -0700 (PDT) Received: from MiBook.. ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id p17sm2211550pfh.33.2021.07.29.00.21.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 00:21:11 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v7 mptcp-next 6/6] selftests: mptcp: delete uncontinuous removing ids Date: Thu, 29 Jul 2021 15:20:55 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <6acd8786b4c151c4c9f01a0370bd6a12aaae6107.1627543032.git.geliangtang@xiaomi.com> References: <1244ff06f1715f714ccc21bb164c6c082e8a26f5.1627543032.git.geliangtang@xiaomi.com> <349c97cf4d1091f28aa62e8200ebfe4fa0f5f2d5.1627543032.git.geliangtang@xiaomi.com> <6acd8786b4c151c4c9f01a0370bd6a12aaae6107.1627543032.git.geliangtang@xiaomi.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Geliang Tang The removing addresses testcases can only deal with the continuous ids. This patch added the uncontinuous removing ids support. Fixes: f87744ad42446 ("selftests: mptcp: set addr id for removing testcases") Signed-off-by: Geliang Tang --- tools/testing/selftests/net/mptcp/mptcp_join.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index cb5f9a43baa1..dab7fbd6813a 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -344,17 +344,18 @@ do_transfer() let rm_nr_ns1=-addr_nr_ns1 if [ $rm_nr_ns1 -lt 8 ]; then counter=1 + pos=1 dump=(`ip netns exec ${listener_ns} ./pm_nl_ctl dump`) if [ ${#dump[@]} -gt 0 ]; then - id=${dump[1]} sleep 1 while [ $counter -le $rm_nr_ns1 ] do + id=${dump[$pos]} ip netns exec ${listener_ns} ./pm_nl_ctl del $id sleep 1 let counter+=1 - let id+=1 + let pos+=5 done fi elif [ $rm_nr_ns1 -eq 8 ]; then @@ -392,17 +393,18 @@ do_transfer() let rm_nr_ns2=-addr_nr_ns2 if [ $rm_nr_ns2 -lt 8 ]; then counter=1 + pos=1 dump=(`ip netns exec ${connector_ns} ./pm_nl_ctl dump`) if [ ${#dump[@]} -gt 0 ]; then - id=${dump[1]} sleep 1 while [ $counter -le $rm_nr_ns2 ] do + id=${dump[$pos]} ip netns exec ${connector_ns} ./pm_nl_ctl del $id sleep 1 let counter+=1 - let id+=1 + let pos+=5 done fi elif [ $rm_nr_ns2 -eq 8 ]; then