Skip to contentSkip to conversation

add ADD_ADDR echo flag support

PATCH Superseded Geliang Tang 2 participants 5 messages Aug 19, 2020 – Aug 20, 2020

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

v4 cover add ADD_ADDR echo flag support

v4:
- Just updated some log messages in mptcp_join.sh

v3:
- move add_addr_echo into mptcp_pm_announce_addr()
- check return value of mptcp_pm_add_add_received
- hold lock for add_addr_echo writing

v2:
- add ADD_ADDR mibs
- add selftests for ADD_ADDR

v1:
- mptcp: send out ADD_ADDR with echo flag

Geliang Tang (3):
mptcp: send out ADD_ADDR with echo flag
mptcp: add ADD_ADDR related mibs
selftests: mptcp: add ADD_ADDR mibs check function

 net/mptcp/mib.c                               |  2 +
 net/mptcp/mib.h                               |  2 +
 net/mptcp/options.c                           | 38 +++++++++++-----
 net/mptcp/pm.c                                | 13 ++++--
 net/mptcp/pm_netlink.c                        |  2 +-
 net/mptcp/protocol.h                          |  8 ++--
 .../testing/selftests/net/mptcp/mptcp_join.sh | 44 +++++++++++++++++++
 7 files changed, 89 insertions(+), 20 deletions(-)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v4 1/3 mptcp: send out ADD_ADDR with echo flag

When the ADD_ADDR suboption has been received, we need to send out the same ADD_ADDR suboption with echo-flag=1, and no HMAC.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/options.c    | 34 ++++++++++++++++++++++------------
 net/mptcp/pm.c         | 13 +++++++++----
 net/mptcp/pm_netlink.c |  2 +-
 net/mptcp/protocol.h   |  8 +++++---
 4 files changed, 37 insertions(+), 20 deletions(-)
net/mptcp/options.c +22 -12
index a52a05effac9..f91238ff3200 100644
@@ -242,7 +242,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		mp_opt->add_addr = 1;
 		mp_opt->port = 0;
 		mp_opt->addr_id = *ptr++;
-		pr_debug("ADD_ADDR: id=%d", mp_opt->addr_id);
+		pr_debug("ADD_ADDR: id=%d, echo=%d", mp_opt->addr_id, mp_opt->echo);
 		if (mp_opt->family == MPTCP_ADDR_IPVERSION_4) {
 			memcpy((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr, 4);
 			ptr += 4;
@@ -579,6 +579,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk,
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
 	struct mptcp_addr_info saddr;
+	bool echo = READ_ONCE(msk->pm.add_addr_echo);
 	int len;
 
 	if (!mptcp_pm_should_add_signal(msk) ||
@@ -594,22 +595,26 @@ static bool mptcp_established_options_add_addr(struct sock *sk,
 	if (saddr.family == AF_INET) {
 		opts->suboptions |= OPTION_MPTCP_ADD_ADDR;
 		opts->addr = saddr.addr;
-		opts->ahmac = add_addr_generate_hmac(msk->local_key,
-						     msk->remote_key,
-						     opts->addr_id,
-						     &opts->addr);
+		if (!echo) {
+			opts->ahmac = add_addr_generate_hmac(msk->local_key,
+							     msk->remote_key,
+							     opts->addr_id,
+							     &opts->addr);
+		}
 	}
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 	else if (saddr.family == AF_INET6) {
 		opts->suboptions |= OPTION_MPTCP_ADD_ADDR6;
 		opts->addr6 = saddr.addr6;
-		opts->ahmac = add_addr6_generate_hmac(msk->local_key,
-						      msk->remote_key,
-						      opts->addr_id,
-						      &opts->addr6);
+		if (!echo) {
+			opts->ahmac = add_addr6_generate_hmac(msk->local_key,
+							      msk->remote_key,
+							      opts->addr_id,
+							      &opts->addr6);
+		}
 	}
 #endif
-	pr_debug("addr_id=%d, ahmac=%llu", opts->addr_id, opts->ahmac);
+	pr_debug("addr_id=%d, ahmac=%llu, echo=%d", opts->addr_id, opts->ahmac, echo);
 
 	return true;
 }
@@ -883,8 +888,13 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 			addr.addr6 = mp_opt.addr6;
 		}
 #endif
-		if (!mp_opt.echo)
-			mptcp_pm_add_addr_received(msk, &addr);
+		if (!mp_opt.echo) {
+			if (!mptcp_pm_add_addr_received(msk, &addr)) {
+				spin_lock_bh(&msk->pm.lock);
+				mptcp_pm_announce_addr(msk, &addr, true);
+				spin_unlock_bh(&msk->pm.lock);
+			}
+		}
 		mp_opt.add_addr = 0;
 	}
 
net/mptcp/pm.c +9 -4
index 558462d87eb3..27662d795b9a 100644
@@ -13,11 +13,13 @@
 /* path manager command handlers */
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
-			   const struct mptcp_addr_info *addr)
+			   const struct mptcp_addr_info *addr,
+			   bool echo)
 {
 	pr_debug("msk=%p, local_id=%d", msk, addr->id);
 
 	msk->pm.local = *addr;
+	WRITE_ONCE(msk->pm.add_addr_echo, echo);
 	WRITE_ONCE(msk->pm.add_addr_signal, true);
 	return 0;
 }
