Skip to contentSkip to conversation

Add REMOVE_ADDR support

PATCH Applied Geliang Tang 3 participants 15 messages Sep 2, 2020 – Sep 10, 2020

Subsystems (3)
lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

v9 cover Add REMOVE_ADDR support

v9:
- update patch 3/8, simply call mptcp_pm_nl_rm_subflow_received.
- update patch 5/8, use the reverse x-mas tree order.
- this patchset should be applied after the applying of my another patchset, 'add ADD_ADDR echo flag support'.

v8:
- drop anno_list in v7.
We don't need to add a new list, conn_list is enough for the signal
address and local subflow.
- fix local_id and remote_id issues.
The RM_ADDR logic uses an address id to identify the removing
address, so we must make sure the subflow's local_id and remote_id be set properly.
- fix mptcp_pm_nl_rm_addr_received logic issue
- update selftests

v7:
- add RM_ADDR mib
- update RM_ADDR selftests test case

v6:
- rename lookup_anno_list_by_saddr to remove_anno_list_by_saddr as Paolo suggested.
- add msk socket lock when traverse msk->conn_list as Paolo suggested.
- Since the first three patches in v5 have been merged to export branch, drop them from this patchset.
- add remove addr and subflow selftest test case.
- this patchset is against mptcp_net-next's export branch.

v5:
- merge mptcp_nl_remove_subflow() and mptcp_nl_remove_addr()
- add cond_resched
- reduce the indentation level in mptcp_pm_nl_rm_addr_received

v4:
- update mptcp_subflow_shutdown()'s args.
- add rm_id check to make sure we don't shutdown the first subflow.
- add conn_list empty check.
- move anno_list to mptcp_pm_data.
- add a new patch 'mptcp: add remove subflow support'.

v3:
- fix memory leak and lock issue in v2.
- drop alist in v2.
- fix mptcp_subflow_shutdown's arguments.
- bzero remote in mptcp_pm_create_subflow_or_signal_addr.
- add more commit message.

Geliang Tang (8):
mptcp: remove addr and subflow in PM netlink
mptcp: fix mptcp_pm_nl_rm_addr_received logic issue
mptcp: implement mptcp_pm_remove_subflow
mptcp: fix every subflow's local_id is zero
mptcp: fix subflow's remote_id is zero issue
mptcp: add RM_ADDR related mibs
selftests: mptcp: add remove cfg in mptcp_connect
selftests: mptcp: add remove addr and subflow test cases

 net/mptcp/mib.c                               |   2 +
 net/mptcp/mib.h                               |   2 +
 net/mptcp/pm.c                                |  15 +-
 net/mptcp/pm_netlink.c                        | 107 +++++++++++--
 net/mptcp/protocol.h                          |   3 +-
 net/mptcp/subflow.c                           |   8 +-
 .../selftests/net/mptcp/mptcp_connect.c       |  18 ++-
 .../testing/selftests/net/mptcp/mptcp_join.sh | 145 +++++++++++++++++-
 8 files changed, 276 insertions(+), 24 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v9 1/8 mptcp: remove addr and subflow in PM netlink

This patch implements the remove announced addr and subflow logic in PM netlink.

When the PM netlink removes an address, we traverse all the existing msk sockets to find the relevant sockets.

In the traversing, we check if this address is in conn_list. If it is, we trigger the RM_ADDR signal to remove the remote subflow and remove the local subflow which using this local address.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm.c         |  6 +++++-
 net/mptcp/pm_netlink.c | 39 +++++++++++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 5 deletions(-)
net/mptcp/pm.c +5 -1
index be4157279e15..511996bf4838 100644
@@ -26,7 +26,11 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
 
 int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id)
 {
-	return -ENOTSUPP;
+	pr_debug("msk=%p, local_id=%d", msk, local_id);
+
+	msk->pm.rm_id = local_id;
+	WRITE_ONCE(msk->pm.rm_addr_signal, true);
+	return 0;
 }
 
 int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 remote_id)
net/mptcp/pm_netlink.c +35 -4
index 54fd9db6fb7a..16709939f767 100644
@@ -554,6 +554,35 @@ __lookup_addr_by_id(struct pm_nl_pernet *pernet, unsigned int id)
 	return NULL;
 }
 
+static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
+						   struct mptcp_addr_info *addr)
+{
+	struct mptcp_sock *msk;
+	long s_slot = 0, s_num = 0;
+
+	pr_debug("remove_id=%d\n", addr->id);
+
+	while ((msk = mptcp_token_iter_next(net, &s_slot, &s_num)) != NULL) {
+		struct sock *sk = (struct sock *)msk;
+
+		if (list_empty(&msk->conn_list))
+			goto next;
+
+		lock_sock(sk);
+		if (lookup_subflow_by_saddr(&msk->conn_list, addr)) {
+			mptcp_pm_remove_addr(msk, addr->id);
+			mptcp_pm_remove_subflow(msk, addr->id);
+		}
+		release_sock(sk);
+
+next:
+		sock_put(sk);
+		cond_resched();
+	}
+
+	return 0;
+}
+
 static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
 {
 	struct nlattr *attr = info->attrs[MPTCP_PM_ATTR_ADDR];
@@ -569,8 +598,8 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
 	entry = __lookup_addr_by_id(pernet, addr.addr.id);
 	if (!entry) {
 		GENL_SET_ERR_MSG(info, "address not found");
-		ret = -EINVAL;
-		goto out;
+		spin_unlock_bh(&pernet->lock);
+		return -EINVAL;
 	}
 	if (entry->addr.flags & MPTCP_PM_ADDR_FLAG_SIGNAL)
 		pernet->add_addr_signal_max--;
@@ -579,9 +608,11 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)
 
 	pernet->addrs--;
 	list_del_rcu(&entry->list);
