Skip to contentSkip to conversation

MP_JOIN self-tests fixes

PATCH In review Paolo Abeni 3 participants 17 messages Mar 16, 2020 – Mar 20, 2020

Subsystems (3)
lore
Share & tools
lore

Paolo Abeni

author
#0 lore raw

cover MP_JOIN self-tests fixes

This series addresses the currently known issues in MP_JOIN self-tests.

Due to some races, without these patches I observe intermittent failures (say 1 out of 3 self-tests fail). With this patches applied, self-tests survived ~200 iterations successfully.

See individual patches for the details.

On top of "mptcp: move msk state update to subflow_syn_recv_sock()"

 net/mptcp/pm.c                                    |   40 ++++++++++++++++------
 net/mptcp/pm_netlink.c                            |   23 +++---------
 net/mptcp/protocol.c                              |    1 
 net/mptcp/protocol.h                              |    4 +-
 tools/testing/selftests/net/mptcp/mptcp_connect.c |   11 ++++--
 tools/testing/selftests/net/mptcp/mptcp_join.sh   |    8 +++-
 6 files changed, 55 insertions(+), 32 deletions(-)
author
#1 lore raw

PATCH 1/3 Squash-to: "mptcp: Implement path manager interface commands"

currently the PM events are mutually exclusive: the PM will e.g. ignore ADD_ADDR till a 'fully_established' event is completely processed.

The above can give somewhat randomic self-tests results because we sometimes do not start additional subflows as expected, because the PM workqueue is still running.

Address the above allowing the PM to process simult the currently available different kind of events.

Additionally:

- move the locking from NL PM to the pm_worker(), so that the latter will be simpler

- cancel the eventually pending PM work at socket shutdown

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/pm.c       | 40 ++++++++++++++++++++++++++++++----------
 net/mptcp/protocol.c |  1 +
 net/mptcp/protocol.h |  4 ++--
 3 files changed, 33 insertions(+), 12 deletions(-)
net/mptcp/pm.c +30 -10
index a3fe2371d41b..9af0833f1b2c 100644
@@ -64,18 +64,21 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
 	return ret;
 }
 
+/* return true if the new status bit is currenty cleared, that is, this event
+ * can be server, eventually by an already scheduled work
+ */
 static bool mptcp_pm_schedule_work(struct mptcp_sock *msk,
 				   enum mptcp_pm_status new_status)
 {
-	if (msk->pm.status != MPTCP_PM_IDLE)
+	pr_debug("msk=%p status=%x new=%lx", msk, msk->pm.status,
+		 BIT(new_status));
+	if (msk->pm.status & BIT(new_status))
 		return false;
 
-	if (queue_work(pm_wq, &msk->pm.work)) {
-		msk->pm.status = new_status;
+	msk->pm.status |= BIT(new_status);
+	if (queue_work(pm_wq, &msk->pm.work))
 		sock_hold((struct sock *)msk);
-		return true;
-	}
-	return false;
+	return true;
 }
 
 void mptcp_pm_fully_established(struct mptcp_sock *msk)
@@ -183,11 +186,22 @@ static void pm_worker(struct work_struct *work)
 	struct mptcp_sock *msk = container_of(pm, struct mptcp_sock, pm);
 	struct sock *sk = (struct sock *)msk;
 
-	switch (READ_ONCE(pm->status)) {
-	default:
-		break;
+	lock_sock(sk);
+	spin_lock_bh(&msk->pm.lock);
+
+	pr_debug("msk=%p status=%x", msk, pm->status);
+	if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) {
+		pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED);
+	}
+	if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_ESTABLISHED);
+	}
+	if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED);
 	}
 
+	spin_unlock_bh(&msk->pm.lock);
+	release_sock(sk);
 	sock_put(sk);
 }
 
@@ -201,12 +215,18 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	WRITE_ONCE(msk->pm.addr_signal, false);
 	WRITE_ONCE(msk->pm.accept_addr, false);
 	WRITE_ONCE(msk->pm.accept_subflow, false);
-	msk->pm.status = MPTCP_PM_IDLE;
+	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
 	INIT_WORK(&msk->pm.work, pm_worker);
 }
 
+void mptcp_pm_close(struct mptcp_sock *msk)
+{
+	if (cancel_work_sync(&msk->pm.work))
+		sock_put((struct sock *)msk);
+}
+
 void mptcp_pm_init(void)
 {
 	pm_wq = alloc_workqueue("pm_wq", WQ_UNBOUND | WQ_MEM_RECLAIM, 8);
net/mptcp/protocol.c +1 -0
index 6d950a46619d..c8501fdff68b 100644
@@ -815,6 +815,7 @@ static void mptcp_close(struct sock *sk, long timeout)
 	}
 
 	mptcp_cancel_work(sk);
+	mptcp_pm_close(msk);
 
 	__skb_queue_purge(&sk->sk_receive_queue);
 
