Skip to contentSkip to conversation

Squash to "ADD_ADDR: ports support v3"

PATCH In review Geliang Tang 2 participants 8 messages Nov 8, 2020 – Nov 10, 2020

Subsystems (3)
lore
Share & tools
lore

Geliang Tang

author
#0 lore raw

cover Squash to "ADD_ADDR: ports support v3"

This patchset includes three squash-to patches and a new patch. They all should be squashed into the "ADD_ADDR: ports support" series.

All three squash-to patches's commit massages need to be updated.

The new patch should be inserted into the patchset after the 8th patch "mptcp: print out port and ahmac when receiving ADD_ADDR".

Geliang Tang (4):
Squash to "mptcp: add port support for ADD_ADDR suboption writing"
mptcp: add port number check for MP_JOIN
Squash to "mptcp: add the mib for ADD_ADDR with port" Squash to "selftests: mptcp: add testcases for ADD_ADDR with port"

 net/mptcp/mib.c                               |  3 +
 net/mptcp/mib.h                               |  3 +
 net/mptcp/options.c                           | 17 +++---
 net/mptcp/pm_netlink.c                        | 12 ++++
 net/mptcp/protocol.h                          |  1 +
 net/mptcp/subflow.c                           | 37 ++++++++++++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 56 ++++++++++++++++---
 7 files changed, 114 insertions(+), 15 deletions(-)
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 1/4 Squash to "mptcp: add port support for ADD_ADDR suboption writing"

Here is the new commit message, please update it:
"""
In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port is 18 octets, but mptcp_write_options is 32-bit aligned, so we need to pad it to 20 octets. All the other port related option lengths need to be added up 2 octets similarly.

This patch added a new field 'port' in mptcp_out_options. When this field is set with a port number, we need to add up 4 octets for the ADD_ADDR suboption, and put the port number into the suboption. """

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/options.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
net/mptcp/options.c +10 -7
index f611fbcbd6d0..5df31d0b885b 100644
@@ -1116,13 +1116,16 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 			}
 		} else {
 			if (opts->ahmac) {
-				put_unaligned_be32(opts->port << 16 |
-						   opts->ahmac >> 48, ptr);
-				ptr += 1;
-				put_unaligned_be64(opts->ahmac << 16 |
-						   TCPOPT_NOP << 8 |
-						   TCPOPT_NOP, ptr);
-				ptr += 2;
+				u8 *bptr = (u8 *)ptr;
+
+				put_unaligned_be16(opts->port, bptr);
+				bptr += 2;
+				put_unaligned_be64(opts->ahmac, bptr);
+				bptr += 8;
+				put_unaligned_be16(TCPOPT_NOP << 8 |
+						   TCPOPT_NOP, bptr);
+
+				ptr += 3;
 			} else {
 				put_unaligned_be32(opts->port << 16 |
 						   TCPOPT_NOP << 8 |
Signature · 1 line
2.26.2
author
#2 lore raw

PATCH 2/4 mptcp: add port number check for MP_JOIN

This patch added two new helpers, subflow_use_different_sport and subflow_use_different_dport, to check whether the subflow's source or destination port number is different from the msk's port number.

When we received the MP_JOIN's SYN/SYNACK/ACK, we do these port number checks. If the subflow's source port number is different, we use another new helper mptcp_pm_sport_in_anno_list to check whether this port number is announced. If it isn't, we need to abort this connection.

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

---
This patch should be inserted into the "ADD_ADDR: ports support" patchset, after the 8th patch, "mptcp: print out port and ahmac when receiving ADD_ADDR".

---
 net/mptcp/pm_netlink.c | 12 ++++++++++++
 net/mptcp/protocol.h   |  1 +
 net/mptcp/subflow.c    | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)
net/mptcp/pm_netlink.c +12 -0
index 069447424ddb..00996f410e1c 100644
@@ -201,6 +201,18 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk,
 	return NULL;
 }
 
+bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)
+{
+	struct mptcp_pm_add_entry *entry;
+
+	list_for_each_entry(entry, &msk->pm.anno_list, list) {
+		if (entry->addr.port == inet_sk(sk)->inet_sport)
+			return true;
+	}
+
+	return false;
+}
+
 static void mptcp_pm_add_timer(struct timer_list *timer)
 {
 	struct mptcp_pm_add_entry *entry = from_timer(entry, timer, add_timer);
net/mptcp/protocol.h +1 -0
index b01c1fae9d8f..e575823c3077 100644
@@ -516,6 +516,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
 void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
+bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
 struct mptcp_pm_add_entry *
 mptcp_pm_del_add_timer(struct mptcp_sock *msk,
 		       struct mptcp_addr_info *addr);
net/mptcp/subflow.c +34 -0
index 1e9a72af67dc..32e4be3a7d11 100644
@@ -112,6 +112,11 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li
 	return 0;
 }
 