-	kfree_rcu(entry, rcu);
-out:
 	spin_unlock_bh(&pernet->lock);
+
+	mptcp_nl_remove_subflow_and_signal_addr(sock_net(skb->sk), &entry->addr);
+	kfree_rcu(entry, rcu);
+
 	return ret;
 }
 
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH v9 2/8 mptcp: fix mptcp_pm_nl_rm_addr_received logic issue

In reply to Geliang Tang

We want to use mptcp_pm_nl_rm_addr_received to deal with both removing an address and removing a subflow. But it not work. Here is the problem:

Suppose there are three subflows,

    1 local_id=0 remote_id=0
    2 local_id=0 remote_id=1
    3 local_id=1 remote_id=0.

Here we want to remove the local subflow, the No.3 subflow, so we passed msk->pm.rm_id=1 to mptcp_pm_nl_rm_addr_received.

According to this logic,

               if (msk->pm.rm_id != subflow->remote_id &&
                   msk->pm.rm_id != subflow->local_id)

We removed the wrong subflow, the No.2 subflow.

So we need to deal with removing an address and removing a subflow separately. We check subflow->remote_id in mptcp_pm_nl_rm_addr_received to remove an address and check subflow->local_id in mptcp_pm_nl_rm_subflow_received to remove a subflow.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm_netlink.c | 45 ++++++++++++++++++++++++++++++++++++------
 net/mptcp/protocol.h   |  1 +
 2 files changed, 40 insertions(+), 6 deletions(-)
net/mptcp/pm_netlink.c +39 -6
index 16709939f767..4e6c141b810f 100644
@@ -265,7 +265,7 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
 	struct mptcp_subflow_context *subflow, *tmp;
 	struct sock *sk = (struct sock *)msk;
 
-	pr_debug("rm_id %d", msk->pm.rm_id);
+	pr_debug("address rm_id %d", msk->pm.rm_id);
 
 	if (!msk->pm.rm_id)
 		return;
@@ -273,23 +273,56 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
 	if (list_empty(&msk->conn_list))
 		return;
 
-	msk->pm.add_addr_accepted--;
-	msk->pm.subflows--;
-	WRITE_ONCE(msk->pm.accept_addr, true);
+	list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
+		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+		int how = RCV_SHUTDOWN | SEND_SHUTDOWN;
+		long timeout = 0;
+
+		if (msk->pm.rm_id != subflow->remote_id)
+			continue;
+
+		spin_unlock_bh(&msk->pm.lock);
+		mptcp_subflow_shutdown(sk, ssk, how);
+		__mptcp_close_ssk(sk, ssk, subflow, timeout);
+		spin_lock_bh(&msk->pm.lock);
+
+		msk->pm.add_addr_accepted--;
+		msk->pm.subflows--;
+		WRITE_ONCE(msk->pm.accept_addr, true);
+
+		break;
+	}
+}
+
+void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id)
+{
+	struct mptcp_subflow_context *subflow, *tmp;
+	struct sock *sk = (struct sock *)msk;
+
+	pr_debug("subflow rm_id %d", rm_id);
+
+	if (!rm_id)
+		return;
+
+	if (list_empty(&msk->conn_list))
+		return;
 
 	list_for_each_entry_safe(subflow, tmp, &msk->conn_list, node) {
 		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
 		int how = RCV_SHUTDOWN | SEND_SHUTDOWN;
 		long timeout = 0;
 
-		if (msk->pm.rm_id != subflow->remote_id &&
-		    msk->pm.rm_id != subflow->local_id)
+		if (rm_id != subflow->local_id)
 			continue;
 
 		spin_unlock_bh(&msk->pm.lock);
 		mptcp_subflow_shutdown(sk, ssk, how);
 		__mptcp_close_ssk(sk, ssk, subflow, timeout);
 		spin_lock_bh(&msk->pm.lock);
+
+		msk->pm.local_addr_used--;
+		msk->pm.subflows--;
+
 		break;
 	}
 }
net/mptcp/protocol.h +1 -0
index ba253a6947b0..703fb1f1d0ce 100644
@@ -477,6 +477,7 @@ void mptcp_pm_nl_fully_established(struct mptcp_sock *msk);
 void mptcp_pm_nl_subflow_established(struct mptcp_sock *msk);
 void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk);
 void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk);
+void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id);
 int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);
 
 static inline struct mptcp_ext *mptcp_get_ext(struct sk_buff *skb)
Signature · 1 line
2.17.1
author
#3 lore raw

PATCH v9 3/8 mptcp: implement mptcp_pm_remove_subflow

In reply to Geliang Tang

This patch implemented the local subflow removing function, mptcp_pm_remove_subflow, it simply called mptcp_pm_nl_rm_subflow_received under the PM spin lock.

We use mptcp_pm_remove_subflow to remove a local subflow, so change it's argument from remote_id to local_id.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm.c       | 9 +++++++--
 net/mptcp/protocol.h | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)
net/mptcp/pm.c +7 -2
index 511996bf4838..9328f0b175a7 100644
@@ -33,9 +33,14 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id)
 	return 0;
 }
 
-int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 remote_id)
+int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 local_id)
 {
-	return -ENOTSUPP;
+	pr_debug("%s msk=%p, local_id=%d", __func__, msk, local_id);
+
+	spin_lock_bh(&msk->pm.lock);
+	mptcp_pm_nl_rm_subflow_received(msk, local_id);
+	spin_unlock_bh(&msk->pm.lock);
+	return 0;
 }
 
 /* path manager event handlers */
