From patchwork Mon Jul 26 11:08:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12399223 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (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 9755F168 for ; Mon, 26 Jul 2021 11:08:33 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id m2-20020a17090a71c2b0290175cf22899cso13722589pjs.2 for ; Mon, 26 Jul 2021 04:08:33 -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=d3wEDrxWhjCX/1ey679B9LH45wBozCdesRw0RARZYT4=; b=E+c1FAO+aTDbmSWad+oECgwTEN5DNAMdQiwjygQU3xnXJrrQPDv7vew/DLaOgTqdzH IDwtWHuWQ+fP4qYJ99C435wCkgDrNPJACY0wnZWx1u2cI5TwShm/gZN9SkB4Tk9zBQ6p 5SwjVCdMFoR2pwQL77OD0S1wrGO/xwJHn94PjEX+w+ZZAxsQkXZIyBa0B8pC54MUG8xM CPGDaRjWyVZKZnKyenh+/sjDCU5Iex/jzp8We4KGgy0QnY5v/6rCdQ7XhpfYe5+dRAbB ceYwaL3t3g+HCj73eSX8la8DsQUhyBfY/yCEcARXIr9Jfh4rV7PCekWqDgeDSzUec/Z0 iVuw== 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=d3wEDrxWhjCX/1ey679B9LH45wBozCdesRw0RARZYT4=; b=TC6QCPe9oL12f+hyoWJYKv+WCXRk5FXaIQOBwxRXIH05M1kYVW5L7l2h0bMu1Kva3z 665uFLeVyrpgZTIvniznsfhQKcGVHp26khy0rTdf0AJmWROrAiZ8FZv46fTjovU/9+d9 ErVQUuG+6bsCmdvdub8LA11TYuGjLRNSoWtzxS/dvcbbLVA7N4fg/NfWDMv0gzrgqJMY gRsneqf8zxqMUOgJcJrTGIjbWlp1reEv4wupuD7HoJhsPopb70xIT5xQCEqdj7c3oaff 1YPpQHRyJIFZOavPV+B5wDRR/57vhICy4CTfWOJOqga6JGFkyi8s4rzATywVfUQ40Vg+ chNg== X-Gm-Message-State: AOAM530i86K/qWoEJzx9AtRBPqA2HVDbZV6oK6/4Y6h+3Z6gChRzP1ro GPNZ768MoexDVgrm7nkoATF83qCwDc3aHw== X-Google-Smtp-Source: ABdhPJw4CT1FzpxWbcmu4lOFGUKN5FpYEkjWKPzmh7TShRO06iTMSVARPa18I42OrM3+wz+KHFnp+A== X-Received: by 2002:a17:90b:4016:: with SMTP id ie22mr13347161pjb.68.1627297713104; Mon, 26 Jul 2021 04:08:33 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id e30sm50282700pga.63.2021.07.26.04.08.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 04:08:32 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v4 mptcp-next 1/5] mptcp: remote addresses fullmesh Date: Mon, 26 Jul 2021 19:08:22 +0800 Message-Id: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.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 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 | 66 +++++++++++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 5 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 ba0e1d71504d..2a09d28d98be 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -158,6 +158,27 @@ static bool lookup_subflow_by_daddr(const struct list_head *list, return false; } +static bool lookup_subflow_by_addrs(const struct list_head *list, + struct mptcp_addr_info *saddr, + struct mptcp_addr_info *daddr) +{ + struct mptcp_subflow_context *subflow; + struct mptcp_addr_info local, remote; + struct sock_common *skc; + + list_for_each_entry(subflow, list, node) { + skc = (struct sock_common *)mptcp_subflow_tcp_sock(subflow); + + local_address(skc, &local); + remote_address(skc, &remote); + if (addresses_equal(&local, saddr, saddr->port) && + addresses_equal(&remote, daddr, daddr->port)) + return true; + } + + return false; +} + static struct mptcp_pm_addr_entry * select_local_address(const struct pm_nl_pernet *pernet, struct mptcp_sock *msk) @@ -410,6 +431,39 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk) } } +static unsigned int fill_remote_addresses_vec(struct mptcp_sock *msk, + struct mptcp_pm_addr_entry *local, + 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); + + if (!(local->flags & MPTCP_PM_ADDR_FLAG_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_subflow_by_addrs(&msk->conn_list, &local->addr, &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,15 +509,17 @@ 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 }; + 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, local, addrs); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local->addr, &remote, - local->flags, local->ifindex); + for (i = 0; i < nr; i++) { + __mptcp_subflow_connect(sk, &local->addr, &addrs[i], + local->flags, local->ifindex); + } spin_lock_bh(&msk->pm.lock); return; } From patchwork Mon Jul 26 11:08:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12399225 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 93032168 for ; Mon, 26 Jul 2021 11:08:35 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id d1so3847253pll.1 for ; Mon, 26 Jul 2021 04:08:35 -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=zxgtDl7wP8IvVyHWQPgzg9R6pBxZ2yfCotnr8Hw1VYU=; b=nV74MpkUspeiznhEa4fKLUAJvDjGLsta0PIXe24z3eOG2UYPdGqE2e79p9owSfDpYL nadTWhrQq7d+yHn653JcWOqDpejrde9dl++OGKAfTdmEOdTVw5aQG29SpM9u1y5lVdnV /yjZGExGv9QO/ELJT1JSfr68QwhDco5lQDP1Eh0MeX/aTKYOpIr/OUC8Vy8SJ71E1g97 XntHmefgMzwvxxtZQfcV0mmkjjNGOIPWSMWSjjMImkIWBdsBxJvNFZc57bo9f85UQcrM tJ3FhNz79JgutOsBAdtLSttuvaVv5sIt8QesWVz40w8kPCiafA1PHoG35xSpueNoVule R94A== 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=zxgtDl7wP8IvVyHWQPgzg9R6pBxZ2yfCotnr8Hw1VYU=; b=OMsIHLcBSX0IpOwVtelV2/q+gLzLE2qHnWVyFq3HPoz9SmoCCCRHCGtq0xarN1NiQU +FWeHghRi/P5bdwn7JReuqpwOy+4fccEOEe17J1ZuVRdnIEb4sGZHY5sO8IGrCYLp80E BbDpDSG2wuqU/GTjIKOvELaqvkR1cDtI582KOGep5Z5oXDb8qFmB5C/QuHjNb/24vTkS //kFsHOlfe8FF4cfEIgv74W5bBf2/ePFSrEDB4yWfMZPza//d6mvYkaX/vMe3QkHD0xA BAMcGwMsi7cr6yjF0hGZUDAqPvjNy/YmwXFO6paTYbx562ORlfsRmfARdCDjMUwV1SVe 5ptg== X-Gm-Message-State: AOAM5337axSP8C+ZdYvmxfCfPb/Q1LgfNQkce2tyqSWjhwEAjz1n+ySP qHHFW/zbw9ARR9qrQ1v2PM1WXcfZwLf9ow== X-Google-Smtp-Source: ABdhPJxpJeHI/qU/TabLcKeYm8s3cEZd3zQ9lpQIbANttd6zyS/l83sv99sc+QFeFEwC57hk3jXUwg== X-Received: by 2002:a17:90a:be16:: with SMTP id a22mr492613pjs.169.1627297715163; Mon, 26 Jul 2021 04:08:35 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id e30sm50282700pga.63.2021.07.26.04.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 04:08:34 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v4 mptcp-next 2/5] mptcp: local addresses fullmesh Date: Mon, 26 Jul 2021 19:08:23 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.git.geliangtang@xiaomi.com> References: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.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 | 59 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 2a09d28d98be..10f09a96952b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -540,13 +540,61 @@ static void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk) mptcp_pm_create_subflow_or_signal_addr(msk); } +static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + struct mptcp_addr_info *remote, + struct mptcp_pm_addr_entry *entries) +{ + struct mptcp_pm_addr_entry local, *entry; + struct sock *sk = (struct sock *)msk; + 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 (!lookup_subflow_by_addrs(&msk->conn_list, &entry->addr, remote) && + msk->pm.subflows < subflows_max) { + msk->pm.subflows++; + entries[i++] = *entry; + } + } + rcu_read_unlock(); + + if (!i) { + memset(&local, 0, sizeof(local)); + local.addr.family = remote->family; + + entries[i++] = local; + } + + return i; +} + static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) { + struct mptcp_pm_addr_entry entries[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); @@ -570,11 +618,12 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) 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, &remote, entries); spin_unlock_bh(&msk->pm.lock); - __mptcp_subflow_connect(sk, &local, &remote, 0, 0); + for (i = 0; i < nr; i++) { + __mptcp_subflow_connect(sk, &entries[i].addr, &remote, + entries[i].flags, entries[i].ifindex); + } spin_lock_bh(&msk->pm.lock); add_addr_echo: From patchwork Mon Jul 26 11:08:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12399227 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (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 71339168 for ; Mon, 26 Jul 2021 11:08:37 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id mz5-20020a17090b3785b0290176ecf64922so3332873pjb.3 for ; Mon, 26 Jul 2021 04:08:37 -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=nCNeO4iGv6LMRU/+PV4LkofE5p5hmVMb5lF4JO4QpKsRwL06ZG5LDZ2KEvli6V5TBG 0Se66O3oovvnrZSf8xai0HOHEPMd03UrphOKw4ubS5H8ipT6btUOQoK2hbph6Knq1E/k 4EaGcGf58m3klUhxKCjBpFHx0WpK4fK1Hwofx99v81V54KTN34YhtpiobUlwN5Kj9PuM Swx5nZP4bA6xIL4tCtv/BCVLbgGo2eFYqfUJM9mY4v0JLQKiFMD98AEZcQbz0PoRIFOH 11Sc0ZeI7r8SQQJbD5lhpf/WMftLKDzoLpMTQYa8sa15LlcJqPzbPwppm/ON8AB/g7aY DRrQ== 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=ovNzh/bDquV/MYYLVxcXhjsVstqxyI+ipnH1I9LnmeQxBh7lr1ld2e9k3L6DbCg0Vs 6f/Is3NvfijP1xmbb25+pmZjmbFAuDr36ILtVqcmN1uMOWn9bYtzdwiKPnamrU0pBDzk UnGfNMizpxzYcITgt2OHJY4Nrzi6opyvgva3yTQxxgqOlC4VMdsim6POrCKpPaxJ0auN 2Dfvytwq/BYAtw2UNnRtf0tYBRPtkQz44ES3EVtuVZOgWH/qSSnzEhs6BwHVRYN6wNe1 7hnap0o9/1fBNy7IeVM1pui8NwmR6s+dJvGoPcxCf7XfJWAOsSq9KoidsZVDnLknGcAG Sbhg== X-Gm-Message-State: AOAM532wTOXgypEsdn3zsa1DgVde82hb4sJx/nFitYxq2D4fWYvMzzxX VcwMgTjnF7tm08ljmziSyviPQ55sQMFvlw== X-Google-Smtp-Source: ABdhPJznGqpO85R0CAa6lGjgfp5WaaBbEERBSv6/VT6wsSn/urXx9bEYI+Zl+7aZEtBsGT25PKLG9A== X-Received: by 2002:a17:90b:1e10:: with SMTP id pg16mr16930016pjb.87.1627297716987; Mon, 26 Jul 2021 04:08:36 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id e30sm50282700pga.63.2021.07.26.04.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 04:08:36 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v4 mptcp-next 3/5] selftests: mptcp: set and print the fullmesh flag Date: Mon, 26 Jul 2021 19:08:24 +0800 Message-Id: <0c40709e5ccf24e810c5a5b073a47baa0946f41a.1627297096.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.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 Mon Jul 26 11:08:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12399229 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (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 220D2168 for ; Mon, 26 Jul 2021 11:08:39 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id g23-20020a17090a5797b02901765d605e14so13649593pji.5 for ; Mon, 26 Jul 2021 04:08:39 -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=4f3YsuJzilEkaiGWtUdRU8k7oqKGzamLrxruOFlxUaQ=; b=o6oi0N9nRrdZVsjttFZ4g7D7irdAkBFL1oEo98rUUYFpeMxBhD57L3+8aNLjEvWFll fe2xVUE0juA6qP2mEMm5FbJTo0UwseC8hJfrD0Rn+MznJpGoeLukFLwGNyy7OgUH2yS8 LCz6lJsghAsahCnI+JvVoIfeMI6npNH2xy6a7XwPNogbrrgD1fOcaaVJXa32O4aACOLt 9Cf1M6btZZJ3cxdnhXu8iRq8ZUh3RdgB0/zhOCCWnIX0ZvWxgI2S0/1QQZkwLpsHeAgh S3xbq6LfQSw4qEOm3oRc9xoc+KVX46eo2QI5rLH4eqjQaIU1vAUH/v2+lnUhC42vTh08 cpLA== 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=4f3YsuJzilEkaiGWtUdRU8k7oqKGzamLrxruOFlxUaQ=; b=j+JDehBmGZJymeg9Dii+SeTK0aszxJESMgs/+/39wys5Ryb8VVPeaR7C4gIcN9jXvg 2H2E5ruE0Nx/Oc6kpl+m4gfqnhHuxDiVTUUXIm2EnkTZA86oGyY3jyj6pc3uiZtt9aJg 7+srwqC2o3ZS8tSmclTajo0cbxQTYyWgl5xBkezISrEnd5iJmLMfG7oASc+ivQJINHKp VayunMHWp2KCWS6gD8g1Ia2Ag7LvEvZl+5G0fmzKfHUqSCpImFo7uKJzd39nNy+88Os0 UFlzw9kRHmPW6NkAaT7CWsVaoO26W7lPk60gO/9u/IW8ZolByRV5lZpuVnNPcwZokPt8 M5zw== X-Gm-Message-State: AOAM532L93wZzEUpFtYjjp2p2ktk54Mpl1Hd5/cx6wuKP7JX1HqbcJ/B 4/RXgzINhhqXwqOl2ea6gi5RX61ZjtA8pg== X-Google-Smtp-Source: ABdhPJymLXaZRLZUluAYQEpFucJIb9iVFVtz/Xs3WvOGUpNkMVu2cIGUMYYuk73J4VeZE4JH1xyyqQ== X-Received: by 2002:aa7:8591:0:b029:326:3e03:d7d8 with SMTP id w17-20020aa785910000b02903263e03d7d8mr17512773pfn.11.1627297718641; Mon, 26 Jul 2021 04:08:38 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id e30sm50282700pga.63.2021.07.26.04.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 04:08:38 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v4 mptcp-next 4/5] selftests: mptcp: add fullmesh testcases Date: Mon, 26 Jul 2021 19:08:25 +0800 Message-Id: <17cd11f1f902cd545ade9930d03ab0d82e0272df.1627297096.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <0c40709e5ccf24e810c5a5b073a47baa0946f41a.1627297096.git.geliangtang@xiaomi.com> References: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.git.geliangtang@xiaomi.com> <0c40709e5ccf24e810c5a5b073a47baa0946f41a.1627297096.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. Signed-off-by: Geliang Tang --- .../testing/selftests/net/mptcp/mptcp_join.sh | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh index 937e861e9490..9ceb6052b513 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -325,7 +325,13 @@ do_transfer() cpid=$! if [ $addr_nr_ns1 -gt 0 ]; then - let add_nr_ns1=addr_nr_ns1 + if [ $addr_nr_ns1 -gt 10 ]; then + let add_nr_ns1=addr_nr_ns1-10 + flags=signal,fullmesh + else + let add_nr_ns1=addr_nr_ns1 + flags=signal + fi counter=2 sleep 1 while [ $add_nr_ns1 -gt 0 ]; do @@ -335,7 +341,7 @@ do_transfer() else addr="10.0.$counter.1" fi - ip netns exec $ns1 ./pm_nl_ctl add $addr flags signal + ip netns exec $ns1 ./pm_nl_ctl add $addr flags $flags let counter+=1 let add_nr_ns1-=1 done @@ -367,7 +373,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 +389,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 +1709,28 @@ deny_join_id0_tests() chk_join_nr "subflow and address allow join id0 2" 1 1 1 } +fullmesh_tests() +{ + # fullmesh 1 + reset + ip netns exec $ns1 ./pm_nl_ctl limits 8 8 + ip netns exec $ns2 ./pm_nl_ctl limits 8 8 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow,fullmesh + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "signal address fullmesh 1" 2 2 2 + chk_add_nr 1 1 + + # fullmesh 2 + reset + ip netns exec $ns1 ./pm_nl_ctl limits 8 8 + ip netns exec $ns2 ./pm_nl_ctl limits 8 8 + 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 + chk_join_nr "signal address fullmesh 2" 3 3 3 + chk_add_nr 1 1 +} + all_tests() { subflows_tests @@ -1712,6 +1746,7 @@ all_tests() syncookies_tests checksum_tests deny_join_id0_tests + fullmesh_tests } usage() @@ -1730,6 +1765,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 +1801,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 +1842,9 @@ while getopts 'fsltra64bpkdchCS' opt; do d) deny_join_id0_tests ;; + m) + fullmesh_tests + ;; c) ;; C) From patchwork Mon Jul 26 11:08:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12399231 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) (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 A826E168 for ; Mon, 26 Jul 2021 11:08:40 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id gv20-20020a17090b11d4b0290173b9578f1cso12858972pjb.0 for ; Mon, 26 Jul 2021 04:08:40 -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=Gw9TtGaavMhYghAEHTUfhMxXXW6bMzhQTqXjCvAMm8k=; b=Z4HVvsbED2ypBrh68vg3XmxDGe3NQDZbTQMpIjOVMn/MIbr6Jkrz4O/996O+Bpv5+Y TUWLLBeQN0o/FpjNeIDjk2ruZF8zwJiDnHsCkADXNW2zaDElYPb8OtzhgZXCzbCjj38T Ke1JaJ1L6oX25v3cGd2YIZBKpovoYJU4pAiKXVBHpFAW6ProHgFWXSAx8XtRsdvcDICa v6h1IxJmuCzNQ5edibjOdi28WwmnqNCWH6aOvR/GnuXKGbHzQ2ukPaZmgiqum8MbVaHY TObueGIEQ0t0Wh1eAccuP2ePP7+O7pftzt71quVozPEHg4Ons5cSDx31Ssqj3w7lgYDV cBhQ== 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=Gw9TtGaavMhYghAEHTUfhMxXXW6bMzhQTqXjCvAMm8k=; b=dCh426VueLda/9gRa9nZZCgCoxjE5i/nv9oBhov4cv8otoa4/5SD2wXyXh5Arqmq45 bMt2OzbxV2dmnZlX6z2N/H9tll6cKCXNUvBj3SpGj6u4NMNqMqjOm0QSx75WKPchwuaT FRYLhqlt7hLWNCcCS/zxhJLRZmMdFFh+/dvA+SIxQjWs6TG8wTNa2k1B4pC8eDwLfEdv I+e0Ly8qmnZqSY4tpG3IKzYBTwphU4VmPVt4DyF2ST58nPE2ZZja1YciQ4I63R/Bb7eN 4Y0E9KdALFYZ6YVDiY9pvfBd532maB6nHs6ACaFjdre3LA6563V/bqa0h0ExqEmfsg/+ k0OQ== X-Gm-Message-State: AOAM533lrJnLlxilk7i0dCejxmBBMSss/jIDohIxCFRr4AVdbWiP1/EO 86WGpy9OiFyvWo4dO+Ca8PrPInSRKseWSw== X-Google-Smtp-Source: ABdhPJxfoncqtNAE4iC4whzsFy+sMAglAWXtzjY2b0SkIlvkWbctKxlVEbDDAZ6LjAQkNdkwsmLdNw== X-Received: by 2002:aa7:95a1:0:b029:359:ca4e:d25d with SMTP id a1-20020aa795a10000b0290359ca4ed25dmr17653593pfk.51.1627297720238; Mon, 26 Jul 2021 04:08:40 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id e30sm50282700pga.63.2021.07.26.04.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 04:08:40 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v4 mptcp-next 5/5] selftests: mptcp: delete uncontinuous removing ids Date: Mon, 26 Jul 2021 19:08:26 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <17cd11f1f902cd545ade9930d03ab0d82e0272df.1627297096.git.geliangtang@xiaomi.com> References: <457db25d2c745babb98b8f29c6d2ace3d6348ff5.1627297096.git.geliangtang@xiaomi.com> <0c40709e5ccf24e810c5a5b073a47baa0946f41a.1627297096.git.geliangtang@xiaomi.com> <17cd11f1f902cd545ade9930d03ab0d82e0272df.1627297096.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 9ceb6052b513..5c2fb282bf14 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -350,17 +350,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 @@ -398,17 +399,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