net/mptcp/protocol.h +2 -2
index 8a42a35ebe8d..9a2f33f7affa 100644
@@ -102,7 +102,6 @@ struct mptcp_addr_info {
 };
 
 enum mptcp_pm_status {
-	MPTCP_PM_IDLE,
 	MPTCP_PM_ADD_ADDR_RECEIVED,
 	MPTCP_PM_ESTABLISHED,
 	MPTCP_PM_SUBFLOW_ESTABLISHED,
@@ -127,7 +126,7 @@ struct mptcp_pm_data {
 	u8		add_addr_accept_max;
 	u8		local_addr_max;
 	u8		subflows_max;
-	enum mptcp_pm_status status;
+	u8		status;
 
 	struct		work_struct work;
 };
@@ -322,6 +321,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
 
 void mptcp_pm_init(void);
 void mptcp_pm_data_init(struct mptcp_sock *msk);
+void mptcp_pm_close(struct mptcp_sock *msk);
 void mptcp_pm_new_connection(struct mptcp_sock *msk, int server_side);
 void mptcp_pm_fully_established(struct mptcp_sock *msk);
 bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
Signature · 1 line
2.21.1
author
#4 lore raw

PATCH 2/3 Squash-to: "mptcp: add netlink based PM"

In reply to Paolo Abeni

update pm netlink hook to previous patch -
locks are already held.

Additionally fixes wrong status counter update on address announcement.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 net/mptcp/pm_netlink.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)
net/mptcp/pm_netlink.c +7 -16
index d74dc813f4a6..5fb65770c0d2 100644
@@ -176,13 +176,10 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	lock_sock(sk);
-
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
-	pr_debug("local %d:%d signal %d:%d\n",
+	pr_debug("local %d:%d signal %d:%d subflows %d:%d\n",
 		 msk->pm.local_addr_used, msk->pm.local_addr_max,
-		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max);
+		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max,
+		 msk->pm.subflows, msk->pm.subflows_max);
 
 	/* check first for announce */
 	if (msk->pm.add_addr_signaled < msk->pm.add_addr_signal_max) {
@@ -190,7 +187,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 					      msk->pm.add_addr_signaled);
 
 		if (local) {
-			msk->pm.local_addr_used++;
+			msk->pm.add_addr_signaled++;
 			mptcp_pm_announce_addr(msk, &local->addr);
 		} else {
 			/* pick failed, avoid fourther attempts later */
@@ -213,7 +210,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 			spin_unlock_bh(&msk->pm.lock);
 			__mptcp_subflow_connect(sk, local->ifindex,
 						&local->addr, &remote);
-			release_sock(sk);
+			spin_lock_bh(&msk->pm.lock);
 			return;
 		}
 
@@ -221,9 +218,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 		msk->pm.local_addr_used = msk->pm.local_addr_max;
 		check_work_pending(msk);
 	}
-
-	spin_unlock_bh(&msk->pm.lock);
-	release_sock(sk);
 }
 
 void mptcp_pm_nl_fully_established(struct mptcp_sock *msk)
@@ -245,8 +239,6 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
 	pr_debug("accepted %d:%d remote family %d",
 		 msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
 		 msk->pm.remote.family);
@@ -264,11 +256,10 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 		remote.port = sk->sk_dport;
 	memset(&local, 0, sizeof(local));
 	local.family = remote.family;
-	spin_unlock_bh(&msk->pm.lock);
 
-	lock_sock(sk);
+	spin_unlock_bh(&msk->pm.lock);
 	__mptcp_subflow_connect((struct sock *)msk, 0, &local, &remote);
-	release_sock(sk);
+	spin_lock_bh(&msk->pm.lock);
 }
 
 static bool address_use_port(struct mptcp_pm_addr_entry *entry)
Signature · 1 line
2.21.1
author
#8 lore raw

PATCH 3/3 Squash-to: "selftests: add test-cases for MPTCP MP_JOIN"

In reply to Paolo Abeni

ADD_ADDR opt may be delayed till the very end of [short] MPTCP connection, so ADD_ADDR related self-tests can sometimes fail.

Leave some additional time before closing the connection, to catch this late messages

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 11 +++++++++--
 tools/testing/selftests/net/mptcp/mptcp_join.sh   |  8 ++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +9 -2
index da991a78db6b..cedee5b952ba 100644
@@ -268,7 +268,7 @@ static size_t do_rnd_write(const int fd, char *buf, const size_t len)
 
 	/* let the join handshake complete, before going on */
 	if (cfg_join && first) {
-		sleep(1);
+		usleep(200000);
 		first = false;
 	}
 
@@ -396,8 +396,11 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd)
 					break;
 
 				/* ... but we still receive.
-				 * Close our write side.
+				 * Close our write side, ev. give some time
+				 * for address notification
 				 */
+				if (cfg_join)
+					usleep(400000);
 				shutdown(peerfd, SHUT_WR);
 			} else {
 				if (errno == EINTR)
@@ -414,6 +417,10 @@ static int copyfd_io_poll(int infd, int peerfd, int outfd)
 		}
 	}
 
+	/* leave some time for late join/announce */
+	if (cfg_join)
+		usleep(400000);
+
 	close(peerfd);
 	return 0;
 }
tools/testing/selftests/net/mptcp/mptcp_join.sh +6 -2
index 6c0c1a4a86ab..dd42c2f692d0 100755
@@ -33,8 +33,9 @@ init()
 	# ns1eth1    ns2eth1
 	# ns1eth2    ns2eth2
 	# ns1eth3    ns2eth3
+	# ns1eth4    ns2eth4
 
-	for i in `seq 1 3`; do
+	for i in `seq 1 4`; do
 		ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2"
 		ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i
 		ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad
@@ -332,6 +333,9 @@ run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "signal address" 1 1 1
 
 # accept and use add_addr with an additional subflow
+# note: signal address in server ns and local addresses in client ns must
+# belong to different subnets or one of the listed local address could be
+# used for 'add_addr' subflow
 reset
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 ip netns exec $ns1 ./pm_nl_ctl limits 0 2
@@ -345,8 +349,8 @@ 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.2.2 flags subflow
 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_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "multiple subflows and signal" 3 3 3
 
Signature · 1 line
2.21.1
author
#10 lore raw
In reply to Paolo Abeni
Quoted 9 lines · Paolo Abeni

This series addresses the currently known issues in MP_JOIN self-tests.

Due to some races, without these patches I observe intermittent failures (say 1 out of 3 self-tests fail). With this patches applied, self-tests survived ~200 iterations successfully.

See individual patches for the details.

On top of "mptcp: move msk state update to subflow_syn_recv_sock()"