net/mptcp/protocol.h +1 -1
index 703fb1f1d0ce..bad751e2c8f3 100644
@@ -446,7 +446,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
 			   const struct mptcp_addr_info *addr,
 			   bool echo);
 int mptcp_pm_remove_addr(struct mptcp_sock *msk, u8 local_id);
-int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 remote_id);
+int mptcp_pm_remove_subflow(struct mptcp_sock *msk, u8 local_id);
 
 static inline bool mptcp_pm_should_add_signal(struct mptcp_sock *msk)
 {
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v9 4/8 mptcp: fix every subflow's local_id is zero

In reply to Geliang Tang

skc_local is the same as msk_local, so mptcp_pm_nl_get_local_id always return 0. Thus every subflow's local_id is 0.

This patch fixed this issue.

Also, we need to ignore the zero address here, like 0.0.0.0 in IPv4, when we use the zero address as a local address, we means that we can use any one of the local addresses. The zero address is not a new address, we don't need to add it to PM, so this patch added a new function address_zero to check whether an address is the zero address, if it is, we ignore this address.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/pm_netlink.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
net/mptcp/pm_netlink.c +17 -1
index 4e6c141b810f..62ffc9d5861f 100644
@@ -64,6 +64,19 @@ static bool addresses_equal(const struct mptcp_addr_info *a,
 	return a->port == b->port;
 }
 
+static bool address_zero(const struct mptcp_addr_info *addr)
+{
+	struct mptcp_addr_info zero;
+
+	memset(&zero, 0, sizeof(zero));
+	zero.family = addr->family;
+
+	if (addresses_equal(addr, &zero, false))
+		return true;
+
+	return false;
+}
+
 static void local_address(const struct sock_common *skc,
 			  struct mptcp_addr_info *addr)
 {
@@ -389,10 +402,13 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
 	 * addr
 	 */
 	local_address((struct sock_common *)msk, &msk_local);
-	local_address((struct sock_common *)msk, &skc_local);
+	local_address((struct sock_common *)skc, &skc_local);
 	if (addresses_equal(&msk_local, &skc_local, false))
 		return 0;
 
+	if (address_zero(&skc_local))
+		return 0;
+
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
 	rcu_read_lock();
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH v9 5/8 mptcp: fix subflow's remote_id is zero issue

In reply to Geliang Tang

This patch added the missing remote_id setting in subflow_ulp_clone. And also updated the remote_id setting in __mptcp_subflow_connect, to make the code more like local_id setting.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/subflow.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
net/mptcp/subflow.c +5 -3
index e31900ff0c56..0a071794a5c2 100644
@@ -1042,6 +1042,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 	struct mptcp_sock *msk = mptcp_sk(sk);
 	struct mptcp_subflow_context *subflow;
 	struct sockaddr_storage addr;
+	int remote_id = remote->id;
 	int local_id = loc->id;
 	struct socket *sf;
 	struct sock *ssk;
@@ -1073,7 +1074,6 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 	subflow->remote_key = msk->remote_key;
 	subflow->local_key = msk->local_key;
 	subflow->token = msk->token;
-	subflow->remote_id = remote->id;
 	mptcp_info2sockaddr(loc, &addr);
 
 	addrlen = sizeof(struct sockaddr_in);
@@ -1087,10 +1087,11 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
 		goto failed;
 
 	mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
-	pr_debug("msk=%p remote_token=%u local_id=%d", msk, remote_token,
-		 local_id);
+	pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk, remote_token,
+		 local_id, remote_id);
 	subflow->remote_token = remote_token;
 	subflow->local_id = local_id;
+	subflow->remote_id = remote_id;
 	subflow->request_join = 1;
 	subflow->request_bkup = !!(loc->flags & MPTCP_PM_ADDR_FLAG_BACKUP);
 	mptcp_info2sockaddr(remote, &addr);
@@ -1354,6 +1355,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
 		new_ctx->fully_established = 1;
 		new_ctx->backup = subflow_req->backup;
 		new_ctx->local_id = subflow_req->local_id;
+		new_ctx->remote_id = subflow_req->remote_id;
 		new_ctx->token = subflow_req->token;
 		new_ctx->thmac = subflow_req->thmac;
 	}
Signature · 1 line
2.17.1
author
#6 lore raw

PATCH v9 6/8 mptcp: add RM_ADDR related mibs

In reply to Geliang Tang

This patch added two new mibs for RM_ADDR, named MPTCP_MIB_RMADDR and MPTCP_MIB_RMSUBFLOW, when the RM_ADDR suboption is received, increase the first mib counter, when the local subflow is removed, increase the second mib counter.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/mib.c        | 2 ++
 net/mptcp/mib.h        | 2 ++
 net/mptcp/pm_netlink.c | 5 +++++
 3 files changed, 9 insertions(+)
net/mptcp/mib.c +2 -0
index a33bf719ce6f..84d119436b22 100644
@@ -29,6 +29,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA),
 	SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
 	SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
+	SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
+	SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
 	SNMP_MIB_SENTINEL
 };
 
net/mptcp/mib.h +2 -0
index cdeea3732ddf..47bcecce1106 100644
@@ -22,6 +22,8 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_DUPDATA,		/* Segments discarded due to duplicate DSS */
 	MPTCP_MIB_ADDADDR,		/* Received ADD_ADDR with echo-flag=0 */
 	MPTCP_MIB_ECHOADD,		/* Received ADD_ADDR with echo-flag=1 */
+	MPTCP_MIB_RMADDR,		/* Received RM_ADDR */
+	MPTCP_MIB_RMSUBFLOW,		/* Remove a subflow */
 	__MPTCP_MIB_MAX
 };
 
net/mptcp/pm_netlink.c +5 -0
index 62ffc9d5861f..ac5df37b5170 100644
@@ -15,6 +15,7 @@
 #include <uapi/linux/mptcp.h>
 
 #include "protocol.h"