@@ -127,8 +129,8 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id)
 	pr_debug("msk=%p", msk);
 }
 
-void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
-				const struct mptcp_addr_info *addr)
+int mptcp_pm_add_addr_received(struct mptcp_sock *msk,
+			       const struct mptcp_addr_info *addr)
 {
 	struct mptcp_pm_data *pm = &msk->pm;
 
@@ -137,7 +139,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 
 	/* avoid acquiring the lock if there is no room for fouther addresses */
 	if (!READ_ONCE(pm->accept_addr))
-		return;
+		return -EINVAL;
 
 	spin_lock_bh(&pm->lock);
 
@@ -147,6 +149,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 		pm->remote = *addr;
 
 	spin_unlock_bh(&pm->lock);
+
+	return 0;
 }
 
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id)
@@ -226,6 +230,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	WRITE_ONCE(msk->pm.rm_addr_signal, false);
 	WRITE_ONCE(msk->pm.accept_addr, false);
 	WRITE_ONCE(msk->pm.accept_subflow, false);
+	WRITE_ONCE(msk->pm.add_addr_echo, false);
 	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
net/mptcp/pm_netlink.c +1 -1
index ad7232a1d9f1..d3e57573c307 100644
@@ -188,7 +188,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 		if (local) {
 			msk->pm.add_addr_signaled++;
-			mptcp_pm_announce_addr(msk, &local->addr);
+			mptcp_pm_announce_addr(msk, &local->addr, false);
 		} else {
 			/* pick failed, avoid fourther attempts later */
 			msk->pm.local_addr_used = msk->pm.add_addr_signal_max;
net/mptcp/protocol.h +5 -3
index 4b8a5308aeed..4a73d0526f06 100644
@@ -169,6 +169,7 @@ struct mptcp_pm_data {
 	bool		work_pending;
 	bool		accept_addr;
 	bool		accept_subflow;
+	bool		add_addr_echo;
 	u8		add_addr_signaled;
 	u8		add_addr_accepted;
 	u8		local_addr_used;
@@ -438,12 +439,13 @@ void mptcp_pm_connection_closed(struct mptcp_sock *msk);
 void mptcp_pm_subflow_established(struct mptcp_sock *msk,
 				  struct mptcp_subflow_context *subflow);
 void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);
-void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
-				const struct mptcp_addr_info *addr);
+int mptcp_pm_add_addr_received(struct mptcp_sock *msk,
+			       const struct mptcp_addr_info *addr);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
-			   const struct mptcp_addr_info *addr);
+			   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);
 
Signature · 1 line
2.17.1
#2 lore raw

[MPTCP] Re: [MPTCP][PATCH v4 mptcp-next 1/3] mptcp: send out ADD_ADDR with echo flag

Quoted 25 lines · Geliang Tang

When the ADD_ADDR suboption has been received, we need to send out the same ADD_ADDR suboption with echo-flag=1, and no HMAC.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>

---