Just for reference, the current export branch (@1016c1ca454a2f19075f1d0c4925c35f698b6f8c) + "mptcp: move msk state update to subflow_syn_recv_sock()" + these patches is available at:

https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_10

/P

#2 lore raw

[MPTCP] Re: [PATCH v1 1/3] Squash-to: "mptcp: Implement path manager interface commands"

In reply to Paolo Abeni
Quoted 44 lines · Paolo Abeni

currently the PM events are mutually exclusive: the PM will e.g. ignore ADD_ADDR till a 'fully_established' event is completely processed.

The above can give somewhat randomic self-tests results because we sometimes do not start additional subflows as expected, because the PM workqueue is still running.

Address the above allowing the PM to process simult the currently available different kind of events.

Additionally:

- move the locking from NL PM to the pm_worker(), so that the latter will be simpler

- cancel the eventually pending PM work at socket shutdown

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

net/mptcp/pm.c       | 40 ++++++++++++++++++++++++++++++----------
net/mptcp/protocol.c |  1 +
net/mptcp/protocol.h |  4 ++--
3 files changed, 33 insertions(+), 12 deletions(-)
net/mptcp/pm.c +6 -1
index a3fe2371d41b..9af0833f1b2c 100644
@@ -64,18 +64,21 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
 	return ret;
 }
 
+/* return true if the new status bit is currenty cleared, that is, this event
+ * can be server, eventually by an already scheduled work
+ */
 static bool mptcp_pm_schedule_work(struct mptcp_sock *msk,
 				   enum mptcp_pm_status new_status)
 {
-	if (msk->pm.status != MPTCP_PM_IDLE)
+	pr_debug("msk=%p status=%x new=%lx", msk, msk->pm.status,
+		 BIT(new_status));
+	if (msk->pm.status & BIT(new_status))
 		return false;

net/mptcp/pm.c bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) · line 81

Quoted 10 lines
net/mptcp/pm.c +3 -5
 
-	if (queue_work(pm_wq, &msk->pm.work)) {
-		msk->pm.status = new_status;
+	msk->pm.status |= BIT(new_status);
+	if (queue_work(pm_wq, &msk->pm.work))
 		sock_hold((struct sock *)msk);
-		return true;
-	}
-	return false;
+	return true;

Does it make sense to skip the queue_work() call if any pm.status bits were already set, not just the one matching new_status?

Mat

Quoted 92 lines
net/mptcp/pm.c +21 -4
 }
 
 void mptcp_pm_fully_established(struct mptcp_sock *msk)
@@ -183,11 +186,22 @@ static void pm_worker(struct work_struct *work)
 	struct mptcp_sock *msk = container_of(pm, struct mptcp_sock, pm);
 	struct sock *sk = (struct sock *)msk;
 
-	switch (READ_ONCE(pm->status)) {
-	default:
-		break;
+	lock_sock(sk);
+	spin_lock_bh(&msk->pm.lock);
+
+	pr_debug("msk=%p status=%x", msk, pm->status);
+	if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) {
+		pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED);
+	}
+	if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_ESTABLISHED);
+	}
+	if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED);
 	}
 
+	spin_unlock_bh(&msk->pm.lock);
+	release_sock(sk);
 	sock_put(sk);
 }
 
@@ -201,12 +215,18 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	WRITE_ONCE(msk->pm.addr_signal, false);
 	WRITE_ONCE(msk->pm.accept_addr, false);
 	WRITE_ONCE(msk->pm.accept_subflow, false);
-	msk->pm.status = MPTCP_PM_IDLE;
+	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
 	INIT_WORK(&msk->pm.work, pm_worker);
 }
 
+void mptcp_pm_close(struct mptcp_sock *msk)
+{
+	if (cancel_work_sync(&msk->pm.work))
+		sock_put((struct sock *)msk);
+}
+
 void mptcp_pm_init(void)
 {
 	pm_wq = alloc_workqueue("pm_wq", WQ_UNBOUND | WQ_MEM_RECLAIM, 8);
net/mptcp/protocol.c +1 -0
index 6d950a46619d..c8501fdff68b 100644
@@ -815,6 +815,7 @@ static void mptcp_close(struct sock *sk, long timeout)
 	}
 
 	mptcp_cancel_work(sk);
+	mptcp_pm_close(msk);
 
 	__skb_queue_purge(&sk->sk_receive_queue);
 
net/mptcp/protocol.h +2 -2
index 8a42a35ebe8d..9a2f33f7affa 100644
@@ -102,7 +102,6 @@ struct mptcp_addr_info {
 };
 
 enum mptcp_pm_status {
-	MPTCP_PM_IDLE,
 	MPTCP_PM_ADD_ADDR_RECEIVED,
 	MPTCP_PM_ESTABLISHED,
 	MPTCP_PM_SUBFLOW_ESTABLISHED,
@@ -127,7 +126,7 @@ struct mptcp_pm_data {
 	u8		add_addr_accept_max;
 	u8		local_addr_max;
 	u8		subflows_max;
-	enum mptcp_pm_status status;
+	u8		status;
 
 	struct		work_struct work;
 };
@@ -322,6 +321,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u32 nonce1, u32 nonce2,
 
 void mptcp_pm_init(void);
 void mptcp_pm_data_init(struct mptcp_sock *msk);
+void mptcp_pm_close(struct mptcp_sock *msk);
 void mptcp_pm_new_connection(struct mptcp_sock *msk, int server_side);
 void mptcp_pm_fully_established(struct mptcp_sock *msk);
 bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);
Signature · 1 line
2.21.1

--
Mat Martineau
Intel

#3 lore raw

[MPTCP] Re: [PATCH v1 1/3] Squash-to: "mptcp: Implement path manager interface commands"

Quoted 48 lines · Mat Martineau
Quoted 46 lines · Paolo Abeni