+#include "mib.h"
 
 /* forward declaration */
 static struct genl_family mptcp_genl_family;
@@ -303,6 +304,8 @@ void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk)
 		msk->pm.subflows--;
 		WRITE_ONCE(msk->pm.accept_addr, true);
 
+		__MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMADDR);
+
 		break;
 	}
 }
@@ -336,6 +339,8 @@ void mptcp_pm_nl_rm_subflow_received(struct mptcp_sock *msk, u8 rm_id)
 		msk->pm.local_addr_used--;
 		msk->pm.subflows--;
 
+		__MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_RMSUBFLOW);
+
 		break;
 	}
 }
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH v9 7/8 selftests: mptcp: add remove cfg in mptcp_connect

In reply to Geliang Tang

This patch added a new cfg, named cfg_remove in mptcp_connect. This new cfg_remove is copied from cfg_join. The only difference between them is in the do_rnd_write function. Here we slow down the transfer process of all data to let the RM_ADDR suboption can be sent and received completely. Otherwise the remove address and subflow test cases don't work.

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 .../selftests/net/mptcp/mptcp_connect.c        | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +15 -3
index 090620c3e10c..6fee64e153d6 100644
@@ -54,6 +54,7 @@ static int pf = AF_INET;
 static int cfg_sndbuf;
 static int cfg_rcvbuf;
 static bool cfg_join;
+static bool cfg_remove;
 static int cfg_wait;
 
 static void die_usage(void)
@@ -271,6 +272,9 @@ static size_t do_rnd_write(const int fd, char *buf, const size_t len)
 	if (cfg_join && first && do_w > 100)
 		do_w = 100;
 
+	if (cfg_remove && do_w > 50)
+		do_w = 50;
+
 	bw = write(fd, buf, do_w);
 	if (bw < 0)
 		perror("write");
@@ -281,6 +285,9 @@ static size_t do_rnd_write(const int fd, char *buf, const size_t len)
 		first = false;
 	}
 
+	if (cfg_remove)
+		usleep(200000);
+
 	return bw;
 }
 
@@ -428,7 +435,7 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd)
 	}
 
 	/* leave some time for late join/announce */
-	if (cfg_join)
+	if (cfg_join || cfg_remove)
 		usleep(cfg_wait);
 
 	close(peerfd);
@@ -686,7 +693,7 @@ static void maybe_close(int fd)
 {
 	unsigned int r = rand();
 
-	if (!cfg_join && (r & 1))
+	if (!(cfg_join || cfg_remove) && (r & 1))
 		close(fd);
 }
 
@@ -822,13 +829,18 @@ static void parse_opts(int argc, char **argv)
 {
 	int c;
 
-	while ((c = getopt(argc, argv, "6jlp:s:hut:m:S:R:w:")) != -1) {
+	while ((c = getopt(argc, argv, "6jrlp:s:hut:m:S:R:w:")) != -1) {
 		switch (c) {
 		case 'j':
 			cfg_join = true;
 			cfg_mode = CFG_MODE_POLL;
 			cfg_wait = 400000;
 			break;
+		case 'r':
+			cfg_remove = true;
+			cfg_mode = CFG_MODE_POLL;
+			cfg_wait = 400000;
+			break;
 		case 'l':
 			listen_mode = true;
 			break;
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH v9 8/8 selftests: mptcp: add remove addr and subflow test cases

In reply to Geliang Tang

This patch added the remove addr and subflow test cases and two new functions.

The first function run_remove_tests calls do_transfer with two new arguments, rm_nr_ns1 and rm_nr_ns2, for the numbers of addresses should be removed during the transfer process in namespace 1 and namespace 2.

If both these two arguments are 0, we do the join test cases with "mptcp_connect -j" command. Otherwise, do the remove test cases with "mptcp_connect -r" command.

The second function chk_rm_nr checks the RM_ADDR related mibs's counters.

The output of the test cases looks like this:

11 remove single subflow syn[ ok ] - synack[ ok ] - ack[ ok ]
rm [ ok ] - sf [ ok ]
12 remove multiple subflows syn[ ok ] - synack[ ok ] - ack[ ok ]
rm [ ok ] - sf [ ok ]
13 remove single address syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
rm [ ok ] - sf [ ok ]
14 remove subflow and signal syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
rm [ ok ] - sf [ ok ]
15 remove subflows and signal syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
rm [ ok ] - sf [ ok ]

Suggested-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
Suggested-by Paolo Abeni <pabeni(a)redhat.com>
Suggested-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 145 +++++++++++++++++-
 1 file changed, 142 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +142 -3
index bf6172138bed..2f257cb6baf3 100755
@@ -8,6 +8,7 @@ cin=""
 cout=""
 ksft_skip=4
 timeout=30
+mptcp_connect=""
 capture=0
 
 TEST_COUNT=0
@@ -132,6 +133,8 @@ do_transfer()
 	cl_proto="$3"
 	srv_proto="$4"
 	connect_addr="$5"
+	rm_nr_ns1="$6"
+	rm_nr_ns2="$7"
 
 	port=$((10000+$TEST_COUNT))
 	TEST_COUNT=$((TEST_COUNT+1))
@@ -156,14 +159,44 @@ do_transfer()
 		sleep 1
 	fi
 
-	ip netns exec ${listener_ns} ./mptcp_connect -j -t $timeout -l -p $port -s ${srv_proto} 0.0.0.0 < "$sin" > "$sout" &
+	if [[ $rm_nr_ns1 -eq 0 && $rm_nr_ns2 -eq 0 ]]; then
+		mptcp_connect="./mptcp_connect -j"
+	else
+		mptcp_connect="./mptcp_connect -r"
+	fi
+
+	ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port -s ${srv_proto} 0.0.0.0 < "$sin" > "$sout" &
 	spid=$!
 
 	sleep 1
 
-	ip netns exec ${connector_ns} ./mptcp_connect -j -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" &
+	ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" &
 	cpid=$!
 
+	if [ $rm_nr_ns1 -gt 0 ]; then
+		counter=1
+		sleep 1
+
+		while [ $counter -le $rm_nr_ns1 ]
+		do
+			ip netns exec ${listener_ns} ./pm_nl_ctl del $counter
+			sleep 1
+			let counter+=1
+		done
+	fi
+
+	if [ $rm_nr_ns2 -gt 0 ]; then
+		counter=1
+		sleep 1
+
+		while [ $counter -le $rm_nr_ns2 ]
+		do
+			ip netns exec ${connector_ns} ./pm_nl_ctl del $counter
+			sleep 1
+			let counter+=1
+		done
+	fi
+
 	wait $cpid
 	retc=$?
 	wait $spid
@@ -219,7 +252,24 @@ run_tests()
 	connect_addr="$3"
 	lret=0
 
-	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr}
+	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} 0 0
+	lret=$?
+	if [ $lret -ne 0 ]; then
+		ret=$lret
+		return
+	fi
+}
+
+run_remove_tests()
+{
+	listener_ns="$1"
+	connector_ns="$2"
+	connect_addr="$3"
+	rm_nr_ns1="$4"
+	rm_nr_ns2="$5"
+	lret=0
+
+	do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} ${rm_nr_ns1} ${rm_nr_ns2}
 	lret=$?
 	if [ $lret -ne 0 ]; then
 		ret=$lret
@@ -313,6 +363,43 @@ chk_add_nr()
 	fi
 }
 