net/mptcp/options.c    | 34 ++++++++++++++++++++++------------
net/mptcp/pm.c         | 13 +++++++++----
net/mptcp/pm_netlink.c |  2 +-
net/mptcp/protocol.h   |  8 +++++---
4 files changed, 37 insertions(+), 20 deletions(-)
net/mptcp/options.c +1 -1
index a52a05effac9..f91238ff3200 100644
@@ -242,7 +242,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
 		mp_opt->add_addr = 1;
 		mp_opt->port = 0;
 		mp_opt->addr_id = *ptr++;
-		pr_debug("ADD_ADDR: id=%d", mp_opt->addr_id);
+		pr_debug("ADD_ADDR: id=%d, echo=%d", mp_opt->addr_id, mp_opt->echo);
 		if (mp_opt->family == MPTCP_ADDR_IPVERSION_4) {
 			memcpy((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr, 4);
 			ptr += 4;

net/mptcp/options.c static bool mptcp_established_options_add_addr(struct sock *sk, · line 582

Quoted 4 lines
net/mptcp/options.c +1 -0
@@ -579,6 +579,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk,
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
 	struct mptcp_sock *msk = mptcp_sk(subflow->conn);
 	struct mptcp_addr_info saddr;
+	bool echo = READ_ONCE(msk->pm.add_addr_echo);

Still think that msk->pm.add_addr_echo should be accessed inside mptcp_pm_add_addr_signal(), so it is read with the pm lock held. Do it right before or after the "*saddr = msk->pm.local;" line in mptcp_pm_add_addr_signal().

Quoted 40 lines
net/mptcp/options.c +13 -9
 	int len;
 
 	if (!mptcp_pm_should_add_signal(msk) ||
@@ -594,22 +595,26 @@ static bool mptcp_established_options_add_addr(struct sock *sk,
 	if (saddr.family == AF_INET) {
 		opts->suboptions |= OPTION_MPTCP_ADD_ADDR;
 		opts->addr = saddr.addr;
-		opts->ahmac = add_addr_generate_hmac(msk->local_key,
-						     msk->remote_key,
-						     opts->addr_id,
-						     &opts->addr);
+		if (!echo) {
+			opts->ahmac = add_addr_generate_hmac(msk->local_key,
+							     msk->remote_key,
+							     opts->addr_id,
+							     &opts->addr);
+		}
 	}
 #if IS_ENABLED(CONFIG_MPTCP_IPV6)
 	else if (saddr.family == AF_INET6) {
 		opts->suboptions |= OPTION_MPTCP_ADD_ADDR6;
 		opts->addr6 = saddr.addr6;
-		opts->ahmac = add_addr6_generate_hmac(msk->local_key,
-						      msk->remote_key,
-						      opts->addr_id,
-						      &opts->addr6);
+		if (!echo) {
+			opts->ahmac = add_addr6_generate_hmac(msk->local_key,
+							      msk->remote_key,
+							      opts->addr_id,
+							      &opts->addr6);
+		}
 	}
 #endif
-	pr_debug("addr_id=%d, ahmac=%llu", opts->addr_id, opts->ahmac);
+	pr_debug("addr_id=%d, ahmac=%llu, echo=%d", opts->addr_id, opts->ahmac, echo);
 
 	return true;
 }

net/mptcp/options.c void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb, · line 894

Quoted 9 lines
net/mptcp/options.c +4 -2
@@ -883,8 +888,13 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 			addr.addr6 = mp_opt.addr6;
 		}
 #endif
-		if (!mp_opt.echo)
-			mptcp_pm_add_addr_received(msk, &addr);
+		if (!mp_opt.echo) {
+			if (!mptcp_pm_add_addr_received(msk, &addr)) {
+				spin_lock_bh(&msk->pm.lock);
+				mptcp_pm_announce_addr(msk, &addr, true);

Call this from mptcp_pm_nl_add_addr_received(), since that is the point where the ADD_ADDR has been fully processed.

Some other changes in mptcp_pm_add_addr_received() are needed if the call to mptcp_pm_announce_addr() is moved. If pm->accept_addr is false in mptcp_pm_add_addr_received(), then the pm worker is not scheduled and mptcp_pm_nl_add_addr_received() won't run. The ADD_ADDR should probably still be echoed so the peer doesn't keep sending it. I suggest removing the first check of pm->accept_addr (the one without the lock held) in mptcp_pm_add_addr_received(), and then call mptcp_pm_announce_addr() to send the echo there in the !pm->accept_addr case.

Mat

Quoted 106 lines
net/mptcp/options.c +3 -0
+				spin_unlock_bh(&msk->pm.lock);
+			}
+		}
 		mp_opt.add_addr = 0;
 	}
 
net/mptcp/pm.c +9 -4
index 558462d87eb3..27662d795b9a 100644
@@ -13,11 +13,13 @@
 /* path manager command handlers */
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
-			   const struct mptcp_addr_info *addr)
+			   const struct mptcp_addr_info *addr,
+			   bool echo)
 {
 	pr_debug("msk=%p, local_id=%d", msk, addr->id);
 
 	msk->pm.local = *addr;
+	WRITE_ONCE(msk->pm.add_addr_echo, echo);
 	WRITE_ONCE(msk->pm.add_addr_signal, true);
 	return 0;
 }