currently the PM events are mutually exclusive: the PM will e.g. ignore ADD_ADDR till a 'fully_established' event is completely processed.

The above can give somewhat randomic self-tests results because we sometimes do not start additional subflows as expected, because the PM workqueue is still running.

Address the above allowing the PM to process simult the currently available different kind of events.

Additionally:

- move the locking from NL PM to the pm_worker(), so that the latter will be simpler

- cancel the eventually pending PM work at socket shutdown

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---

net/mptcp/pm.c       | 40 ++++++++++++++++++++++++++++++----------
net/mptcp/protocol.c |  1 +
net/mptcp/protocol.h |  4 ++--
3 files changed, 33 insertions(+), 12 deletions(-)
net/mptcp/pm.c +1 -0
index a3fe2371d41b..9af0833f1b2c 100644
@@ -64,18 +64,21 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
 	return ret;
 }
 
+/* return true if the new status bit is currenty cleared, that is, this 

event
+ * can be server, eventually by an already scheduled work
+ */
static bool mptcp_pm_schedule_work(struct mptcp_sock *msk,
enum mptcp_pm_status new_status)
{

net/mptcp/pm.c +3 -1
-	if (msk->pm.status != MPTCP_PM_IDLE)
+	pr_debug("msk=%p status=%x new=%lx", msk, msk->pm.status,
+		 BIT(new_status));
+	if (msk->pm.status & BIT(new_status))
		return false;
Quoted 13 lines

net/mptcp/pm.c bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) · line 81

Quoted 9 lines
net/mptcp/pm.c +2 -2
-	if (queue_work(pm_wq, &msk->pm.work)) {
-		msk->pm.status = new_status;
+	msk->pm.status |= BIT(new_status);
+	if (queue_work(pm_wq, &msk->pm.work))
		sock_hold((struct sock *)msk);
net/mptcp/pm.c +1 -3
-		return true;
-	}
-	return false;
+	return true;

Does it make sense to skip the queue_work() call if any pm.status bits were already set, not just the one matching new_status?

Nevermind on this one, I noticed some other behavior when looking at patch 2/3. Since pm.lock is released and reacquired while the worker is running, it does look necessary to try to queue the work even if other status bits are set. Should be ok to exit early if the bit is set (as this patch does) since each status bit is cleared before running the related function in pm_worker.

Mat

Quoted 86 lines
Quoted 86 lines

}

void mptcp_pm_fully_established(struct mptcp_sock *msk)

net/mptcp/pm.c +21 -4
@@ -183,11 +186,22 @@ static void pm_worker(struct work_struct *work)
 	struct mptcp_sock *msk = container_of(pm, struct mptcp_sock, pm);
 	struct sock *sk = (struct sock *)msk;
 
-	switch (READ_ONCE(pm->status)) {
-	default:
-		break;
+	lock_sock(sk);
+	spin_lock_bh(&msk->pm.lock);
+
+	pr_debug("msk=%p status=%x", msk, pm->status);
+	if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) {
+		pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED);
+	}
+	if (pm->status & BIT(MPTCP_PM_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_ESTABLISHED);
+	}
+	if (pm->status & BIT(MPTCP_PM_SUBFLOW_ESTABLISHED)) {
+		pm->status &= ~BIT(MPTCP_PM_SUBFLOW_ESTABLISHED);
 	}
 
+	spin_unlock_bh(&msk->pm.lock);
+	release_sock(sk);
 	sock_put(sk);
 }
 
@@ -201,12 +215,18 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	WRITE_ONCE(msk->pm.addr_signal, false);
 	WRITE_ONCE(msk->pm.accept_addr, false);
 	WRITE_ONCE(msk->pm.accept_subflow, false);
-	msk->pm.status = MPTCP_PM_IDLE;
+	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
 	INIT_WORK(&msk->pm.work, pm_worker);
 }
 
+void mptcp_pm_close(struct mptcp_sock *msk)
+{
+	if (cancel_work_sync(&msk->pm.work))
+		sock_put((struct sock *)msk);
+}
+
 void mptcp_pm_init(void)
 {
 	pm_wq = alloc_workqueue("pm_wq", WQ_UNBOUND | WQ_MEM_RECLAIM, 8);
net/mptcp/protocol.c +1 -0
index 6d950a46619d..c8501fdff68b 100644
@@ -815,6 +815,7 @@ static void mptcp_close(struct sock *sk, long timeout)
 	}
 
 	mptcp_cancel_work(sk);
+	mptcp_pm_close(msk);
 
 	__skb_queue_purge(&sk->sk_receive_queue);
 