+chk_rm_nr()
+{
+	local rm_addr_nr=$1
+	local rm_subflow_nr=$2
+	local count
+	local dump_stats
+
+	printf "%-39s %s" " " "rm "
+	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$rm_addr_nr" ]; then
+		echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - sf    "
+	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtRmSubflow | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$rm_subflow_nr" ]; then
+		echo "[fail] got $count RM_SUBFLOW[s] expected $rm_subflow_nr"
+		ret=1
+		dump_stats=1
+	else
+		echo "[ ok ]"
+	fi
+
+	if [ "${dump_stats}" = 1 ]; then
+		echo Server ns stats
+		ip netns exec $ns1 nstat -as | grep MPTcp
+		echo Client ns stats
+		ip netns exec $ns2 nstat -as | grep MPTcp
+	fi
+}
+
 sin=$(mktemp)
 sout=$(mktemp)
 cin=$(mktemp)
@@ -404,6 +491,58 @@ run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "multiple subflows and signal" 3 3 3
 chk_add_nr 1 1
 
+# single subflow, remove
+reset
+ip netns exec $ns1 ./pm_nl_ctl limits 0 1
+ip netns exec $ns2 ./pm_nl_ctl limits 0 1
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+run_remove_tests $ns1 $ns2 10.0.1.1 0 1
+chk_join_nr "remove single subflow" 1 1 1
+chk_rm_nr 1 1
+
+# multiple subflows, remove
+reset
+ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+ip netns exec $ns2 ./pm_nl_ctl limits 0 2
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+run_remove_tests $ns1 $ns2 10.0.1.1 0 2
+chk_join_nr "remove multiple subflows" 2 2 2
+chk_rm_nr 2 2
+
+# single address, remove
+reset
+ip netns exec $ns1 ./pm_nl_ctl limits 0 1
+ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+ip netns exec $ns2 ./pm_nl_ctl limits 1 1
+run_remove_tests $ns1 $ns2 10.0.1.1 1 0
+chk_join_nr "remove single address" 1 1 1
+chk_add_nr 1 1
+chk_rm_nr 0 0
+
+# subflow and signal, remove
+reset
+ip netns exec $ns1 ./pm_nl_ctl limits 0 2
+ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+ip netns exec $ns2 ./pm_nl_ctl limits 1 2
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+run_remove_tests $ns1 $ns2 10.0.1.1 1 1
+chk_join_nr "remove subflow and signal" 2 2 2
+chk_add_nr 1 1
+chk_rm_nr 1 1
+
+# subflows and signal, remove
+reset
+ip netns exec $ns1 ./pm_nl_ctl limits 0 3
+ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
+ip netns exec $ns2 ./pm_nl_ctl limits 1 3
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
+ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow
+run_remove_tests $ns1 $ns2 10.0.1.1 1 2
+chk_join_nr "remove subflows and signal" 3 3 3
+chk_add_nr 1 1
+chk_rm_nr 2 2
+
 # single subflow, syncookies
 reset_with_cookies
 ip netns exec $ns1 ./pm_nl_ctl limits 0 1
Signature · 1 line
2.17.1
author
#9 lore raw
In reply to Geliang Tang
Quoted 50 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月2日周三 下午5:40写道:

v9:
- update patch 3/8, simply call mptcp_pm_nl_rm_subflow_received.
- update patch 5/8, use the reverse x-mas tree order.
- this patchset should be applied after the applying of my another patchset, 'add ADD_ADDR echo flag support'.

v8:
- drop anno_list in v7.
We don't need to add a new list, conn_list is enough for the signal
address and local subflow.
- fix local_id and remote_id issues.
The RM_ADDR logic uses an address id to identify the removing
address, so we must make sure the subflow's local_id and remote_id be set properly.
- fix mptcp_pm_nl_rm_addr_received logic issue
- update selftests

v7:
- add RM_ADDR mib
- update RM_ADDR selftests test case