@@ -127,8 +129,8 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id)
 	pr_debug("msk=%p", msk);
 }
 
-void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
-				const struct mptcp_addr_info *addr)
+int mptcp_pm_add_addr_received(struct mptcp_sock *msk,
+			       const struct mptcp_addr_info *addr)
 {
 	struct mptcp_pm_data *pm = &msk->pm;
 
@@ -137,7 +139,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 
 	/* avoid acquiring the lock if there is no room for fouther addresses */
 	if (!READ_ONCE(pm->accept_addr))
-		return;
+		return -EINVAL;
 
 	spin_lock_bh(&pm->lock);
 
@@ -147,6 +149,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 		pm->remote = *addr;
 
 	spin_unlock_bh(&pm->lock);
+
+	return 0;
 }
 
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id)
@@ -226,6 +230,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk)
 	WRITE_ONCE(msk->pm.rm_addr_signal, false);
 	WRITE_ONCE(msk->pm.accept_addr, false);
 	WRITE_ONCE(msk->pm.accept_subflow, false);
+	WRITE_ONCE(msk->pm.add_addr_echo, false);
 	msk->pm.status = 0;
 
 	spin_lock_init(&msk->pm.lock);
net/mptcp/pm_netlink.c +1 -1
index ad7232a1d9f1..d3e57573c307 100644
@@ -188,7 +188,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 
 		if (local) {
 			msk->pm.add_addr_signaled++;
-			mptcp_pm_announce_addr(msk, &local->addr);
+			mptcp_pm_announce_addr(msk, &local->addr, false);
 		} else {
 			/* pick failed, avoid fourther attempts later */
 			msk->pm.local_addr_used = msk->pm.add_addr_signal_max;
net/mptcp/protocol.h +5 -3
index 4b8a5308aeed..4a73d0526f06 100644
@@ -169,6 +169,7 @@ struct mptcp_pm_data {
 	bool		work_pending;
 	bool		accept_addr;
 	bool		accept_subflow;
+	bool		add_addr_echo;
 	u8		add_addr_signaled;
 	u8		add_addr_accepted;
 	u8		local_addr_used;
@@ -438,12 +439,13 @@ void mptcp_pm_connection_closed(struct mptcp_sock *msk);
 void mptcp_pm_subflow_established(struct mptcp_sock *msk,
 				  struct mptcp_subflow_context *subflow);
 void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);
-void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
-				const struct mptcp_addr_info *addr);
+int mptcp_pm_add_addr_received(struct mptcp_sock *msk,
+			       const struct mptcp_addr_info *addr);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
 
 int mptcp_pm_announce_addr(struct mptcp_sock *msk,
-			   const struct mptcp_addr_info *addr);
+			   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);
 
Signature · 1 line
2.17.1

--
Mat Martineau
Intel

author
#3 lore raw

PATCH v4 2/3 mptcp: add ADD_ADDR related mibs

In reply to Geliang Tang

This patch added two mibs for ADD_ADDR, MPTCP_MIB_ADDADDR for receiving of the ADD_ADDR suboption with echo-flag=0, and MPTCP_MIB_ECHOADD for receiving the ADD_ADDR suboption with echo-flag=1.

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/mib.c     | 2 ++
 net/mptcp/mib.h     | 2 ++
 net/mptcp/options.c | 4 ++++
 3 files changed, 8 insertions(+)