net/mptcp/protocol.h +1 -2
index 8a42a35ebe8d..9a2f33f7affa 100644
@@ -102,7 +102,6 @@ struct mptcp_addr_info {
 };
 
 enum mptcp_pm_status {
-	MPTCP_PM_IDLE,
 	MPTCP_PM_ADD_ADDR_RECEIVED,
 	MPTCP_PM_ESTABLISHED,
 	MPTCP_PM_SUBFLOW_ESTABLISHED,
@@ -127,7 +126,7 @@ struct mptcp_pm_data {
 	u8		add_addr_accept_max;
 	u8		local_addr_max;
 	u8		subflows_max;
-	enum mptcp_pm_status status;
+	u8		status;
 
 	struct		work_struct work;
 };
@@ -322,6 +321,7 @@ void mptcp_crypto_hmac_sha(u64 key1, u64 key2, u32 
 nonce1, u32 nonce2,
 
Quoted 16 lines
Quoted 8 lines
net/mptcp/protocol.h +1 -0
 void mptcp_pm_init(void);
 void mptcp_pm_data_init(struct mptcp_sock *msk);
+void mptcp_pm_close(struct mptcp_sock *msk);
 void mptcp_pm_new_connection(struct mptcp_sock *msk, int server_side);
 void mptcp_pm_fully_established(struct mptcp_sock *msk);

bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk);

Signature · 1 line
2.21.1

--
Mat Martineau
Intel
_______________________________________________
mptcp mailing list -- mptcp(a)lists.01.org
To unsubscribe send an email to mptcp-leave(a)lists.01.org

--
Mat Martineau
Intel

#5 lore raw

[MPTCP] Re: [PATCH v1 2/3] Squash-to: "mptcp: add netlink based PM"

In reply to Paolo Abeni
Quoted 70 lines · Paolo Abeni

update pm netlink hook to previous patch -
locks are already held.

Additionally fixes wrong status counter update on address announcement.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---
net/mptcp/pm_netlink.c | 23 +++++++----------------

1 file changed, 7 insertions(+), 16 deletions(-)
net/mptcp/pm_netlink.c +5 -13
index d74dc813f4a6..5fb65770c0d2 100644
@@ -176,13 +176,10 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	lock_sock(sk);
-
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
-	pr_debug("local %d:%d signal %d:%d\n",
+	pr_debug("local %d:%d signal %d:%d subflows %d:%d\n",
 		 msk->pm.local_addr_used, msk->pm.local_addr_max,
-		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max);
+		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max,
+		 msk->pm.subflows, msk->pm.subflows_max);
 
 	/* check first for announce */
 	if (msk->pm.add_addr_signaled < msk->pm.add_addr_signal_max) {
@@ -190,7 +187,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 					      msk->pm.add_addr_signaled);
 
 		if (local) {
-			msk->pm.local_addr_used++;
+			msk->pm.add_addr_signaled++;
 			mptcp_pm_announce_addr(msk, &local->addr);
 		} else {
 			/* pick failed, avoid fourther attempts later */
@@ -213,7 +210,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 			spin_unlock_bh(&msk->pm.lock);
 			__mptcp_subflow_connect(sk, local->ifindex,
 						&local->addr, &remote);
-			release_sock(sk);
+			spin_lock_bh(&msk->pm.lock);
 			return;
 		}
 
@@ -221,9 +218,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 		msk->pm.local_addr_used = msk->pm.local_addr_max;
 		check_work_pending(msk);
 	}
-
-	spin_unlock_bh(&msk->pm.lock);
-	release_sock(sk);
 }
 
 void mptcp_pm_nl_fully_established(struct mptcp_sock *msk)
@@ -245,8 +239,6 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
 	pr_debug("accepted %d:%d remote family %d",
 		 msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
 		 msk->pm.remote.family);

net/mptcp/pm_netlink.c void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · line 262

Quoted 10 lines
net/mptcp/pm_netlink.c +2 -3
@@ -264,11 +256,10 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 		remote.port = sk->sk_dport;
 	memset(&local, 0, sizeof(local));
 	local.family = remote.family;
-	spin_unlock_bh(&msk->pm.lock);
 
-	lock_sock(sk);
+	spin_unlock_bh(&msk->pm.lock);
 	__mptcp_subflow_connect((struct sock *)msk, 0, &local, &remote);
-	release_sock(sk);
+	spin_lock_bh(&msk->pm.lock);

This last change to unlock/re-lock pm.lock does require care around setting and clearing the pm->status bits. It looks like it's possible to set a bit that gets cleared by a currently running worker, so the next run of pm_worker might find no bits set.

Should pm_worker copy and and clear pm->status once at the beginning, then use the copy to choose when to run the mptcp_pm_nl_* functions? It might behave more consistently when the worker code is reacquiring the lock.

--
Mat Martineau
Intel

#9 lore raw

[MPTCP] Re: [PATCH v1 3/3] Squash-to: "selftests: add test-cases for MPTCP MP_JOIN"

In reply to Paolo Abeni
Quoted 12 lines · Paolo Abeni

ADD_ADDR opt may be delayed till the very end of [short] MPTCP connection, so ADD_ADDR related self-tests can sometimes fail.

Leave some additional time before closing the connection, to catch this late messages

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 11 +++++++++--
tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--

2 files changed, 15 insertions(+), 4 deletions(-)

Looks good to me, thanks Paolo.

--
Mat Martineau
Intel

author
#6 lore raw

[MPTCP] Re: [PATCH v1 2/3] Squash-to: "mptcp: add netlink based PM"

In reply to Mat Martineau

Hi,

Quoted 88 lines · Mat Martineau
Quoted 70 lines · Paolo Abeni

update pm netlink hook to previous patch -
locks are already held.

Additionally fixes wrong status counter update on address announcement.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---
net/mptcp/pm_netlink.c | 23 +++++++----------------

1 file changed, 7 insertions(+), 16 deletions(-)
net/mptcp/pm_netlink.c +5 -13
index d74dc813f4a6..5fb65770c0d2 100644
@@ -176,13 +176,10 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	lock_sock(sk);
-
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
-	pr_debug("local %d:%d signal %d:%d\n",
+	pr_debug("local %d:%d signal %d:%d subflows %d:%d\n",
 		 msk->pm.local_addr_used, msk->pm.local_addr_max,
-		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max);
+		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max,
+		 msk->pm.subflows, msk->pm.subflows_max);
 
 	/* check first for announce */
 	if (msk->pm.add_addr_signaled < msk->pm.add_addr_signal_max) {
@@ -190,7 +187,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 					      msk->pm.add_addr_signaled);
 
 		if (local) {
-			msk->pm.local_addr_used++;
+			msk->pm.add_addr_signaled++;
 			mptcp_pm_announce_addr(msk, &local->addr);
 		} else {
 			/* pick failed, avoid fourther attempts later */
@@ -213,7 +210,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 			spin_unlock_bh(&msk->pm.lock);
 			__mptcp_subflow_connect(sk, local->ifindex,
 						&local->addr, &remote);
-			release_sock(sk);
+			spin_lock_bh(&msk->pm.lock);
 			return;
 		}
 