v6:
- rename lookup_anno_list_by_saddr to remove_anno_list_by_saddr as Paolo suggested.
- add msk socket lock when traverse msk->conn_list as Paolo suggested.
- Since the first three patches in v5 have been merged to export branch, drop them from this patchset.
- add remove addr and subflow selftest test case.
- this patchset is against mptcp_net-next's export branch.

v5:
- merge mptcp_nl_remove_subflow() and mptcp_nl_remove_addr()
- add cond_resched
- reduce the indentation level in mptcp_pm_nl_rm_addr_received

v4:
- update mptcp_subflow_shutdown()'s args.
- add rm_id check to make sure we don't shutdown the first subflow.
- add conn_list empty check.
- move anno_list to mptcp_pm_data.
- add a new patch 'mptcp: add remove subflow support'.

v3:
- fix memory leak and lock issue in v2.
- drop alist in v2.
- fix mptcp_subflow_shutdown's arguments.
- bzero remote in mptcp_pm_create_subflow_or_signal_addr.
- add more commit message.

Quoted 9 lines

Geliang Tang (8):
1/8 mptcp: remove addr and subflow in PM netlink 2/8 mptcp: fix mptcp_pm_nl_rm_addr_received logic issue 3/8 mptcp: implement mptcp_pm_remove_subflow
4/8 mptcp: fix every subflow's local_id is zero 5/8 mptcp: fix subflow's remote_id is zero issue 6/8 mptcp: add RM_ADDR related mibs
7/8 selftests: mptcp: add remove cfg in mptcp_connect 8/8 selftests: mptcp: add remove addr and subflow test cases

Hi Paolo, Matt,

I want to adjust some code in this patchset.

I think patch 2/8 "mptcp: fix mptcp_pm_nl_rm_addr_received logic issue" shouldn't be here, it's better to squash-to the original commit "mptcp: add the incoming RM_ADDR support".

So I have sent out a new patch named 'Squash-to: "mptcp: add the incoming RM_ADDR support"' yesterday.

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested. Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Please give me some suggestions about my squash-to patch.

Thanks.
-Geliang

Quoted 14 lines
 net/mptcp/mib.c                               |   2 +
 net/mptcp/mib.h                               |   2 +
 net/mptcp/pm.c                                |  15 +-
 net/mptcp/pm_netlink.c                        | 107 +++++++++++--
 net/mptcp/protocol.h                          |   3 +-
 net/mptcp/subflow.c                           |   8 +-
 .../selftests/net/mptcp/mptcp_connect.c       |  18 ++-
 .../testing/selftests/net/mptcp/mptcp_join.sh | 145 +++++++++++++++++-
 8 files changed, 276 insertions(+), 24 deletions(-)

--
2.17.1

#10 lore raw
Quoted 3 lines · Geliang Tang

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested.

I think you can go ahead and post them upstream. The sooner, the better
- than we will have to wait for -net merge into net-next to push the patches depending on the above ones.

Quoted 5 lines

Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Please give me some suggestions about my squash-to patch.

LGTM ;)

Thanks,

Paolo

author
#11 lore raw

Hi Matt,

Quoted 10 lines · Paolo Abeni <pabeni(a)redhat.com> 于2020年9月7日周一 下午5:52写道:
Quoted 3 lines · Geliang Tang

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested.

I think you can go ahead and post them upstream. The sooner, the better
- than we will have to wait for -net merge into net-next to push the patches depending on the above ones.

Quoted 7 lines
Quoted 5 lines

Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Please give me some suggestions about my squash-to patch.

LGTM ;)