+static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk)
+{
+	return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport;
+}
+
 static void subflow_init_req(struct request_sock *req,
 			     const struct sock *sk_listener,
 			     struct sk_buff *skb)
@@ -182,6 +187,16 @@ static void subflow_init_req(struct request_sock *req,
 
 		pr_debug("token=%u, remote_nonce=%u msk=%p", subflow_req->token,
 			 subflow_req->remote_nonce, subflow_req->msk);
+
+		if (subflow_use_different_sport(subflow_req->msk, sk_listener)) {
+			pr_debug("syn inet_sport=%d %d",
+				 ntohs(inet_sk(sk_listener)->inet_sport),
+				 ntohs(inet_sk((struct sock *)subflow_req->msk)->inet_sport));
+			if (!mptcp_pm_sport_in_anno_list(subflow_req->msk, sk_listener)) {
+				subflow_req->mp_join = 0;
+				return;
+			}
+		}
 	}
 }
 
@@ -284,6 +299,11 @@ void mptcp_subflow_reset(struct sock *ssk)
 		sock_hold(sk);
 }
 
+static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct sock *sk)
+{
+	return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport;
+}
+
 static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
@@ -349,6 +369,12 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 
 		subflow->mp_join = 1;
 		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);
+
+		if (subflow_use_different_dport(mptcp_sk(parent), sk)) {
+			pr_debug("synack inet_dport=%d %d",
+				 ntohs(inet_sk(sk)->inet_dport),
+				 ntohs(inet_sk(parent)->inet_dport));
+		}
 	} else if (mptcp_check_fallback(sk)) {
 fallback:
 		mptcp_rcv_space_init(mptcp_sk(parent), sk);
@@ -611,6 +637,14 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 
 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
 			tcp_rsk(req)->drop_req = true;
+
+			if (subflow_use_different_sport(owner, sk)) {
+				pr_debug("ack inet_sport=%d %d",
+					 ntohs(inet_sk(sk)->inet_sport),
+					 ntohs(inet_sk((struct sock *)owner)->inet_sport));
+				if (!mptcp_pm_sport_in_anno_list(owner, sk))
+					goto out;
+			}
 		}
 	}
 
Signature · 1 line
2.26.2
author
#3 lore raw

PATCH 3/4 Squash to "mptcp: add the mib for ADD_ADDR with port"

Here is the new commit message, please update it:
"""
Subject: mptcp: add the mibs for ADD_ADDR with port

This patch added the mibs for ADD_ADDR with port:

MPTCP_MIB_PORTADD for receiving of the ADD_ADDR suboption with a port number. MPTCP_MIB_PORTSYNRX, MPTCP_MIB_PORTSYNACKRX, MPTCP_MIB_PORTACKRX, for receiving of the MP_JOIN's SYN or SYN/ACK or ACK with a port number which is different from the msk's port number.
"""

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 net/mptcp/mib.c     | 3 +++
 net/mptcp/mib.h     | 3 +++
 net/mptcp/subflow.c | 3 +++
 3 files changed, 9 insertions(+)
net/mptcp/mib.c +3 -0
index a8744ad62087..5e8f7827cfe0 100644
@@ -30,6 +30,9 @@ static const struct snmp_mib mptcp_snmp_list[] = {
 	SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
 	SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
 	SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD),
+	SNMP_MIB_ITEM("PortSynRx", MPTCP_MIB_PORTSYNRX),
+	SNMP_MIB_ITEM("PortSynAckRx", MPTCP_MIB_PORTSYNACKRX),
+	SNMP_MIB_ITEM("PortAckRx", MPTCP_MIB_PORTACKRX),
 	SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
 	SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
 	SNMP_MIB_SENTINEL
