From patchwork Tue Jul 27 13:24:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402725 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 0209A72 for ; Tue, 27 Jul 2021 13:24:40 +0000 (UTC) Received: by mail-pl1-f173.google.com with SMTP id n10so15870081plf.4 for ; Tue, 27 Jul 2021 06:24: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=C32BesRzz9C4TW2aZwb5AbZ8hMQmCb8SDVOyxafOx40=; b=GhP7XfeuoS0QdT4Ou3B2byhU/S5Z/cDfkDFN8hMCXzy4/YCtNyJD07uMnUcWR8i9Dx xsE0WgqK8lfc+6tJ/ApYI/5NaeWUf45EE7XOH2+xnRp0Zfd6abqrB7r8c168ZrlUFcs6 yHP0aj+UKix1r8F9H14qRXsnnKLONkHu4C2hVsze3yzlrmyDWzFhu3uXY5zdWjvga8IF 3YUCEBtyVuaQALisS1zM3Kp6Ermm32bR1KuoCucmCgfb7wDmeyEqi6wPA3tohIaHvWNK tQQtmjqIDs8LS6OjIiWBkOYWCiYqUqBgPj/hNWHuFF7X5ZMOkyLkUIsLktuc2HMBiRFE bfrg== 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=C32BesRzz9C4TW2aZwb5AbZ8hMQmCb8SDVOyxafOx40=; b=V1Wqy8ACmvQYJs3u2rrgeSiM1BQWz4i5Pq9ZQLYcYqrj0SYxX6ury+YIZ6nMk1lUzW bJLFcuE6YTDz0uL6/gbavM3cP56jOxTjWt3arPvcubFSnAnOkwe+nCw36Rlc1IjwkH+C PYUc6X6STni+HNf0+2tSIBYF+Ni4AiRKFdad0yJyhBFCvthE4vEszm0keQnULfspGtnc pu30I7/HYprIG0Wi4wlt70qMBdlJo6T5StMt7HwSxnuFIP1EwbMobqyrBtCwN+h5b6uE +UQqaEvvBORJ51J76LlMi+vJok3jflMzIUcfc66e3F46vtDrHt4/UgExhVTVkR3fzsAb RKOw== X-Gm-Message-State: AOAM530fJeQ27LPtHvjDUAQ2z569JhaXCsRhyMdr5zQe/YlBM5PfYCxu DWml0FSWsj11hp3opk5ZYvg9ev29xDQ= X-Google-Smtp-Source: ABdhPJwjJ7IGI/qmyxfeOZpZs5gtKsWguJ+YDuKfJb0gDIkvOzYf4GAsjqTybkf5zEz3XShx/jcDdg== X-Received: by 2002:a17:903:1d0:b029:12b:7d00:7179 with SMTP id e16-20020a17090301d0b029012b7d007179mr18769854plh.4.1627392280456; Tue, 27 Jul 2021 06:24:40 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id j13sm3511066pjl.1.2021.07.27.06.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 06:24:40 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v6 mptcp-next 1/5] mptcp: remote addresses fullmesh Date: Tue, 27 Jul 2021 21:24:29 +0800 Message-Id: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.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 | 64 +++++++++++++++++++++++++++++++++++--- 2 files changed, 60 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..ecf43d45711a 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -410,6 +410,56 @@ 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, fill in the 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,15 +505,19 @@ 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->flags & MPTCP_PM_ADDR_FLAG_FULLMESH, + 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 Tue Jul 27 13:24:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402727 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (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 F301372 for ; Tue, 27 Jul 2021 13:24:42 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id pf12-20020a17090b1d8cb0290175c085e7a5so4302657pjb.0 for ; Tue, 27 Jul 2021 06:24:42 -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=+LthFdDtSRIje737QCuFexJkWpiRWrLNduLEWprPiZ4=; b=IDm0AuwYHFVSt5APWUga3Y8uAiMwz0AABBS8ZJz8VXF9mFyxzfmmt5qHJPsbocM1k6 944VEhV3uawCsrLu07nlOdnbqEZkkxLLiV8YPJQYV5p56ZejLDhB4jhGugt74SdMvEDX LTaCLgt2OznEtubwT+Rhtg7XaqXH8e8yRx79HgMOMouCCBgP/WKsx0JqYN2eFZFPnbsZ DAIoT4Xn5IzEthx3pGIGN/l2KA9+kfZrK27DTc2otlBjrcwBgdFrVpn7976WeGLtamN7 1jcxe6zFncG/zespTbjf/vlM+mefo6fGJ0NCWiQYCkniAEJQf7rOGMs8QY1PMWEsWDCZ 9yXA== 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=+LthFdDtSRIje737QCuFexJkWpiRWrLNduLEWprPiZ4=; b=RRFrqs5v8x3eMNEhzBSm6KVXROP3ax8cRD8TLv7/1KsbzcMW5dQ3PX8ko5emkHtELN eB60cm5UXZsb/PKNsI5ni1V7t9gkQjf7hXyRWoefExlLkpUCg6Zu31tHGiMsve3fNIsk 6WwPjtF58rkun1kZN1S1BdRROGTmspwWNUZWYrVTqTPbnf3zQJl9/QRRTdI2ofLpWCXL /e/UgSeD89b/sni4GDNdsWJCSyc9gHcY4zvyN3uXAX2G8/N67/wApbLtB3nvuNjeT3a9 Iawc/piazBXGH+O1JaftmYcUVnIDfjbeMfVAw52+2tW0drbQm/Jl08hPJHIk7jVdVYSn VoDA== X-Gm-Message-State: AOAM533CMTEjrc1FE56WmJCbpSzh9T1ptdhtxMG3nHxGF8dDfyx8mQDL +yFPDVC71w++cjs1jKmTTmmhg77TSxk= X-Google-Smtp-Source: ABdhPJwlPsNjegXtYfcPT05J0J3lc4lNWgXXvQe2ww6UZsNUoz3PWMJ6sd6t3QF4KUDh/9WmClc+8g== X-Received: by 2002:a17:902:fe97:b029:12b:e3f2:f5d5 with SMTP id x23-20020a170902fe97b029012be3f2f5d5mr15255203plm.74.1627392282466; Tue, 27 Jul 2021 06:24:42 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id j13sm3511066pjl.1.2021.07.27.06.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 06:24:42 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v6 mptcp-next 2/5] mptcp: local addresses fullmesh Date: Tue, 27 Jul 2021 21:24:30 +0800 Message-Id: <87310b54d3987e94138953e171bad7b081b63df5.1627391588.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.git.geliangtang@xiaomi.com> References: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.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 | 81 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 71 insertions(+), 10 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index ecf43d45711a..b2d2256f2abd 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -538,13 +538,76 @@ 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 three arrays, + * addr[], flags[] and ifindex[], + * and return the arrays size. + */ +static unsigned int fill_local_addresses_vec(struct mptcp_sock *msk, + struct mptcp_addr_info *addr, + u8 *flags, int *ifindex) +{ + 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++; + addr[i] = entry->addr; + flags[i] = entry->flags; + ifindex[i] = entry->ifindex; + i++; + } + } + rcu_read_unlock(); + + /* if the array is empty, fill in the local address */ + if (!i) { + memset(&local, 0, sizeof(local)); + local.family = msk->pm.remote.family; + + msk->pm.subflows++; + addr[i] = local; + flags[i] = 0; + ifindex[i] = 0; + i++; + } + + return i; +} + static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) { + struct mptcp_addr_info addr[MPTCP_PM_ADDR_MAX]; struct sock *sk = (struct sock *)msk; unsigned int add_addr_accept_max; + int ifindex[MPTCP_PM_ADDR_MAX]; struct mptcp_addr_info remote; - struct mptcp_addr_info local; + u8 flags[MPTCP_PM_ADDR_MAX]; 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); @@ -556,23 +619,21 @@ 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, addr, flags, ifindex); + 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, 0, 0); + for (i = 0; i < nr; i++) + __mptcp_subflow_connect(sk, &addr[i], &remote, flags[i], ifindex[i]); spin_lock_bh(&msk->pm.lock); add_addr_echo: From patchwork Tue Jul 27 13:24:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402729 X-Patchwork-Delegate: matthieu.baerts@tessares.net 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 AACCB72 for ; Tue, 27 Jul 2021 13:24:44 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id q17-20020a17090a2e11b02901757deaf2c8so4877542pjd.0 for ; Tue, 27 Jul 2021 06:24:44 -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=RiOWrU0eT0ymaSVMfbMrSGt9eeQcgp7Yl649AAsgigV5/E0+xRVrSDUhNvJmjdxS3+ /ulBB5+h4oaGSuAO9FWvkol64maswFla50lJlpnWo18zY85Us/4J9wRJe7/uNz2wxLlc phUHeAslO8xIHLNLP9rQ6DLFqljb/0hCxsccxlHpj5grr5OQTuH8JGfxTItUe+e46P5F XEY9YuyCzr/TE/SzR6WY49Mnb9Hf6AmyYIvGShtgEbNCBApRNkf2kxl5TYKBzm0NtrfA pcB2+l48y0QylnLkIICjJ6ijGIJkk9aeDVG+l8R0N2mVd6pQow6tYoHc9Y+sMV0gh+vk 3Tzw== 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=pcgPdOIMV6wTTB50kDHJYJ3/KOoIPYpGqrJD1w6zbW1MsrfW9UIHlpAxygl8rH3RIE Oc1Q8CfwdGd/R7efpw9Gci4S2T/Fh1s9XGJ1v0YIWOO9//E9fMw8pd8OTjdm9tSl2qe/ /oOq9jW6Y9cX2TupMfc2wb4eI1uFEnYYFAGNAIh+BlkW1R6OeWvqOvOcl8hP1xOxMehi NKTX0ck3u3EA0QJZ5u4AZetx+znpVCHFOdHYejmoptUJ3fqmOTWw0is2W9ALf661Nv9J W1wxyplo6yUhprYPMGPpInW/Y4ayJvRXjyQ8QILJSlD/SWUugw6meZU52+Y2ti0Rt93T QGEA== X-Gm-Message-State: AOAM530gKWkEbMLzMd27dQF5a7l13bjzeHAcIosIS2NshU7TjHGK2M6q rB2LxVIzo6tZWSN4sS8Fns5l74QeSBI= X-Google-Smtp-Source: ABdhPJyC2RRz+DGAAkoQGfBDloseJW31OWgCo9rM4c3iH3qQqS6zuLPtc1087dDPCtuBEz2BRg7Saw== X-Received: by 2002:a17:90b:1d0b:: with SMTP id on11mr22471049pjb.94.1627392284194; Tue, 27 Jul 2021 06:24:44 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id j13sm3511066pjl.1.2021.07.27.06.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 06:24:43 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v6 mptcp-next 3/5] selftests: mptcp: set and print the fullmesh flag Date: Tue, 27 Jul 2021 21:24:31 +0800 Message-Id: <10a327d0ce8f917d17166ae7de561a8b2af23ff3.1627391588.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <87310b54d3987e94138953e171bad7b081b63df5.1627391588.git.geliangtang@xiaomi.com> References: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.git.geliangtang@xiaomi.com> <87310b54d3987e94138953e171bad7b081b63df5.1627391588.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 Tue Jul 27 13:24:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402731 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 8A21572 for ; Tue, 27 Jul 2021 13:24:46 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id ds11-20020a17090b08cbb0290172f971883bso4260940pjb.1 for ; Tue, 27 Jul 2021 06:24:46 -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=SUaPm+vRvGPbiXQeo9s3ttcGUumCGJy/2CRiSr3WGEE=; b=QNYtXoy9S7XxXTlgb1I3UDpO4FjWk2A0ypM0h1KyJuS3A2PFFBoEg4IDhvwAJqVGYC dJaQiA6tELnnI098lqOj6xUEe5BPXZ28Umnb06L3zfbEb2YPdNGf0Ae9U0Ly1Xz1mV7I 4X722fwi0x/378Zdfc9qjpLErFBhnVWCcqJzf5KQuXPNw2GuAHEYnERd8sjYK9fA3Ywn 26FuSjVpxaUoZbSkX+rafiGmpcFvr9Xp/XZYlZO8w1QxHwGec0I7PlGggGDjTz9wUGPK rgpM1Wp590ur5N8JhnLjS2vlqsoLi9ExLSidsS7TyZq1zhpNepzimsKRSnt3yoP0xyoZ 7asw== 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=SUaPm+vRvGPbiXQeo9s3ttcGUumCGJy/2CRiSr3WGEE=; b=CUjZcc3JITWaIiQxr3E1VV0mthGNs+DtVLsu2FWxeJOJkIEu1YDHBDsNX1WYWfM/MB RgIDv7WdGXFO9SxoGzQSeJ+3RAdUF908KpzoaBsznLeuhrF4q9DwQJslBBI1AwZAwUoK iXIeRr0GXyuCGRH9H2ZEmPgN5rxIBSYzITguAY5bBP7UtT258ByldgGkHYfizGpmZtu1 qBiPTimPYC0KNq06PL1oUDyOMkbl+q6zV1AgrDscATYNnLXPF+iew05hoWHfMrnRQE60 /yjMKOyutnbZabXBbr+twH6SFXJ2PCvvMekaVGvaTTU7OLJ8I+8/TnYco/tJzBufwUg+ RUEg== X-Gm-Message-State: AOAM5320N4fZtg5Y22nb/AqfAGgFIY9gqLZ5pAwzoXit/vuxPQDnRhaM QjvA/mF788AMjfFrGI+B7r7JrU5Dfao= X-Google-Smtp-Source: ABdhPJy14UiosTQeOg88jP01sJpAjeS+zMsX9F3R98WCPNDJps0oOSqlBoxMw+CjYLnHzHqL7Tm2Ww== X-Received: by 2002:a63:686:: with SMTP id 128mr11159238pgg.55.1627392286059; Tue, 27 Jul 2021 06:24:46 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id j13sm3511066pjl.1.2021.07.27.06.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 06:24:45 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v6 mptcp-next 4/5] selftests: mptcp: add fullmesh testcases Date: Tue, 27 Jul 2021 21:24:32 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: <10a327d0ce8f917d17166ae7de561a8b2af23ff3.1627391588.git.geliangtang@xiaomi.com> References: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.git.geliangtang@xiaomi.com> <87310b54d3987e94138953e171bad7b081b63df5.1627391588.git.geliangtang@xiaomi.com> <10a327d0ce8f917d17166ae7de561a8b2af23ff3.1627391588.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 | 57 ++++++++++++++++++- 1 file changed, 54 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..2a27d6240f5b 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,46 @@ 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 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 1" 4 4 4 + chk_add_nr 1 1 + + # fullmesh 2 + 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 + chk_join_nr "fullmesh test 2" 3 3 3 + chk_add_nr 1 1 + + # fullmesh 3 + 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 + chk_join_nr "fullmesh test 3" 5 5 5 + chk_add_nr 1 1 + + # fullmesh 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 4" 4 4 4 + chk_add_nr 1 1 +} + all_tests() { subflows_tests @@ -1712,6 +1758,7 @@ all_tests() syncookies_tests checksum_tests deny_join_id0_tests + fullmesh_tests } usage() @@ -1730,6 +1777,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 +1813,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 +1854,9 @@ while getopts 'fsltra64bpkdchCS' opt; do d) deny_join_id0_tests ;; + m) + fullmesh_tests + ;; c) ;; C) From patchwork Tue Jul 27 13:24:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402733 X-Patchwork-Delegate: matthieu.baerts@tessares.net Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (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 37D5272 for ; Tue, 27 Jul 2021 13:24:48 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id u9-20020a17090a1f09b029017554809f35so4201619pja.5 for ; Tue, 27 Jul 2021 06:24:48 -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=5m2t9tl43KMdgOI4zJQaYmtUqZeGCANdqPtLWVhppcw=; b=ouRWHayKAN7lbKqZCHUgeNunHzLMAA8jOCGTEUKQhmiE4zQwz3bRLDmipRFUlAYUbr 9SLwyjMJDQfz0X2JymUQP7gmWRk0C2iVmYOfmre4GY0/6Vhczx6iUouKX+awFdYduarU fg6AgoXi4HDvUCZo08buwMYHUFKrAAh4ffnwcWIx46n0c4hxVbW6ZNkV+KkccFi7uzhg 4dVzkCUIqxOzxPb0WJlYBIr8F5h1FKmEA0MMFcDjJgPYrox2EDmBaK+3PnyuJjzLV5Iu sonRBZOJVBPsEqo5gUYNRSASDDH/pySP5t8XJH7NTWszs+5Nw4Bx6QEqoEAESMFP2ETR EUoQ== 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=5m2t9tl43KMdgOI4zJQaYmtUqZeGCANdqPtLWVhppcw=; b=ThuNQ/SwdPbaNyWDE08xYv8rnyPrdoDwP1tF/x0FoFzXs6lhlbIUgpwOakh13noX3c 1vGMrkkX/yJXi1p9xilAWZXJq4WJFSr+Tj3z2D+IxroWxaT/IJRu1sMMOnQdVw0Ba/nl ImCcU2lgoIS7qFVPAFZmEO5Yd2lsMM5BtPYmmrJYDgwIufS/+T5hGL7NgOygOs1Vv2Ow /LbmLtXFkBCuySi6hGmZoNAX53ddW++45BsFSazarcndxq3Va5tQRWfEuyrSnhC5nIgH x44wmnKSoBm2UjYYe4DS7quRiqQcoFgP7DEWpZKOHO4BF5XdVD/SJfEwwSbmG0zCBPEn VdpQ== X-Gm-Message-State: AOAM531RtKzUN8r0ezt5GqjYdMS4gF3CSuAlpGneIeorO+ibaeet/cwX dmP2kNWBf1q8E0IBKdNBEZrdrVUJSvw= X-Google-Smtp-Source: ABdhPJzqvDd9DQn/OUGSHXbO2olyZzlYp6SYv50DeuoRM6fNfGS9pY/PTjzYQsbIuQ+NPu8izU85Zw== X-Received: by 2002:aa7:8e18:0:b029:2ec:a754:570e with SMTP id c24-20020aa78e180000b02902eca754570emr22937740pfr.38.1627392287767; Tue, 27 Jul 2021 06:24:47 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id j13sm3511066pjl.1.2021.07.27.06.24.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 06:24:47 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v6 mptcp-next 5/5] selftests: mptcp: delete uncontinuous removing ids Date: Tue, 27 Jul 2021 21:24:33 +0800 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: <703a40cb47f2f4c0ddb25bb61f97cfb4b973dc5e.1627391588.git.geliangtang@xiaomi.com> <87310b54d3987e94138953e171bad7b081b63df5.1627391588.git.geliangtang@xiaomi.com> <10a327d0ce8f917d17166ae7de561a8b2af23ff3.1627391588.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 2a27d6240f5b..a5141f933f3c 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