@@ -221,9 +218,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 		msk->pm.local_addr_used = msk->pm.local_addr_max;
 		check_work_pending(msk);
 	}
-
-	spin_unlock_bh(&msk->pm.lock);
-	release_sock(sk);
 }
 
 void mptcp_pm_nl_fully_established(struct mptcp_sock *msk)
@@ -245,8 +239,6 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
 	pr_debug("accepted %d:%d remote family %d",
 		 msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
 		 msk->pm.remote.family);

net/mptcp/pm_netlink.c void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · line 262

Quoted 10 lines
net/mptcp/pm_netlink.c +2 -3
@@ -264,11 +256,10 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 		remote.port = sk->sk_dport;
 	memset(&local, 0, sizeof(local));
 	local.family = remote.family;
-	spin_unlock_bh(&msk->pm.lock);
 
-	lock_sock(sk);
+	spin_unlock_bh(&msk->pm.lock);
 	__mptcp_subflow_connect((struct sock *)msk, 0, &local, &remote);
-	release_sock(sk);
+	spin_lock_bh(&msk->pm.lock);

This last change to unlock/re-lock pm.lock does require care around setting and clearing the pm->status bits. It looks like it's possible to set a bit that gets cleared by a currently running worker, so the next run of pm_worker might find no bits set.

Quoted 3 lines

Should pm_worker copy and and clear pm->status once at the beginning, then use the copy to choose when to run the mptcp_pm_nl_* functions? It might behave more consistently when the worker code is reacquiring the lock.

Thank you for the review!

I thought about the above a bit. Yes, it can happen that the PM worker is scheduled with no real work to do, but only if the requested work is is served by the an already running instance. The PM worker scheduling can happen only a few times per connections (no more than add_addr_signal_max + subflow_max), so I does not look that bad to me.

I cleared all status bit at once in previous internal iteration, but it was racy because add_addr status bit has also an associated ancillatory data (the address itself), and such iteration add_addr even were served later by the main even switch statement.

With such code the IP address data was sometime out-of-sync. I had to change the NL event callback order because - it caused also other issues, so this race should not be possible now. Still clearing the status bit non atomically with the related event callback invocation looks a bit fragile to me.

Anyhow I don't have any strong opinion here, so either options are doable for me. Whatever you prefer ;)

Thanks,

Paolo

#7 lore raw

[MPTCP] Re: [PATCH v1 2/3] Squash-to: "mptcp: add netlink based PM"

Quoted 108 lines · Paolo Abeni

Hi,

Quoted 88 lines · Mat Martineau
Quoted 70 lines · Paolo Abeni

update pm netlink hook to previous patch -
locks are already held.

Additionally fixes wrong status counter update on address announcement.

Signed-off-by Paolo Abeni <pabeni(a)redhat.com>

---
net/mptcp/pm_netlink.c | 23 +++++++----------------

1 file changed, 7 insertions(+), 16 deletions(-)
net/mptcp/pm_netlink.c +5 -13
index d74dc813f4a6..5fb65770c0d2 100644
@@ -176,13 +176,10 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	lock_sock(sk);
-
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
-	pr_debug("local %d:%d signal %d:%d\n",
+	pr_debug("local %d:%d signal %d:%d subflows %d:%d\n",
 		 msk->pm.local_addr_used, msk->pm.local_addr_max,
-		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max);
+		 msk->pm.add_addr_signaled, msk->pm.add_addr_signal_max,
+		 msk->pm.subflows, msk->pm.subflows_max);
 
 	/* check first for announce */
 	if (msk->pm.add_addr_signaled < msk->pm.add_addr_signal_max) {
@@ -190,7 +187,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 					      msk->pm.add_addr_signaled);
 
 		if (local) {
-			msk->pm.local_addr_used++;
+			msk->pm.add_addr_signaled++;
 			mptcp_pm_announce_addr(msk, &local->addr);
 		} else {
 			/* pick failed, avoid fourther attempts later */
@@ -213,7 +210,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 			spin_unlock_bh(&msk->pm.lock);
 			__mptcp_subflow_connect(sk, local->ifindex,
 						&local->addr, &remote);
-			release_sock(sk);
+			spin_lock_bh(&msk->pm.lock);
 			return;
 		}
 
@@ -221,9 +218,6 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 		msk->pm.local_addr_used = msk->pm.local_addr_max;
 		check_work_pending(msk);
 	}
-
-	spin_unlock_bh(&msk->pm.lock);
-	release_sock(sk);
 }
 
 void mptcp_pm_nl_fully_established(struct mptcp_sock *msk)
@@ -245,8 +239,6 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 
 	pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
-	spin_lock_bh(&msk->pm.lock);
-	msk->pm.status = MPTCP_PM_IDLE;
 	pr_debug("accepted %d:%d remote family %d",
 		 msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
 		 msk->pm.remote.family);

net/mptcp/pm_netlink.c void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · line 262

Quoted 10 lines
net/mptcp/pm_netlink.c +2 -3
@@ -264,11 +256,10 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
 		remote.port = sk->sk_dport;
 	memset(&local, 0, sizeof(local));
 	local.family = remote.family;
-	spin_unlock_bh(&msk->pm.lock);
 
-	lock_sock(sk);
+	spin_unlock_bh(&msk->pm.lock);
 	__mptcp_subflow_connect((struct sock *)msk, 0, &local, &remote);
-	release_sock(sk);
+	spin_lock_bh(&msk->pm.lock);

This last change to unlock/re-lock pm.lock does require care around setting and clearing the pm->status bits. It looks like it's possible to set a bit that gets cleared by a currently running worker, so the next run of pm_worker might find no bits set.