net/mptcp/mib.h +3 -0
index 1b07fc1ad1a0..b762941d492f 100644
@@ -23,6 +23,9 @@ enum linux_mptcp_mib_field {
 	MPTCP_MIB_ADDADDR,		/* Received ADD_ADDR with echo-flag=0 */
 	MPTCP_MIB_ECHOADD,		/* Received ADD_ADDR with echo-flag=1 */
 	MPTCP_MIB_PORTADD,		/* Received ADD_ADDR with port */
+	MPTCP_MIB_PORTSYNRX,		/* Received a SYN + MP_JOIN with port */
+	MPTCP_MIB_PORTSYNACKRX,		/* Received a SYN/ACK + MP_JOIN with port */
+	MPTCP_MIB_PORTACKRX,		/* Received an ACK + MP_JOIN with port */
 	MPTCP_MIB_RMADDR,		/* Received RM_ADDR */
 	MPTCP_MIB_RMSUBFLOW,		/* Remove a subflow */
 	__MPTCP_MIB_MAX
net/mptcp/subflow.c +3 -0
index 32e4be3a7d11..40a62f143217 100644
@@ -196,6 +196,7 @@ static void subflow_init_req(struct request_sock *req,
 				subflow_req->mp_join = 0;
 				return;
 			}
+			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_PORTSYNRX);
 		}
 	}
 }
@@ -374,6 +375,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 			pr_debug("synack inet_dport=%d %d",
 				 ntohs(inet_sk(sk)->inet_dport),
 				 ntohs(inet_sk(parent)->inet_dport));
+			MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_PORTSYNACKRX);
 		}
 	} else if (mptcp_check_fallback(sk)) {
 fallback:
@@ -644,6 +646,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 					 ntohs(inet_sk((struct sock *)owner)->inet_sport));
 				if (!mptcp_pm_sport_in_anno_list(owner, sk))
 					goto out;
+				SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_PORTACKRX);
 			}
 		}
 	}
Signature · 1 line
2.26.2
author
#4 lore raw

PATCH 4/4 Squash to "selftests: mptcp: add testcases for ADD_ADDR with port"

Here is the new commit message, please update it:
"""
This patch added a new argument for run_tests. When an address with a port number has been added, the new port number will be passed to this with_port argument, and then passed to do_transfer.

In do_transfer, if the with_port argument is set, we need to establish a new connection to listen for the new port. To make sure the peer can connect with it using the new port.

It checked the ADD_ADDR port related MIB counters in chk_add_nr, and added the testcases for ADD_ADDR with port.

The output looks like this:

24 signal address with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
25 subflow and signal with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
26 remove single address with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
rm [ ok ] - sf [ ok ]
"""

Signed-off-by Geliang Tang <geliangtang(a)gmail.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 56 ++++++++++++++++---
 1 file changed, 48 insertions(+), 8 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +48 -8
index f224379ba254..8fe184a5ef25 100755
@@ -437,6 +437,9 @@ chk_add_nr()
 	local add_nr=$1
 	local echo_nr=$2
 	local port_nr=${3:-0}
+	local syn_nr=$port_nr
+	local syn_ack_nr=$port_nr
+	local ack_nr=$port_nr
 	local count
 	local dump_stats
 
@@ -462,15 +465,52 @@ chk_add_nr()
 		echo -n "[ ok ]"
 	fi
 