Please help me to squash this squash-to patch (Squash-to: "mptcp: add the incoming
RM_ADDR support") to the original commit, since some of my patches are depend on this changes.

Thanks.

-Geliang

Quoted 5 lines

Thanks,

Paolo

author
#12 lore raw
In reply to Geliang Tang
Quoted 98 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月4日周五 下午1:07写道:
Quoted 50 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月2日周三 下午5:40写道:

v9:
- update patch 3/8, simply call mptcp_pm_nl_rm_subflow_received.
- update patch 5/8, use the reverse x-mas tree order.
- this patchset should be applied after the applying of my another patchset, 'add ADD_ADDR echo flag support'.

v8:
- drop anno_list in v7.
We don't need to add a new list, conn_list is enough for the signal
address and local subflow.
- fix local_id and remote_id issues.
The RM_ADDR logic uses an address id to identify the removing
address, so we must make sure the subflow's local_id and remote_id be set properly.
- fix mptcp_pm_nl_rm_addr_received logic issue
- update selftests

v7:
- add RM_ADDR mib
- update RM_ADDR selftests test case

v6:
- rename lookup_anno_list_by_saddr to remove_anno_list_by_saddr as Paolo suggested.
- add msk socket lock when traverse msk->conn_list as Paolo suggested.
- Since the first three patches in v5 have been merged to export branch, drop them from this patchset.
- add remove addr and subflow selftest test case.
- this patchset is against mptcp_net-next's export branch.

v5:
- merge mptcp_nl_remove_subflow() and mptcp_nl_remove_addr()
- add cond_resched
- reduce the indentation level in mptcp_pm_nl_rm_addr_received

v4:
- update mptcp_subflow_shutdown()'s args.
- add rm_id check to make sure we don't shutdown the first subflow.
- add conn_list empty check.
- move anno_list to mptcp_pm_data.
- add a new patch 'mptcp: add remove subflow support'.

v3:
- fix memory leak and lock issue in v2.
- drop alist in v2.
- fix mptcp_subflow_shutdown's arguments.
- bzero remote in mptcp_pm_create_subflow_or_signal_addr.
- add more commit message.

Quoted 9 lines

Geliang Tang (8):
1/8 mptcp: remove addr and subflow in PM netlink 2/8 mptcp: fix mptcp_pm_nl_rm_addr_received logic issue 3/8 mptcp: implement mptcp_pm_remove_subflow
4/8 mptcp: fix every subflow's local_id is zero 5/8 mptcp: fix subflow's remote_id is zero issue 6/8 mptcp: add RM_ADDR related mibs
7/8 selftests: mptcp: add remove cfg in mptcp_connect 8/8 selftests: mptcp: add remove addr and subflow test cases

Hi Paolo, Matt,

I want to adjust some code in this patchset.

I think patch 2/8 "mptcp: fix mptcp_pm_nl_rm_addr_received logic issue" shouldn't be here, it's better to squash-to the original commit "mptcp: add the incoming RM_ADDR support".

So I have sent out a new patch named 'Squash-to: "mptcp: add the incoming RM_ADDR support"' yesterday.

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested. Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Please give me some suggestions about my squash-to patch.

Thanks.
-Geliang

Quoted 14 lines
 net/mptcp/mib.c                               |   2 +
 net/mptcp/mib.h                               |   2 +
 net/mptcp/pm.c                                |  15 +-
 net/mptcp/pm_netlink.c                        | 107 +++++++++++--
 net/mptcp/protocol.h                          |   3 +-
 net/mptcp/subflow.c                           |   8 +-
 .../selftests/net/mptcp/mptcp_connect.c       |  18 ++-
 .../testing/selftests/net/mptcp/mptcp_join.sh | 145 +++++++++++++++++-
 8 files changed, 276 insertions(+), 24 deletions(-)

--
2.17.1

author
#13 lore raw
In reply to Geliang Tang
Quoted 79 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月4日周五 下午1:07写道:
Quoted 50 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月2日周三 下午5:40写道:

v9:
- update patch 3/8, simply call mptcp_pm_nl_rm_subflow_received.
- update patch 5/8, use the reverse x-mas tree order.
- this patchset should be applied after the applying of my another patchset, 'add ADD_ADDR echo flag support'.

v8:
- drop anno_list in v7.
We don't need to add a new list, conn_list is enough for the signal
address and local subflow.
- fix local_id and remote_id issues.
The RM_ADDR logic uses an address id to identify the removing
address, so we must make sure the subflow's local_id and remote_id be set properly.
- fix mptcp_pm_nl_rm_addr_received logic issue
- update selftests

v7:
- add RM_ADDR mib
- update RM_ADDR selftests test case

v6:
- rename lookup_anno_list_by_saddr to remove_anno_list_by_saddr as Paolo suggested.
- add msk socket lock when traverse msk->conn_list as Paolo suggested.
- Since the first three patches in v5 have been merged to export branch, drop them from this patchset.
- add remove addr and subflow selftest test case.
- this patchset is against mptcp_net-next's export branch.

v5:
- merge mptcp_nl_remove_subflow() and mptcp_nl_remove_addr()
- add cond_resched
- reduce the indentation level in mptcp_pm_nl_rm_addr_received

v4:
- update mptcp_subflow_shutdown()'s args.
- add rm_id check to make sure we don't shutdown the first subflow.
- add conn_list empty check.
- move anno_list to mptcp_pm_data.
- add a new patch 'mptcp: add remove subflow support'.

v3:
- fix memory leak and lock issue in v2.
- drop alist in v2.
- fix mptcp_subflow_shutdown's arguments.
- bzero remote in mptcp_pm_create_subflow_or_signal_addr.
- add more commit message.

Quoted 9 lines

Geliang Tang (8):
1/8 mptcp: remove addr and subflow in PM netlink 2/8 mptcp: fix mptcp_pm_nl_rm_addr_received logic issue 3/8 mptcp: implement mptcp_pm_remove_subflow
4/8 mptcp: fix every subflow's local_id is zero 5/8 mptcp: fix subflow's remote_id is zero issue 6/8 mptcp: add RM_ADDR related mibs
7/8 selftests: mptcp: add remove cfg in mptcp_connect 8/8 selftests: mptcp: add remove addr and subflow test cases

Hi Paolo, Matt,

I want to adjust some code in this patchset.

I think patch 2/8 "mptcp: fix mptcp_pm_nl_rm_addr_received logic issue" shouldn't be here, it's better to squash-to the original commit "mptcp: add the incoming RM_ADDR support".

So I have sent out a new patch named 'Squash-to: "mptcp: add the incoming RM_ADDR support"' yesterday.

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested. Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Quoted 5 lines

Please give me some suggestions about my squash-to patch.

Thanks.
-Geliang

Hi Matt, Paolo,

After this code adjusting, the valid patches in this "RM_ADDR support" patchset v9 are these 8 patches:

Squash-to: "mptcp: add the incoming RM_ADDR support"
mptcp: remove addr and subflow in PM netlink
Squash-to: "mptcp: remove addr and subflow in PM netlink v9"
mptcp: implement mptcp_pm_remove_subflow
Squash-to: "mptcp: implement mptcp_pm_remove_subflow v9"
mptcp: add RM_ADDR related mibs
selftests: mptcp: add remove cfg in mptcp_connect
selftests: mptcp: add remove addr and subflow test cases

These 3 patches should be removed from this patchset:
mptcp: fix mptcp_pm_nl_rm_addr_received logic issue
mptcp: fix every subflow's local_id is zero
mptcp: fix subflow's remote_id is zero issue

-Geliang
-Geliang

Quoted 14 lines
Quoted 14 lines
 net/mptcp/mib.c                               |   2 +
 net/mptcp/mib.h                               |   2 +
 net/mptcp/pm.c                                |  15 +-
 net/mptcp/pm_netlink.c                        | 107 +++++++++++--
 net/mptcp/protocol.h                          |   3 +-
 net/mptcp/subflow.c                           |   8 +-
 .../selftests/net/mptcp/mptcp_connect.c       |  18 ++-
 .../testing/selftests/net/mptcp/mptcp_join.sh | 145 +++++++++++++++++-
 8 files changed, 276 insertions(+), 24 deletions(-)

--
2.17.1

Applied
#14 lore raw

Hi Geliang, Paolo,

Quoted 53 lines · Geliang Tang
Quoted 52 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月4日周五 下午1:07写道:
Quoted 50 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年9月2日周三 下午5:40写道:

v9:
- update patch 3/8, simply call mptcp_pm_nl_rm_subflow_received.
- update patch 5/8, use the reverse x-mas tree order.
- this patchset should be applied after the applying of my another patchset, 'add ADD_ADDR echo flag support'.

v8:
- drop anno_list in v7.
We don't need to add a new list, conn_list is enough for the signal
address and local subflow.
- fix local_id and remote_id issues.
The RM_ADDR logic uses an address id to identify the removing
address, so we must make sure the subflow's local_id and remote_id be set properly.
- fix mptcp_pm_nl_rm_addr_received logic issue
- update selftests

v7:
- add RM_ADDR mib
- update RM_ADDR selftests test case

v6:
- rename lookup_anno_list_by_saddr to remove_anno_list_by_saddr as Paolo suggested.
- add msk socket lock when traverse msk->conn_list as Paolo suggested.
- Since the first three patches in v5 have been merged to export branch, drop them from this patchset.
- add remove addr and subflow selftest test case.
- this patchset is against mptcp_net-next's export branch.

v5:
- merge mptcp_nl_remove_subflow() and mptcp_nl_remove_addr()
- add cond_resched
- reduce the indentation level in mptcp_pm_nl_rm_addr_received

v4:
- update mptcp_subflow_shutdown()'s args.
- add rm_id check to make sure we don't shutdown the first subflow.
- add conn_list empty check.
- move anno_list to mptcp_pm_data.
- add a new patch 'mptcp: add remove subflow support'.

v3:
- fix memory leak and lock issue in v2.
- drop alist in v2.
- fix mptcp_subflow_shutdown's arguments.
- bzero remote in mptcp_pm_create_subflow_or_signal_addr.
- add more commit message.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

Geliang Tang (8):
1/8 mptcp: remove addr and subflow in PM netlink 2/8 mptcp: fix mptcp_pm_nl_rm_addr_received logic issue 3/8 mptcp: implement mptcp_pm_remove_subflow
4/8 mptcp: fix every subflow's local_id is zero 5/8 mptcp: fix subflow's remote_id is zero issue 6/8 mptcp: add RM_ADDR related mibs
7/8 selftests: mptcp: add remove cfg in mptcp_connect 8/8 selftests: mptcp: add remove addr and subflow test cases

Thank you for the patches and the reviews!

Quoted 24 lines
Quoted 18 lines

Hi Paolo, Matt,

I want to adjust some code in this patchset.

I think patch 2/8 "mptcp: fix mptcp_pm_nl_rm_addr_received logic issue" shouldn't be here, it's better to squash-to the original commit "mptcp: add the incoming RM_ADDR support".

So I have sent out a new patch named 'Squash-to: "mptcp: add the incoming RM_ADDR support"' yesterday.

And I want to commit patch 4/8 "mptcp: fix every subflow's local_id is zero" and 5/8 "mptcp: fix subflow's remote_id is zero issue" directly to -net as Paolo suggested. Some code about subflow's remote_id fixing in the commit "mptcp:
add the incoming RM_ADDR support" should be put together in patch 5/8. So in the squash-to patch, I drop the original subflow's remote_id fixing code.

Quoted 5 lines

Please give me some suggestions about my squash-to patch.

Thanks.
-Geliang

Quoted 6 lines

Hi Matt, Paolo,

After this code adjusting, the valid patches in this "RM_ADDR support" patchset v9 are these 8 patches:

Squash-to: "mptcp: add the incoming RM_ADDR support"

Applied, see my previous message on the ML for more details.

Quoted 1 line

mptcp: remove addr and subflow in PM netlink

Applied here with Paolo's ACK.

Quoted 1 line

Squash-to: "mptcp: remove addr and subflow in PM netlink v9"

Not applied, waiting for Paolo's ACK. He will do that when this series is applied and validated by the CI

Quoted 1 line

mptcp: implement mptcp_pm_remove_subflow

Applied here but without Paolo's ACK, see below.

Quoted 1 line

Squash-to: "mptcp: implement mptcp_pm_remove_subflow v9"

I had to apply this one, required by the next patch. Because it was not ACKed by anyone on the ML so far, I didn't add any ACK here. I can add one later if needed.

Quoted 1 line

mptcp: add RM_ADDR related mibs

Applied here with Paolo's ACK.
Note that because I applied this series before the xmit one, I had to resolve two simple conflicts:

- 2c9aa6f86e74: conflict in t/mptcp-add-OoO-related-mibs

Quoted 2 lines

selftests: mptcp: add remove cfg in mptcp_connect
selftests: mptcp: add remove addr and subflow test cases

These 2 have been applied here with Paolo's ACK.

Quoted 4 lines

These 3 patches should be removed from this patchset:
mptcp: fix mptcp_pm_nl_rm_addr_received logic issue
mptcp: fix every subflow's local_id is zero
mptcp: fix subflow's remote_id is zero issue

Note that I applied the patches you sent to netdev ML for -net. So a part of them are also in the export branch.

- 377cd31c5d51..95751f085d69: results

Tests + export are queued.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net