Quoted 3 lines

Should pm_worker copy and and clear pm->status once at the beginning, then use the copy to choose when to run the mptcp_pm_nl_* functions? It might behave more consistently when the worker code is reacquiring the lock.

Thank you for the review!

I thought about the above a bit. Yes, it can happen that the PM worker is scheduled with no real work to do, but only if the requested work is is served by the an already running instance. The PM worker scheduling can happen only a few times per connections (no more than add_addr_signal_max + subflow_max), so I does not look that bad to me.

I cleared all status bit at once in previous internal iteration, but it was racy because add_addr status bit has also an associated ancillatory data (the address itself), and such iteration add_addr even were served later by the main even switch statement.

Quoted 9 lines

With such code the IP address data was sometime out-of-sync. I had to change the NL event callback order because - it caused also other issues, so this race should not be possible now. Still clearing the status bit non atomically with the related event callback invocation looks a bit fragile to me.

Anyhow I don't have any strong opinion here, so either options are doable for me. Whatever you prefer ;)

Thanks for the background and IRC discussion. The address sync issue would be a bigger problem, so the patch is fine as-is.

--
Mat Martineau
Intel

#11 lore raw
In reply to Paolo Abeni

Hi Paolo, Mat,

Quoted 9 lines · Paolo Abeni
Quoted 8 lines · Paolo Abeni

This series addresses the currently known issues in MP_JOIN self-tests.

Due to some races, without these patches I observe intermittent failures (say 1 out of 3 self-tests fail). With this patches applied, self-tests survived ~200 iterations successfully.

See individual patches for the details.

Quoted 7 lines
Quoted 1 line

On top of "mptcp: move msk state update to subflow_syn_recv_sock()"

Just for reference, the current export branch (@1016c1ca454a2f19075f1d0c4925c35f698b6f8c) + "mptcp: move msk state update to subflow_syn_recv_sock()" + these patches is available at:

https://github.com/pabeni/mptcp/tree/mptcp_net-next_part3_10

Thank you for the patches and the reviews!

- c4615f515b41: "squashed" patch 1/3 in "mptcp: Implement path manager interface commands"
- 5257c21d9804: conflict in t/mptcp-implement-and-use-MPTCP-level-retransmission
- b2fc8ed9ca5f: conflict in t/mptcp-add-netlink-based-PM
- ca158067259a..ef5d4d25c399: result

- a49945862c4d: "squashed" patch 2/3 in "mptcp: add netlink based PM"
- ef5d4d25c399..152845a286fa: result

- 89d9a90d57ec: "squashed" patch 3/3 in "selftests: add test-cases for MPTCP MP_JOIN"
- 152845a286fa..6854e267eb38: result

Tests + export are in progress.

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
#12 lore raw

On 19/03/2020 18:58, Matthieu Baerts wrote:> On 16/03/2020 19:06, Paolo Abeni wrote:

(...)

Quoted 9 lines

Thank you for the patches and the reviews!

- c4615f515b41: "squashed" patch 1/3 in "mptcp: Implement path manager interface commands"
- 5257c21d9804: conflict in t/mptcp-implement-and-use-MPTCP-level-retransmission
- b2fc8ed9ca5f: conflict in t/mptcp-add-netlink-based-PM
- ca158067259a..ef5d4d25c399: result

Quoted 8 lines

- a49945862c4d: "squashed" patch 2/3 in "mptcp: add netlink based PM"
- ef5d4d25c399..152845a286fa: result

- 89d9a90d57ec: "squashed" patch 3/3 in "selftests: add test-cases for MPTCP MP_JOIN"
- 152845a286fa..6854e267eb38: result

Tests + export are in progress.

I don't know if it is because of this series of the previous one (I didn't validate the ADD_ADDRv1 series because of the compilation errors without IPv6) but MP-JOIN selftests are not passing:

00:22:33.510 # selftests: net/mptcp: mptcp_join.sh
00:22:33.722 [ 26.953791] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:33.779 [ 27.011063] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:33.841 [ 27.072725] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:33.907 [ 27.139205] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:33.921 # Created /tmp/tmp.yIjoftdzHL (size 1 KB) containing data sent by client
00:22:33.925 # Created /tmp/tmp.g2BhjAKKbf (size 1 KB) containing data sent by server
00:22:34.691 [ 27.923132] IPv6: ADDRCONF(NETDEV_CHANGE): ns2eth1: link
becomes ready
00:22:35.978 # no JOIN syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:36.234 [ 29.465784] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:36.296 [ 29.527773] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:36.354 [ 29.585653] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:36.412 [ 29.644095] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:38.459 # single subflow, limited by client syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:38.668 [ 31.900196] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:38.725 [ 31.956627] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:38.782 [ 32.013611] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:38.839 [ 32.070715] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:40.905 # single subflow, limited by server syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:41.117 [ 34.348346] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:41.173 [ 34.405189] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:41.233 [ 34.464508] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:41.292 [ 34.524131] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:43.361 # single subflow syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:43.607 [ 36.839063] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:43.677 [ 36.908825] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:43.743 [ 36.974974] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:43.809 [ 37.040564] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:45.879 # multiple subflows syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:46.096 [ 39.327374] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:46.153 [ 39.384462] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:46.206 [ 39.438371] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:46.274 [ 39.505456] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:48.352 # multiple subflows, limited by server syn[ ok ] - synack[ ok ] - ack[ ok ]
00:22:48.563 [ 41.794844] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:48.619 [ 41.851245] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:48.683 [ 41.914516] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:48.747 [ 41.978538] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:50.798 # unused signal address syn[ ok ] - synack[
ok ] - ack[ ok ]
00:22:51.015 [ 44.246727] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:51.070 [ 44.302315] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:51.127 [ 44.358752] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:51.184 [ 44.416240] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:53.248 # signal address syn[fail] got 0
JOIN[s] syn expected 1
00:22:53.263 # - synack[fail] got 0 JOIN[s] synack expected 1 00:22:53.278 # - ack[fail] got 0 JOIN[s] ack expected 1 00:22:53.293 # Server ns stats

