Forward-ports from mptcp_trunk
Subsystems (2)
Christoph Paasch
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
Christoph Paasch
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.
--- net/mptcp/mptcp_ctrl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/mptcp/mptcp_ctrl.c +9 -1
@@ -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
Christoph Paasch
PATCH 2/2 mptcp: Disable MPTCP when interface is non-MPTCP
In reply to Christoph PaaschFranz 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.
--- include/net/mptcp.h | 6 +++--- net/mptcp/mptcp_ctrl.c | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-)
include/net/mptcp.h +3 -3
@@ -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
@@ -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
Mat Martineau
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