-	echo -n " - pt "
-	count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{print $2}'`
-	[ -z "$count" ] && count=0
-	if [ "$count" != "$port_nr" ]; then
-		echo "[fail] got $count ADD_ADDR with port[s] expected $port_nr"
-		ret=1
-		dump_stats=1
+	if [ $port_nr -gt 0 ]; then
+		echo -n " - pt "
+		count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{print $2}'`
+		[ -z "$count" ] && count=0
+		if [ "$count" != "$port_nr" ]; then
+			echo "[fail] got $count ADD_ADDR[s] with port expected $port_nr"
+			ret=1
+			dump_stats=1
+		else
+			echo "[ ok ]"
+		fi
+
+		printf "%-39s %s" " " "syn"
+		count=`ip netns exec $ns1 nstat -as | grep MPTcpExtPortSynRx | awk '{print $2}'`
+		[ -z "$count" ] && count=0
+		if [ "$count" != "$syn_nr" ]; then
+			echo "[fail] got $count JOIN[s] syn with port expected $syn_nr"
+			ret=1
+			dump_stats=1
+		else
+			echo -n "[ ok ]"
+		fi
+
+		echo -n " - synack"
+		count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortSynAckRx | awk '{print $2}'`
+		[ -z "$count" ] && count=0
+		if [ "$count" != "$syn_ack_nr" ]; then
+			echo "[fail] got $count JOIN[s] synack with port expected $syn_ack_nr"
+			ret=1
+			dump_stats=1
+		else
+			echo -n "[ ok ]"
+		fi
+
+		echo -n " - ack"
+		count=`ip netns exec $ns1 nstat -as | grep MPTcpExtPortAckRx | awk '{print $2}'`
+		[ -z "$count" ] && count=0
+		if [ "$count" != "$ack_nr" ]; then
+			echo "[fail] got $count JOIN[s] ack with port expected $ack_nr"
+			ret=1
+			dump_stats=1
+		else
+			echo "[ ok ]"
+		fi
 	else
-		echo "[ ok ]"
+		echo ""
 	fi
 
 	if [ "${dump_stats}" = 1 ]; then
Signature · 1 line
2.26.2
#6 lore raw

[MPTCP] Re: [MPTCP][PATCH mptcp-next 1/4] Squash to "mptcp: add port support for ADD_ADDR suboption writing"

In reply to Geliang Tang
Quoted 32 lines · Geliang Tang

Here is the new commit message, please update it:
"""
In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port is 18 octets, but mptcp_write_options is 32-bit aligned, so we need to pad it to 20 octets. All the other port related option lengths need to be added up 2 octets similarly.

This patch added a new field 'port' in mptcp_out_options. When this field is set with a port number, we need to add up 4 octets for the ADD_ADDR suboption, and put the port number into the suboption. """

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

---
net/mptcp/options.c | 17 ++++++++++-------

1 file changed, 10 insertions(+), 7 deletions(-)
net/mptcp/options.c +0 -7
index f611fbcbd6d0..5df31d0b885b 100644
@@ -1116,13 +1116,16 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
 			}
 		} else {
 			if (opts->ahmac) {
-				put_unaligned_be32(opts->port << 16 |
-						   opts->ahmac >> 48, ptr);
-				ptr += 1;
-				put_unaligned_be64(opts->ahmac << 16 |
-						   TCPOPT_NOP << 8 |
-						   TCPOPT_NOP, ptr);
-				ptr += 2;

net/mptcp/options.c void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, · line 1128

Quoted 10 lines
net/mptcp/options.c +10 -0
+				u8 *bptr = (u8 *)ptr;
+
+				put_unaligned_be16(opts->port, bptr);
+				bptr += 2;
+				put_unaligned_be64(opts->ahmac, bptr);
+				bptr += 8;
+				put_unaligned_be16(TCPOPT_NOP << 8 |
+						   TCPOPT_NOP, bptr);
+
+				ptr += 3;

Thanks, looks good to me.

Quoted 5 lines
net/mptcp/options.c +0 -0
 			} else {
 				put_unaligned_be32(opts->port << 16 |
 						   TCPOPT_NOP << 8 |
Signature · 1 line
2.26.2

--
Mat Martineau
Intel

#5 lore raw

[MPTCP] Re: [MPTCP][PATCH mptcp-next 2/4] mptcp: add port number check for MP_JOIN

In reply to Geliang Tang
Quoted 26 lines · Geliang Tang

This patch added two new helpers, subflow_use_different_sport and subflow_use_different_dport, to check whether the subflow's source or destination port number is different from the msk's port number.

When we received the MP_JOIN's SYN/SYNACK/ACK, we do these port number checks. If the subflow's source port number is different, we use another new helper mptcp_pm_sport_in_anno_list to check whether this port number is announced. If it isn't, we need to abort this connection.

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

---
This patch should be inserted into the "ADD_ADDR: ports support" patchset, after the 8th patch, "mptcp: print out port and ahmac when receiving ADD_ADDR".
---

net/mptcp/pm_netlink.c | 12 ++++++++++++
net/mptcp/protocol.h   |  1 +
net/mptcp/subflow.c    | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 47 insertions(+)
net/mptcp/pm_netlink.c +0 -0
index 069447424ddb..00996f410e1c 100644
@@ -201,6 +201,18 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk,
 	return NULL;

net/mptcp/pm_netlink.c lookup_anno_list_by_saddr(struct mptcp_sock *msk, · line 211

Quoted 10 lines
net/mptcp/pm_netlink.c +8 -0
 }
 
+bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)
+{
+	struct mptcp_pm_add_entry *entry;
+
+	list_for_each_entry(entry, &msk->pm.anno_list, list) {
+		if (entry->addr.port == inet_sk(sk)->inet_sport)
+			return true;
+	}

Should msk->pm.lock should be held here? It looks like the pm.lock is held in other places the anno_list is iterated over, for example when lookup_anno_list_by_saddr() is called.

Thanks,

Mat

Quoted 94 lines
net/mptcp/pm_netlink.c +4 -0
+
+	return false;
+}
+
 static void mptcp_pm_add_timer(struct timer_list *timer)
 {
 	struct mptcp_pm_add_entry *entry = from_timer(entry, timer, add_timer);
net/mptcp/protocol.h +1 -0
index b01c1fae9d8f..e575823c3077 100644
@@ -516,6 +516,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,
 void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk);
 void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id);
 void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
+bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);

struct mptcp_pm_add_entry *
mptcp_pm_del_add_timer(struct mptcp_sock *msk,

		       struct mptcp_addr_info *addr);
net/mptcp/subflow.c +26 -0
index 1e9a72af67dc..32e4be3a7d11 100644
@@ -112,6 +112,11 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_li
 	return 0;
 }
 
+static bool subflow_use_different_sport(struct mptcp_sock *msk, const struct sock *sk)
+{
+	return inet_sk(sk)->inet_sport != inet_sk((struct sock *)msk)->inet_sport;
+}
+
 static void subflow_init_req(struct request_sock *req,
 			     const struct sock *sk_listener,
 			     struct sk_buff *skb)
@@ -182,6 +187,16 @@ static void subflow_init_req(struct request_sock *req,
 
 		pr_debug("token=%u, remote_nonce=%u msk=%p", subflow_req->token,
 			 subflow_req->remote_nonce, subflow_req->msk);
+
+		if (subflow_use_different_sport(subflow_req->msk, sk_listener)) {
+			pr_debug("syn inet_sport=%d %d",
+				 ntohs(inet_sk(sk_listener)->inet_sport),
+				 ntohs(inet_sk((struct sock *)subflow_req->msk)->inet_sport));
+			if (!mptcp_pm_sport_in_anno_list(subflow_req->msk, sk_listener)) {
+				subflow_req->mp_join = 0;
+				return;
+			}
+		}
 	}
 }
 
@@ -284,6 +299,11 @@ void mptcp_subflow_reset(struct sock *ssk)
 		sock_hold(sk);
 }
 
+static bool subflow_use_different_dport(struct mptcp_sock *msk, const struct sock *sk)
+{
+	return inet_sk(sk)->inet_dport != inet_sk((struct sock *)msk)->inet_dport;
+}
+
 static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 {
 	struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
@@ -349,6 +369,12 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
 
 		subflow->mp_join = 1;
 		MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);
+
+		if (subflow_use_different_dport(mptcp_sk(parent), sk)) {
+			pr_debug("synack inet_dport=%d %d",
+				 ntohs(inet_sk(sk)->inet_dport),
+				 ntohs(inet_sk(parent)->inet_dport));
+		}
 	} else if (mptcp_check_fallback(sk)) {

fallback:

		mptcp_rcv_space_init(mptcp_sk(parent), sk);
net/mptcp/subflow.c +8 -0
@@ -611,6 +637,14 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 
 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKRX);
 			tcp_rsk(req)->drop_req = true;
+
+			if (subflow_use_different_sport(owner, sk)) {
+				pr_debug("ack inet_sport=%d %d",
+					 ntohs(inet_sk(sk)->inet_sport),
+					 ntohs(inet_sk((struct sock *)owner)->inet_sport));
+				if (!mptcp_pm_sport_in_anno_list(owner, sk))
+					goto out;
+			}
 		}
 	}
 
Signature · 1 line
2.26.2

--
Mat Martineau
Intel

author
#7 lore raw
In reply to Geliang Tang
Quoted 9 lines · Geliang Tang <geliangtang(a)gmail.com> 于2020年11月8日周日 下午10:43写道:

This patchset includes three squash-to patches and a new patch. They all should be squashed into the "ADD_ADDR: ports support" series.

All three squash-to patches's commit massages need to be updated.

The new patch should be inserted into the patchset after the 8th patch "mptcp: print out port and ahmac when receiving ADD_ADDR".

This patchset is obsolete. It have been merged into the "ADD_ADDR: ports support" series v4.

-Geliang

Quoted 19 lines

Geliang Tang (4):
Squash to "mptcp: add port support for ADD_ADDR suboption writing"
mptcp: add port number check for MP_JOIN
Squash to "mptcp: add the mib for ADD_ADDR with port" Squash to "selftests: mptcp: add testcases for ADD_ADDR with port"

 net/mptcp/mib.c                               |  3 +
 net/mptcp/mib.h                               |  3 +
 net/mptcp/options.c                           | 17 +++---
 net/mptcp/pm_netlink.c                        | 12 ++++
 net/mptcp/protocol.h                          |  1 +
 net/mptcp/subflow.c                           | 37 ++++++++++++
 .../testing/selftests/net/mptcp/mptcp_join.sh | 56 ++++++++++++++++---
 7 files changed, 114 insertions(+), 15 deletions(-)

--
2.26.2