00:22:53.306 # MPTcpExtMPCapableSYNRX          1                  0.0
00:22:53.307 # MPTcpExtMPCapableACKRX          1                  0.0

00:22:53.308 # Client ns stats
00:22:53.493 [ 46.725253] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:53.554 [ 46.786174] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:53.616 [ 46.848379] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:53.675 [ 46.907186] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:55.752 # subflow and signal syn[fail] got 1
JOIN[s] syn expected 2
00:22:55.768 # - synack[fail] got 1 JOIN[s] synack expected 2 00:22:55.783 # - ack[fail] got 1 JOIN[s] ack expected 2 00:22:55.798 # Server ns stats

00:22:55.811 # MPTcpExtMPCapableSYNRX          1                  0.0
00:22:55.811 # MPTcpExtMPCapableACKRX          1                  0.0
00:22:55.812 # MPTcpExtMPJoinSynRx             1                  0.0
00:22:55.813 # MPTcpExtMPJoinAckRx             1                  0.0

00:22:55.814 # Client ns stats
00:22:55.830 # MPTcpExtMPJoinSynAckRx 1 0.0
00:22:56.007 [ 49.238474] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth1: link
becomes ready
00:22:56.065 [ 49.296800] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth2: link
becomes ready
00:22:56.128 [ 49.359657] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth3: link
becomes ready
00:22:56.191 [ 49.422532] IPv6: ADDRCONF(NETDEV_CHANGE): ns1eth4: link
becomes ready
00:22:58.275 # multiple subflows and signal syn[fail] got 2
JOIN[s] syn expected 3
00:22:58.290 # - synack[fail] got 2 JOIN[s] synack expected 3 00:22:58.305 # - ack[fail] got 2 JOIN[s] ack expected 3 00:22:58.320 # Server ns stats

00:22:58.334 # MPTcpExtMPCapableSYNRX          1                  0.0
00:22:58.335 # MPTcpExtMPCapableACKRX          1                  0.0
00:22:58.335 # MPTcpExtMPJoinSynRx             2                  0.0
00:22:58.336 # MPTcpExtMPJoinAckRx             2                  0.0

00:22:58.337 # Client ns stats
00:22:58.351 # MPTcpExtMPJoinSynAckRx 2 0.0
00:22:58.379 not ok 3 selftests: net/mptcp: mptcp_join.sh # exit=1

Cheers,
Matt

Signature · 5 lines
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
author
#13 lore raw
Quoted 21 lines · Matthieu Baerts

On 19/03/2020 18:58, Matthieu Baerts wrote:> On 16/03/2020 19:06, Paolo Abeni wrote:

(...)

Quoted 16 lines

Thank you for the patches and the reviews!

- c4615f515b41: "squashed" patch 1/3 in "mptcp: Implement path manager interface commands"
- 5257c21d9804: conflict in t/mptcp-implement-and-use-MPTCP-level-retransmission
- b2fc8ed9ca5f: conflict in t/mptcp-add-netlink-based-PM
- ca158067259a..ef5d4d25c399: result

- a49945862c4d: "squashed" patch 2/3 in "mptcp: add netlink based PM"
- ef5d4d25c399..152845a286fa: result

- 89d9a90d57ec: "squashed" patch 3/3 in "selftests: add test-cases for MPTCP MP_JOIN"
- 152845a286fa..6854e267eb38: result

Quoted 5 lines
Quoted 1 line

Tests + export are in progress.

I don't know if it is because of this series of the previous one (I didn't validate the ADD_ADDRv1 series because of the compilation errors without IPv6) but MP-JOIN selftests are not passing:

[...]

I think it's due to:

mptcp: v1 ADD_ADDR changes: options and parsing

which stripped (I think unintentionally) a couple of:

	 mp_opt->add_addr = 1;

so the client never get notifed of incoming address

Also, with a quick too into the captured pcap trace, I think the ipv4 address inside add_Addr option is not initialized.

I'll try to double check.

/P

author
#14 lore raw
Quoted 4 lines · Paolo Abeni

Also, with a quick too into the captured pcap trace, I think the ipv4 address inside add_Addr option is not initialized.

I'll try to double check.

Nope, it's just a wireshark bug (it looks like there is no correct mptcp v1 add_addr support in wireshark, but that is a topic for later). I'll cook a patch for the missing add_addr.

Cheers,

Paolo

author
#15 lore raw
Quoted 9 lines · Paolo Abeni
Quoted 4 lines · Paolo Abeni

Also, with a quick too into the captured pcap trace, I think the ipv4 address inside add_Addr option is not initialized.

I'll try to double check.

Nope, it's just a wireshark bug (it looks like there is no correct mptcp v1 add_addr support in wireshark, but that is a topic for later). I'll cook a patch for the missing add_addr.

Uhm... the above it's not enough, as add_addr validation sometimes fails (wrong ahmac). Still investigating...

/P

author
#16 lore raw
In reply to Paolo Abeni
Quoted 8 lines · Paolo Abeni
Quoted 4 lines · Paolo Abeni

Also, with a quick too into the captured pcap trace, I think the ipv4 address inside add_Addr option is not initialized.

I'll try to double check.

Nope, it's just a wireshark bug (it looks like there is no correct mptcp v1 add_addr support in wireshark, but that is a topic for later).

Well, actually such support is already there, thanks to Peter! my local wireshark build was a bit outdated.

Many thanks, Peter!

/P