net/mptcp/mib.c +2 -0
index 056986c7a228..a33bf719ce6f 100644
@@ -27,6 +27,8 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("OFOMerge", MPTCP_MIB_OFOMERGE),
 	SNMP_MIB_ITEM("NoDSSInWindow", MPTCP_MIB_NODSSWINDOW),
 	SNMP_MIB_ITEM("DuplicateData", MPTCP_MIB_DUPDATA),
+	SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
+	SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
 	SNMP_MIB_SENTINEL
 };
 
net/mptcp/mib.h +2 -0
index 937a177729f1..cdeea3732ddf 100644
@@ -20,6 +20,8 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_OFOMERGE,		/* Segments merged in OoO queue */
 	MPTCP_MIB_NODSSWINDOW,		/* Segments not in MPTCP windows */
 	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_MAX
 };
 
net/mptcp/options.c +4 -0
index f91238ff3200..26a5536363bb 100644
@@ -11,6 +11,7 @@
 #include <net/tcp.h>
 #include <net/mptcp.h>
 #include "protocol.h"
+#include "mib.h"
 
 static bool mptcp_cap_flag_sha256(u8 flags)
 {
@@ -893,7 +894,10 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
 				spin_lock_bh(&msk->pm.lock);
 				mptcp_pm_announce_addr(msk, &addr, true);
 				spin_unlock_bh(&msk->pm.lock);
+				__MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR);
 			}
+		} else {
+			__MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADD);
 		}
 		mp_opt.add_addr = 0;
 	}
Signature · 1 line
2.17.1
author
#4 lore raw

PATCH v4 3/3 selftests: mptcp: add ADD_ADDR mibs check function

In reply to Geliang Tang

This patch added the ADD_ADDR related mibs counter check function chk_add_nr(). This function check both ADD_ADDR and ADD_ADDR with echo flag.

The output looks like this:

07 unused signal address syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
08 signal address syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
09 subflow and signal syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
10 multiple subflows and signal syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]
11 remove subflow and signal syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ]

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +44 -0
index f39c1129ce5f..58fab4cf150d 100755
@@ -276,6 +276,43 @@ chk_join_nr()
 	fi
 }
 
+chk_add_nr()
+{
+	local add_nr=$1
+	local echo_nr=$2
+	local count
+	local dump_stats
+
+	printf "%-39s %s" " " "add"
+	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$add_nr" ]; then
+		echo "[fail] got $count ADD_ADDR[s] expected $add_nr"
+		ret=1
+		dump_stats=1
+	else
+		echo -n "[ ok ]"
+	fi
+
+	echo -n " - echo  "
+	count=`ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{print $2}'`
+	[ -z "$count" ] && count=0
+	if [ "$count" != "$echo_nr" ]; then
+		echo "[fail] got $count ADD_ADDR echo[s] expected $echo_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)
@@ -332,6 +369,7 @@ reset
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "unused signal address" 0 0 0
+chk_add_nr 0 0
 
 # accept and use add_addr
 reset
@@ -340,6 +378,7 @@ ip netns exec $ns2 ./pm_nl_ctl limits 1 1
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "signal address" 1 1 1
+chk_add_nr 1 1
 
 # accept and use add_addr with an additional subflow
 # note: signal address in server ns and local addresses in client ns must
@@ -352,6 +391,7 @@ 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_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "subflow and signal" 2 2 2
+chk_add_nr 1 1
 
 # accept and use add_addr with additional subflows
 reset
@@ -362,6 +402,7 @@ 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
+chk_add_nr 1 1
 
 # single subflow, syncookies
 reset_with_cookies
@@ -396,6 +437,7 @@ ip netns exec $ns2 ./pm_nl_ctl limits 1 1
 ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
 run_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "signal address with syn cookies" 1 1 1
+chk_add_nr 1 1
 
 # test cookie with subflow and signal
 reset_with_cookies
@@ -405,6 +447,7 @@ 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_tests $ns1 $ns2 10.0.1.1
 chk_join_nr "subflow and signal w cookies" 2 2 2
+chk_add_nr 1 1
 
 # accept and use add_addr with additional subflows
 reset_with_cookies
@@ -415,5 +458,6 @@ 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 "subflows and signal w. cookies" 3 3 3
+chk_add_nr 1 1
 
 exit $ret
Signature · 1 line
2.17.1