Skip to contentSkip to conversation

Forward-ports from mptcp_trunk

PATCH In review Christoph Paasch 2 participants 4 messages Jul 24, 2018 – Jul 25, 2018

Subsystems (2)
lore
Share & tools
lore

Christoph Paasch

author
#0 lore raw

cover Forward-ports from mptcp_trunk

Two of the recent additions to mptcp_trunk.

Christoph Paasch (2):
mptcp: Fix: Correct version-negotiation when SYN-cookies are set
mptcp: Disable MPTCP when interface is non-MPTCP

 include/net/mptcp.h    |  6 +++---
 net/mptcp/mptcp_ctrl.c | 29 +++++++++++++++++++++--------
 2 files changed, 24 insertions(+), 11 deletions(-)
Signature · 1 line
2.16.2
author
#1 lore raw

PATCH 1/2 mptcp: Fix: Correct version-negotiation when SYN-cookies are set

We need to check for the negotiated version when SYN-cookies are set.

Fixes c9b4b66a0e54 ("mptcp: Add MPTCP version control")
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
(cherry picked from commit 8b053971270731059387a5f3cefb502800871d9b)
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
 net/mptcp/mptcp_ctrl.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/mptcp/mptcp_ctrl.c +9 -1
index 8c807c7681b6..7f7b4a0f2ee1 100644
@@ -297,6 +297,7 @@ static void mptcp_reqsk_new_mptcp(struct request_sock *req,
 	const struct tcp_sock *tp = tcp_sk(sk);
 
 	inet_rsk(req)->saw_mpc = 1;
+
 	/* MPTCP version agreement */
 	if (mopt->mptcp_ver >= tp->mptcp_ver)
 		mtreq->mptcp_ver = tp->mptcp_ver;
@@ -316,11 +317,18 @@ static void mptcp_reqsk_new_mptcp(struct request_sock *req,
 }
 
 static int mptcp_reqsk_new_cookie(struct request_sock *req,
+				  const struct sock *sk,
 				  const struct mptcp_options_received *mopt,
 				  const struct sk_buff *skb)
 {
 	struct mptcp_request_sock *mtreq = mptcp_rsk(req);
 
+	/* MPTCP version agreement */
+	if (mopt->mptcp_ver >= tcp_sk(sk)->mptcp_ver)
+		mtreq->mptcp_ver = tcp_sk(sk)->mptcp_ver;
+	else
+		mtreq->mptcp_ver = mopt->mptcp_ver;
+
 	rcu_read_lock_bh();
 	spin_lock(&mptcp_tk_hashlock);
 
@@ -2397,7 +2405,7 @@ void mptcp_reqsk_init(struct request_sock *req, const struct sock *sk,
 	mtreq->dss_csum = mopt.dss_csum;
 
 	if (want_cookie) {
-		if (!mptcp_reqsk_new_cookie(req, &mopt, skb))
+		if (!mptcp_reqsk_new_cookie(req, sk, &mopt, skb))
 			/* No key available - back to regular TCP */
 			inet_rsk(req)->mptcp_rqsk = 0;
 		return;
Signature · 1 line
2.16.2
author
#2 lore raw

PATCH 2/2 mptcp: Disable MPTCP when interface is non-MPTCP

In reply to Christoph Paasch

Franz Schleindlhuber found out that when MPTCP is disabled on an interface with "ip link", the initiating subflow is still negotiating MPTCP.

This patch changes this, by extending mptcp_doit() to check the interface-flags as well.

Reported-by Franz Schleindlhuber <Schleindlhuber(a)gmx.net>
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>
(cherry picked from commit ccd0390729e370f43e1515b90fd6982faa00e724)
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
 include/net/mptcp.h    |  6 +++---
 net/mptcp/mptcp_ctrl.c | 19 ++++++++++++-------
 2 files changed, 15 insertions(+), 10 deletions(-)
include/net/mptcp.h +3 -3
index 8abb6985d852..2b5418d808bf 100644
@@ -800,7 +800,7 @@ void mptcp_options_write(__be32 *ptr, struct tcp_sock *tp,
 			 const struct tcp_out_options *opts,
 			 struct sk_buff *skb);
 void mptcp_close(struct sock *meta_sk, long timeout);
-int mptcp_doit(struct sock *sk);
+bool mptcp_doit(struct sock *sk);
 int mptcp_create_master_sk(struct sock *meta_sk, __u64 remote_key,
 			   __u8 mptcp_ver, u32 window);
 int mptcp_check_req_fastopen(struct sock *child, struct request_sock *req);
@@ -1373,9 +1373,9 @@ static inline void mptcp_options_write(__be32 *ptr, struct tcp_sock *tp,
 				       const struct tcp_out_options *opts,
 				       struct sk_buff *skb) {}
 static inline void mptcp_close(struct sock *meta_sk, long timeout) {}
-static inline int mptcp_doit(struct sock *sk)
+static inline bool mptcp_doit(struct sock *sk)
 {
-	return 0;
+	return false;
 }
 static inline int mptcp_check_req_fastopen(struct sock *child,
 					   struct request_sock *req)
net/mptcp/mptcp_ctrl.c +12 -7
index 7f7b4a0f2ee1..f5d46c688279 100644
@@ -1925,31 +1925,36 @@ void mptcp_disconnect(struct sock *sk)
 }
 
 
-/* Returns 1 if we should enable MPTCP for that socket. */
-int mptcp_doit(struct sock *sk)
+/* Returns True if we should enable MPTCP for that socket. */
+bool mptcp_doit(struct sock *sk)
 {
+	const struct dst_entry *dst = __sk_dst_get(sk);
+
 	/* Don't do mptcp over loopback */
 	if (sk->sk_family == AF_INET &&
 	    (ipv4_is_loopback(inet_sk(sk)->inet_daddr) ||
 	     ipv4_is_loopback(inet_sk(sk)->inet_saddr)))
-		return 0;
+		return false;
 #if IS_ENABLED(CONFIG_IPV6)
 	if (sk->sk_family == AF_INET6 &&
 	    (ipv6_addr_loopback(&sk->sk_v6_daddr) ||
 	     ipv6_addr_loopback(&inet6_sk(sk)->saddr)))
-		return 0;
+		return false;
 #endif
 	if (mptcp_v6_is_v4_mapped(sk) &&
 	    ipv4_is_loopback(inet_sk(sk)->inet_saddr))
-		return 0;
+		return false;
 
 #ifdef CONFIG_TCP_MD5SIG
 	/* If TCP_MD5SIG is enabled, do not do MPTCP - there is no Option-Space */
 	if (tcp_sk(sk)->af_specific->md5_lookup(sk, sk))
-		return 0;
+		return false;
 #endif
 
-	return 1;
+	if (dst->dev && (dst->dev->flags & IFF_NOMULTIPATH))
+		return false;
+
+	return true;
 }
 
 int mptcp_create_master_sk(struct sock *meta_sk, __u64 remote_key,
Signature · 1 line
2.16.2
#3 lore raw
In reply to Christoph Paasch
Quoted 9 lines · Christoph Paasch

Two of the recent additions to mptcp_trunk.

Christoph Paasch (2):
mptcp: Fix: Correct version-negotiation when SYN-cookies are set
mptcp: Disable MPTCP when interface is non-MPTCP

include/net/mptcp.h | 6 +++---
net/mptcp/mptcp_ctrl.c | 29 +++++++++++++++++++++--------

2 files changed, 24 insertions(+), 11 deletions(-)

Both applied.

Thanks,

--
Mat Martineau
Intel OTC