From patchwork Tue Jul 27 07:58:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402069 X-Patchwork-Delegate: mat@martineau.name 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 034E072 for ; Tue, 27 Jul 2021 07:58:30 +0000 (UTC) Received: by mail-pl1-f175.google.com with SMTP id t21so14717762plr.13 for ; Tue, 27 Jul 2021 00:58:30 -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=6FUY8ElhrCLL2b33BQwcGX7MNDnAw4hdyPuQgL1INlM=; b=ASUa9wPmrKVcamQFx3T+mZewNQecwDbS4oqp8G5oVD+lcHu2Qo1YJQr3AADRq6SKKs voEJL/i7t/znpEmh6NGgQ7wTOBF9S5Mi7bbp94tFkwb5zPzdErxXWFlWnZWcYutBjIJA MYuDI6dj+ApcpEqNyoYj61PmNxB2S0dzyk+CKTLadQeiyIIrZeSlBMtUwFPyrEkJXu12 thzjs/qqPDVZjNBYTc2V8l12XEIyr18c/5NndchkN/ge13WPA4yjr2bgzCu99+SLcW+W eQzqtbj/mvTw+jXEWAEvVHgcq9ROA6Xqcozd0GiZTvd55W1utUujTwPW0bprDsOBhslS 9j3A== 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=6FUY8ElhrCLL2b33BQwcGX7MNDnAw4hdyPuQgL1INlM=; b=DJchTXnDcknlcEllwl/DXCQ478UBVDdok3RSNqFQezhXIWh92sbAabp5+/YJukJmvp uHNvaBqR/7Y+ceT523ru7tcgLGjD1eEUA5uFf9oOrhG2dfGV1xvdFWbyKI8wwW4uZ+57 auVPiuZjix9UhcqvK9tcdS+Tk7/TrPRAfEH8uxM8JX5X+L/LARKNcZx06YTphpuqLMGl HZRu0RRjWW2lmCEeOXw1tO5AmHTVjSIedFT2ryGJ3F/PcIRiySWiIF+H6631Vu8XchAT W67/RMtKzgGXJ/kIz/kdf/28b9Oe3kLmeiFUsej25vQ6A+wFLmY75jYkCDEG9QSevFbw 2NCw== X-Gm-Message-State: AOAM530h5HjqRpP6UM9wWbwMkDSjMRqRyfyXrEls21RDL2lXjjvl7ShA rKYcFkkpQkf9O/ozq8WWfALqegS1dVc= X-Google-Smtp-Source: ABdhPJycK6USpTfK5Loi7Su79OOWvwWllft3TivctT3U4GNiHSKKMSgn00edRUBjSRhdw9GFAEdkVw== X-Received: by 2002:a65:4386:: with SMTP id m6mr21900529pgp.430.1627372710452; Tue, 27 Jul 2021 00:58:30 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id v9sm2544537pfn.22.2021.07.27.00.58.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:58:30 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v5 mptcp-next 1/5] mptcp: remote addresses fullmesh Date: Tue, 27 Jul 2021 15:58:18 +0800 Message-Id: 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 | 80 +++++++++++++++++++++++++++++++++++--- 2 files changed, 76 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..2259c424485f 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,53 @@ 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; +} + +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) && + !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 +523,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 Tue Jul 27 07:58:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402071 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 EB8CE72 for ; Tue, 27 Jul 2021 07:58:32 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id b1-20020a17090a8001b029017700de3903so2313617pjn.1 for ; Tue, 27 Jul 2021 00:58:32 -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=9AGeSZTpZr2k0X+vSH9R2x5Vbr1BVrgIBNacgm/ZT6M=; b=iytmLxS1pEOCQKpXzC/kxC242C0KaYxoFm0hl2A0lPYb1/vpz+6PqVqKkFqdWgNpX2 w+UiJ8bq/+fKbmuNa/SHC4pm72A3I8wAF/1CfQw5piD3b3klJOTkUF13/HCPsn4LdX4z 33jZxBLiK2Zp83V5+Yn15kglNVu0nLSLeQCtNDJ7galj1HSWpPklgciOqUC8VuTpNXMg ErsCLDEePUn4Tvz5NeO+hrU3uT6mkSok71ydigF+3Ze9PRm1iQvhN0A9M2L8tcpJwqQY R4rCIVX7RJQXFoao0D//xd/LhAcCfxgQuWkujV/dUT4hlLYvE6R5jpmMhpokGvMBmT7A MU0g== 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=9AGeSZTpZr2k0X+vSH9R2x5Vbr1BVrgIBNacgm/ZT6M=; b=BzE8JKd8onQLltydmlsu0mcLbHVF/j3FbzlBwF5SA+mhJu9YtsaxpGiNRwW4r4K4pt GidfNA4QO5uXvlKhKubKweXxfvbaQh9U6aTBFPxJwhSuKG/+6m5x2Q+vWQc/rYvzyyWZ M73hzXXn+Dpn/CCg8P8dp2DLWpSNzBN8RtzzdUilZplXVFDnf/uL6V7OHYKvJokByVUh 0V3Ndd3uqnGIKrMrcUK1Q/lTiLbRBHQNfLLA87xFod1nn1UGM322EUQ9fAyIy/x7QYro uifF/l3luQ3UdkRM82swODHx9RqbLZRN+vCWqPM2Eg4zun4FcvhDfkHjCXay/EujnnrJ pgRg== X-Gm-Message-State: AOAM530JiHXXCEGTRs0cu2hpIvbLvBhwGgwdBT8Eel4iP6Q0hCmJ383O 4aS00oG966KgXQXiesJYY/y9c4zY4iU= X-Google-Smtp-Source: ABdhPJz0O2Rxdo99DfR843115QbrDQttCdLYgN+LTx5kMPTSl1E2wdsLsxBP42k7YeFvWiLUKU1BAA== X-Received: by 2002:a62:ee0f:0:b029:335:a681:34f6 with SMTP id e15-20020a62ee0f0000b0290335a68134f6mr21796905pfi.55.1627372712477; Tue, 27 Jul 2021 00:58:32 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id v9sm2544537pfn.22.2021.07.27.00.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:58:32 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang , Paolo Abeni Subject: [MPTCP][PATCH v5 mptcp-next 2/5] mptcp: local addresses fullmesh Date: Tue, 27 Jul 2021 15:58:19 +0800 Message-Id: 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 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 | 60 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 2259c424485f..a85bac950f3b 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -554,13 +554,62 @@ 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; + + msk->pm.subflows++; + 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); @@ -584,11 +633,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 Tue Jul 27 07:58:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402073 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (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 CD7CF72 for ; Tue, 27 Jul 2021 07:58:34 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id o44-20020a17090a0a2fb0290176ca3e5a2fso3757281pjo.1 for ; Tue, 27 Jul 2021 00:58:34 -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=UnXkIjnDWLI2zJFgZa0QBC/Uaqj9IEh9jQhAyVfyQVNZkGBwhSGzs+DKAl5mbRy0Kq 1q0GRfZ5FKOowCtM9C1jXLE0n5NvxcxAVFbaxt66hjUB6ZWBQ//dEZBSbDgPMs3fL0/c fke5Ug4jwlFgo6am9n/+PIB3aB/zRwyf3Z2CV22XfLYdBpoOzn+3Hzq7Zk+SLVVHnaZV V1u0NaxIGSluJNytfK2jNDND1rLn6tx528ADrlADrcOxWUhzsJhX61pcjyLoHYlkUQKc CwuHjlRoYw9XX6hVCh2I2eZZgPODvTuL2yurN5XEDoailPHHCBczARPxRXnSiFjvZvo0 2eZA== 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=m+RAlRc/rGlcYRvxPT19k+fhd+U+F9X+8Zg9hEAY2vGsCa3dpPCskKLEaMu+JEQzTb i/JOCIV1+hNQxsALLQCDcCcdi/rqPJj6p6of99229sqMCoRNapvbLeDmy3Fu1oT5lviC nR65zOO3AlaSoOdsMRODTIR7uuIPwIGNLctZinOgyk2LiaJ2jrHGn89QWbjRm4aaOaiD CKDqtu25KVAWlF3FvKQqBfhVd2FWFpNPYg6h0KLg/JbjDNzyEXu3Z8Q45mDWIw7ecj2Q 9r0PfkWqQH1b+0nkTEpEL5uwlxt+5gJR5R17wNCrbeewLc6inK/D3Pjt1sKPS0ho4Qdg XvjA== X-Gm-Message-State: AOAM532JVln4+TvC3G8VZBk+6QP5771PBXERAUW/zp5RgOzbrb6z+B4A MsJ+suJY2V2sIMCTcUcCp2tPvIyleF4= X-Google-Smtp-Source: ABdhPJyzLp8ZlGMeLZ0+YgIyJrczdUOOetoCVwluo0IZQPktD6ATHlbph9FaKxVL4HgS69q/wgzunQ== X-Received: by 2002:aa7:9e1b:0:b029:384:1d00:738 with SMTP id y27-20020aa79e1b0000b02903841d000738mr18013620pfq.71.1627372714325; Tue, 27 Jul 2021 00:58:34 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id v9sm2544537pfn.22.2021.07.27.00.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:58:34 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v5 mptcp-next 3/5] selftests: mptcp: set and print the fullmesh flag Date: Tue, 27 Jul 2021 15:58:20 +0800 Message-Id: <69eb44fdf9899ec5eab342fa1f3b62d12ab2598e.1627372396.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 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 07:58:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 12402075 X-Patchwork-Delegate: mat@martineau.name Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 9F26072 for ; Tue, 27 Jul 2021 07:58:36 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id u9-20020a17090a1f09b029017554809f35so2938305pja.5 for ; Tue, 27 Jul 2021 00:58:36 -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=9uVkT+m7WPLMhw9sVvKma6vPeDedSq1FQRGC1Jx73GA=; b=oIHDZZrcoJDiIrBLnJjkqGKcdh7Hqx7tDvGnGzvEX+3oB6ElsEJ9cgaqKfCz3Emh8K TBO7BVgWtHyeeUmjD5gUXNXwELYdOg3Lropbxb+RJENrPw95H+chDHW+gMFNZ9QDWGHQ N2mSyKjn0NkLjYDUGTeF3dEFVLsxLE6MRdD4+nq2rC5izy5gXsfkG+tDrZ+6roIVhrBC Fk6LGAeFY+znEMmekqwF/KD/c+ORP8jBpkMlrJwUPi/0KFFgxF57iZIlGG3WWT79Ryko jhq12OnGbnXV7V5L/9RseaPcAcQ1uWzo9ptr/Om2vlxyHZmgll/+eksV/Ml7wg86YOcx D99A== 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=9uVkT+m7WPLMhw9sVvKma6vPeDedSq1FQRGC1Jx73GA=; b=msQeRofZ1ncgn5HF0YNfBaKnOKL3C+gsj7Rpr+creYgcP561mxFUCyJONiilKibpkm huA2kCPsMj7+FKGQ4qdgn6/j38JjMWmgGzs1wp0KiO6tdWLe+NfhbCGDmfCAneEnMlpV FIW4YiXVYR5sX4NLRhcz0debFhIMWY4c6oQ+25EZEinPn16wHpw7rew7ScpGnkk8pJIi BQ+bK7SMrHM+FcHagHl82e3yexFQANXEOG7zSX2jHSPBdh4HZtlEY5y5EmeFDD/TrhqR cnd6XYAcK49eCLZRbeK6yezAwGSkr/GJA+UCx1RxrGcgWE9RB94ROYvAsA+2UOqanPhf /ABw== X-Gm-Message-State: AOAM533mL2R4mwBUojG9S4GrL1A4pNlANfsX80A+v+nk8pe+wCqRvRJa 5OqW4RFJLv3S2Ad/PX6Owm36L9UTsa0= X-Google-Smtp-Source: ABdhPJwGqtpqVhLy6mVHIloLX6EOPYc5/5Q6Lqep7MUiOx44kWWXnTlXgw9Y0qNq7Bm4oqMyN6Zjxw== X-Received: by 2002:a63:5815:: with SMTP id m21mr19458044pgb.363.1627372716172; Tue, 27 Jul 2021 00:58:36 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id v9sm2544537pfn.22.2021.07.27.00.58.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:58:35 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v5 mptcp-next 4/5] selftests: mptcp: add fullmesh testcases Date: Tue, 27 Jul 2021 15:58:21 +0800 Message-Id: <78d86feae19ea4efd7061a9e92b81475ed035323.1627372396.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <69eb44fdf9899ec5eab342fa1f3b62d12ab2598e.1627372396.git.geliangtang@xiaomi.com> References: <69eb44fdf9899ec5eab342fa1f3b62d12ab2598e.1627372396.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 | 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..ca19762b9c6e 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 8 8 + ip netns exec $ns2 ./pm_nl_ctl limits 8 8 + 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" 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 $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 2" 4 4 4 + chk_add_nr 1 1 + + # fullmesh 3 + 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 "fullmesh test 3" 3 3 3 + chk_add_nr 1 1 + + # fullmesh 4 + 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 12 slow + chk_join_nr "fullmesh test 4" 5 5 5 + 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 07:58: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: 12402077 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 5644E72 for ; Tue, 27 Jul 2021 07:58:38 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id l19so16715703pjz.0 for ; Tue, 27 Jul 2021 00:58:38 -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=ILtYiU70BEcQ5rGiFqRTWS4xoybjP0cjfByRLsh1n10=; b=bcPRSHBHVxpS/zdCqNzRoqRu898xrBLpd71u//6tkm6cLqXmHll6QRZkklSTME8OLS CNmY5Q4HiRFH6ZAwVIWCW8ChGCrznlUaPTPeUQc2tqOGmKQ2FvYKY+E5iHnijBYYB6zi YUWuDwxNdL0zwZN9n4goTJXdXA/4C35314z93yg1iJkqKqVIBVThvE3W/2oPf9MuKPXO HwGLt0rIQyJR1s80VckCPrlh08fjwRGXCAPBaMw5Wmpe6jUBftpLZS0F9W5j2SgQJTKH zXXdhqOTdZfSeQOiSMSYH3zm4YqRbFoYMEMuoKjVXXBuWXGumySSXFO8z92TIrjcxSeJ iCfw== 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=ILtYiU70BEcQ5rGiFqRTWS4xoybjP0cjfByRLsh1n10=; b=ulCYAV/p5uCrdq+LPiDQRKEeUSB89ET9hypZNcDdJ3wKjc8nvjGYyBys+E+svdSfdT znIJX3V35/eIgE0kgHqxV8NbFpOcCJZXY2kfNfa6NbNVEvOwzCoV0HBGObnf1OXEg3Z+ eJfDqtXLY1U4AkBDqBNpJZcxWB8VnmSCjEuWT0OR5zsk71h09EKl28P3ChbUEOQGVSeu jYwcvuGkBGjOsQtxyAaVlEBIC+1Rb5oEjhFVT4YrU/UnUxGLCzacQjVILsliIaBgTaqQ 62wcZsePRjOlIgs6esI/3a0WMVcZIuApiYFVxmOCwutHQbm7fiSIW8RSxEpe1iU4h6LZ emDA== X-Gm-Message-State: AOAM530U98Vcc9gVJ1guKcszIhdGsRT+aIT5PcFGLRrr94Pf8g6Hfjfz 1xRR0ykh4G2m5lPQEIWqzHvYiN5JbKw= X-Google-Smtp-Source: ABdhPJyrLqvxauzoZ8kiDkWY4sCftvfHSJVg+2Zd6wgCFS5ZDRRBzill0bNzamEI2MwaPkNk7nnLbQ== X-Received: by 2002:a17:90a:dc15:: with SMTP id i21mr21697109pjv.139.1627372717888; Tue, 27 Jul 2021 00:58:37 -0700 (PDT) Received: from MiBook.. ([209.9.72.213]) by smtp.gmail.com with ESMTPSA id v9sm2544537pfn.22.2021.07.27.00.58.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 00:58:37 -0700 (PDT) From: Geliang Tang To: mptcp@lists.linux.dev, geliangtang@gmail.com Cc: Geliang Tang Subject: [MPTCP][PATCH v5 mptcp-next 5/5] selftests: mptcp: delete uncontinuous removing ids Date: Tue, 27 Jul 2021 15:58:22 +0800 Message-Id: <0e5e3e180f352cb7ba875e30f94b0d81c789ca72.1627372396.git.geliangtang@xiaomi.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <78d86feae19ea4efd7061a9e92b81475ed035323.1627372396.git.geliangtang@xiaomi.com> References: <69eb44fdf9899ec5eab342fa1f3b62d12ab2598e.1627372396.git.geliangtang@xiaomi.com> <78d86feae19ea4efd7061a9e92b81475ed035323.1627372396.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 ca19762b9c6e..3d906792e963 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