Skip to contentSkip to conversation

net: mptcp, Fast Open Mechanism

PATCH Superseded Dmytro SHYTYI 5 participants 17 messages Jan 16, 2022 – Jan 21, 2022

Subsystems (3)

v2 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: mptcp, Fast Open Mechanism

This set of patches will bring "Fast Open" Option support to MPTCP. The aim of Fast Open Mechanism is to eliminate one round trip time from a TCP conversation by allowing data to be included as part of the SYN segment that initiates the connection.

IETF RFC 8684: Appendix B. TCP Fast Open and MPTCP.

[PATCH v2] includes "client-server" partial support for :
1. MPTCP cookie request from client.
2. MPTCP cookie offering from server.
3. MPTCP SYN+DATA+COOKIE from client.
4. subsequent write + read on the opened socket.

This patch is Work In Progress and an early draft shared due community request.

---
 include/linux/tcp.h             |  7 ++++
 net/ipv4/inet_connection_sock.c |  3 +-
 net/ipv4/tcp_fastopen.c         | 42 +++++++++++++++++++----
 net/ipv4/tcp_input.c            | 16 +++++----
 net/mptcp/protocol.c            | 59 ++++++++++++++++++++++++++++++---
 net/mptcp/sockopt.c             | 40 ++++++++++++++++++++++
 net/mptcp/subflow.c             | 14 ++++++++
 7 files changed, 162 insertions(+), 19 deletions(-)
include/linux/tcp.h +7 -0
index 48d8a363319e..d7092234d442 100644
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
 /* TCP Fast Open */
 #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
 #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
 #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif
+
+
 
 /* TCP Fast Open Cookie as stored in memory */
 struct tcp_fastopen_cookie {
net/ipv4/inet_connection_sock.c +2 -1
index f7fea3a7c5e6..4b4159c0258d 100644
@@ -501,7 +501,8 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
 	req = reqsk_queue_remove(queue, sk);
 	newsk = req->sk;
 
-	if (sk->sk_protocol == IPPROTO_TCP &&
+	if ((sk->sk_protocol == IPPROTO_TCP ||
+	     sk->sk_protocol == IPPROTO_MPTCP) &&
 	    tcp_rsk(req)->tfo_listener) {
 		spin_lock_bh(&queue->fastopenq.lock);
 		if (tcp_rsk(req)->tfo_listener) {
net/ipv4/tcp_fastopen.c +35 -7

116 lines not on this page · raw message

net/ipv4/tcp_input.c +9 -7
index 246ab7b5e857..915570132014 100644
@@ -5908,7 +5908,6 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
 			} else {
 				tcp_update_wl(tp, TCP_SKB_CB(skb)->seq);
 			}
-
 			__tcp_ack_snd_check(sk, 0);
 no_ack:
 			if (eaten)
@@ -6229,9 +6228,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 		}
 		if (fastopen_fail)
 			return -1;
-		if (sk->sk_write_pending ||
-		    icsk->icsk_accept_queue.rskq_defer_accept ||
-		    inet_csk_in_pingpong_mode(sk)) {
+
+		if ((sk->sk_write_pending ||
+		     icsk->icsk_accept_queue.rskq_defer_accept ||
+		     inet_csk_in_pingpong_mode(sk)) && !th->syn) {
 			/* Save one ACK. Data will be ready after
 			 * several ticks, if write_pending is set.
 			 *
@@ -6243,9 +6243,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 			tcp_enter_quickack_mode(sk, TCP_MAX_QUICKACKS);
 			inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
 						  TCP_DELACK_MAX, TCP_RTO_MAX);
-
 discard:
 			tcp_drop(sk, skb);
+			tcp_send_ack(sk);
+
 			return 0;
 		} else {
 			tcp_send_ack(sk);
@@ -6425,6 +6426,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 		tcp_urg(sk, skb, th);
 		__kfree_skb(skb);
 		tcp_data_snd_check(sk);
+
 		return 0;
 	}
 
@@ -6901,7 +6903,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 			 */
 			pr_drop_req(req, ntohs(tcp_hdr(skb)->source),
 				    rsk_ops->family);
-			goto drop_and_release;
+			//goto drop_and_release;
 		}
 
 		isn = af_ops->init_seq(skb);
@@ -6954,7 +6956,7 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 	reqsk_put(req);
 	return 0;
 
-drop_and_release:
+//drop_and_release:
 	dst_release(dst);
 drop_and_free:
 	__reqsk_free(req);
net/mptcp/protocol.c +55 -4

92 lines not on this page · raw message

net/mptcp/sockopt.c +40 -0
index 0f1e661c2032..0e471e31e72a 100644
@@ -539,6 +539,7 @@ static bool mptcp_supported_sockopt(int level, int optname)
 		case TCP_TIMESTAMP:
 		case TCP_NOTSENT_LOWAT:
 		case TCP_TX_DELAY:
+		case TCP_FASTOPEN:
 			return true;
 		}
 
@@ -598,6 +599,43 @@ static int mptcp_setsockopt_sol_tcp_congestion(struct mptcp_sock *msk, sockptr_t
 	return ret;
 }
 
+static int mptcp_setsockopt_sol_tcp_fastopen(struct mptcp_sock *msk, sockptr_t optval,
+					     unsigned int optlen)
+{
+	struct mptcp_subflow_context *subflow;
+	struct sock *sk = (struct sock *)msk;
+	struct net *net = sock_net(sk);
+	int val;
+	int ret;
+
+	ret = 0;
+
+	if (copy_from_sockptr(&val, optval, sizeof(val)))
+		return -EFAULT;
+
+	lock_sock(sk);
+
+	mptcp_for_each_subflow(msk, subflow) {
+		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+
+		lock_sock(ssk);
+
+		if (val >= 0 && ((1 << sk->sk_state) & (TCPF_CLOSE |
+		    TCPF_LISTEN))) {
+			tcp_fastopen_init_key_once(net);
+			fastopen_queue_tune(sk, val);
+		} else {
+			ret = -EINVAL;
+		}
+
+		release_sock(ssk);
+	}
+
+	release_sock(sk);
+
+	return ret;
+}
+
 static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
 				    sockptr_t optval, unsigned int optlen)
 {
@@ -606,6 +644,8 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,
 		return -EOPNOTSUPP;
 	case TCP_CONGESTION:
 		return mptcp_setsockopt_sol_tcp_congestion(msk, optval, optlen);
+	case TCP_FASTOPEN:
+		return mptcp_setsockopt_sol_tcp_fastopen(msk, optval, optlen);
 	}
 
 	return -EOPNOTSUPP;
net/mptcp/subflow.c +14 -0
index 6172f380dfb7..82976b31f2f2 100644
@@ -966,6 +966,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 	trace_get_mapping_status(mpext);
 
 	data_len = mpext->data_len;
+
 	if (data_len == 0) {
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
 		return MAPPING_INVALID;
@@ -1024,6 +1025,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 		/* If this skb data are fully covered by the current mapping,
 		 * the new map would need caching, which is not supported
 		 */
+
 		if (skb_is_fully_mapped(ssk, skb)) {
 			MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSNOMATCH);
 			return MAPPING_INVALID;
@@ -1044,6 +1046,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 	subflow->map_data_csum = csum_unfold(mpext->csum);
 
 	/* Cfr RFC 8684 Section 3.3.0 */
+
 	if (unlikely(subflow->map_csum_reqd != csum_reqd))
 		return MAPPING_INVALID;
 
@@ -1180,9 +1183,19 @@ static bool subflow_check_data_avail(struct sock *ssk)
 	}
 
 	if (subflow->mp_join || subflow->fully_established) {
+		skb = skb_peek(&ssk->sk_receive_queue);
+		subflow->map_valid = 1;
+		subflow->map_seq = READ_ONCE(msk->ack_seq);
+		subflow->map_data_len = skb->len;
+		subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset;
+
+		WRITE_ONCE(subflow->data_avail, MPTCP_SUBFLOW_DATA_AVAIL);
+		return true;
+
 		/* fatal protocol error, close the socket.
 		 * subflow_error_report() will introduce the appropriate barriers
 		 */
+		/*
 		ssk->sk_err = EBADMSG;
 		tcp_set_state(ssk, TCP_CLOSE);
 		subflow->reset_transient = 0;
@@ -1190,6 +1203,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
 		tcp_send_active_reset(ssk, GFP_ATOMIC);
 		WRITE_ONCE(subflow->data_avail, 0);
 		return false;
+		*/
 	}
 
 	__mptcp_do_fallback(msk);
Signature · 1 line
2.25.1
#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Dmytro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.16]
[cannot apply to net-next/master linus/master next-20220116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430
base:    df0cc57e057f18e44dac8e6c18aba47ab53202f9
config: i386-randconfig-a012 (https://download.01.org/0day-ci/archive/20220116/202201162148.bSZpItDM-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430 git checkout 52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/mptcp/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

net/mptcp/protocol.c: In function 'mptcp_sendmsg_fastopen':
net/mptcp/protocol.c:1650:8: error: implicit declaration of function 'sk_stream_alloc_skb'; did you mean 'tcp_stream_alloc_skb'? [-Werror=implicit-function-declaration]

    1650 |  skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
         |        ^~~~~~~~~~~~~~~~~~~
         |        tcp_stream_alloc_skb
>> net/mptcp/protocol.c:1650:6: warning: assignment to 'struct sk_buff *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1650 |  skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
         |      ^

cc1: some warnings being treated as errors

vim +1650 net/mptcp/protocol.c

1635
1636 static int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
1637 size_t len, struct mptcp_sock *msk, size_t copied)
1638 {
1639 const struct iphdr *iph;
1640 struct ubuf_info *uarg;
1641 struct sockaddr *uaddr;
1642 struct sk_buff *skb;
1643 struct tcp_sock *tp;
1644 struct socket *ssk;
1645 int ret;
1646
1647 ssk = __mptcp_nmpc_socket(msk);
1648 if (unlikely(!ssk))
1649 goto out_EFAULT;

> 1650		skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);

1651 if (unlikely(!skb))
1652 goto out_EFAULT;
1653 iph = ip_hdr(skb);
1654 if (unlikely(!iph))
1655 goto out_EFAULT;
1656 uarg = msg_zerocopy_realloc(sk, len, skb_zcopy(skb));
1657 if (unlikely(!uarg))
1658 goto out_EFAULT;
1659 uaddr = msg->msg_name;
1660
1661 tp = tcp_sk(ssk->sk);
1662 if (unlikely(!tp))
1663 goto out_EFAULT;
1664 if (!tp->fastopen_req)
1665 tp->fastopen_req = kzalloc(sizeof(*tp->fastopen_req), ssk->sk->sk_allocation);
1666
1667 if (unlikely(!tp->fastopen_req))
1668 goto out_EFAULT;
1669 tp->fastopen_req->data = msg;
1670 tp->fastopen_req->size = len;
1671 tp->fastopen_req->uarg = uarg;
1672
1673 /* requests a cookie */
1674 ret = mptcp_stream_connect(sk->sk_socket, uaddr,
1675 msg->msg_namelen, msg->msg_flags);
1676
1677 return ret;
1678 out_EFAULT:
1679 ret = -EFAULT;
1680 return ret;
1681 }
1682

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw

Hello,

I think i fixed this locally but I'm not going to submit a new patch with a correction to avoid CI resource wasting. I wait until major change. If you think it might be interesting to upload a new patch with this minor change, please let me know.

sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true); | ^~~~~~~~~~~~~~~~~~~
| tcp_stream_alloc_skb

Also I'm curious as this patch is failed to apply to current master, but I don't know the reason (which conflict do I have?)... ...locally I successfully build this patch against: 5.16.0-rc8 met-next Auto-merging net/mptcp/subflow.cCONFLICT (content): Merge conflict in net/mptcp/subflow.c
Auto-merging net/mptcp/sockopt.cCONFLICT (content): Merge conflict in net/mptcp/sockopt.c

Thanks for your advice.

Dmytro.

Quoted 94 lines · kernel test robot

Hi Dmytro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.16]
[cannot apply to net-next/master linus/master next-20220116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430
base:    df0cc57e057f18e44dac8e6c18aba47ab53202f9
config: i386-randconfig-a012 (https://download.01.org/0day-ci/archive/20220116/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430 git checkout 52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/mptcp/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

net/mptcp/protocol.c: In function 'mptcp_sendmsg_fastopen':
net/mptcp/protocol.c:1650:8: error: implicit declaration of function 'sk_stream_alloc_skb'; did you mean 'tcp_stream_alloc_skb'? [-Werror=implicit-function-declaration]
1650 | skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
| ^~~~~~~~~~~~~~~~~~~
| tcp_stream_alloc_skb

Quoted 1 line
Quoted 1 line

net/mptcp/protocol.c:1650:6: warning: assignment to 'struct sk_buff *' from 'int' makes pointer from integer without a cast [-Wint-conversion]

1650 | skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
| ^
cc1: some warnings being treated as errors

vim +1650 net/mptcp/protocol.c

   1635	
   1636	static int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
   1637					  size_t len, struct mptcp_sock *msk, size_t copied)
   1638	{
   1639		const struct iphdr *iph;
   1640		struct ubuf_info *uarg;
   1641		struct sockaddr *uaddr;
   1642		struct sk_buff *skb;
   1643		struct tcp_sock *tp;
   1644		struct socket *ssk;
   1645		int ret;
   1646	
   1647		ssk = __mptcp_nmpc_socket(msk);
   1648		if (unlikely(!ssk))
   1649			goto out_EFAULT;
Quoted 1 line

1650 skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);

1651 if (unlikely(!skb))

   1652			goto out_EFAULT;
   1653		iph = ip_hdr(skb);
   1654		if (unlikely(!iph))
   1655			goto out_EFAULT;
   1656		uarg = msg_zerocopy_realloc(sk, len, skb_zcopy(skb));
   1657		if (unlikely(!uarg))
   1658			goto out_EFAULT;
   1659		uaddr = msg->msg_name;
   1660	
   1661		tp = tcp_sk(ssk->sk);
   1662		if (unlikely(!tp))
   1663			goto out_EFAULT;
   1664		if (!tp->fastopen_req)
   1665			tp->fastopen_req = kzalloc(sizeof(*tp->fastopen_req), ssk->sk->sk_allocation);
   1666	
   1667		if (unlikely(!tp->fastopen_req))
   1668			goto out_EFAULT;
   1669		tp->fastopen_req->data = msg;
   1670		tp->fastopen_req->size = len;
   1671		tp->fastopen_req->uarg = uarg;
   1672	
   1673		/* requests a cookie */
   1674		ret = mptcp_stream_connect(sk->sk_socket, uaddr,
   1675					   msg->msg_namelen, msg->msg_flags);
   1676	
   1677		return ret;
   1678	out_EFAULT:
   1679		ret = -EFAULT;
   1680		return ret;
   1681	}
   1682	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

#3 lore raw

Hi Dmytro,

Thank you for sharing this new version.

Quoted 6 lines · Dmytro SHYTYI

Hello,

I think i fixed this locally but I'm not going to submit a new patch with a correction to avoid CI resource wasting. I wait until major change. If you think it might be interesting to upload a new patch with this minor change, please let me know.

Up to you. It is fine to submit a new version if you want more feedback from the CI. It can also help for the reviews if people can apply the patch on top of our "export" branch, please see below.

Just if you do re-submit, please add "RFC" next to "PATCH" in the title.

Quoted 11 lines

sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true); | ^~~~~~~~~~~~~~~~~~~
| tcp_stream_alloc_skb

Also I'm curious as this patch is failed to apply to current master, but I don't know the reason (which conflict do I have?)... ...locally I successfully build this patch against: 5.16.0-rc8 met-next Auto-merging net/mptcp/subflow.cCONFLICT (content): Merge conflict in net/mptcp/subflow.c
Auto-merging net/mptcp/sockopt.cCONFLICT (content): Merge conflict in net/mptcp/sockopt.c

Your patch should be on top of our "export" branch -- or the 'for-review' one, same content but a continuous Git history -- from our repository on Github.

https://github.com/multipath-tcp/mptcp_net-next/wiki/Git-Branches

You can also see on Patchew it was not possible to apply your patch:

https://patchew.org/MPTCP/[email protected]/

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#4 lore raw

Hello Matthieu,

Thanks for pointing me the Git branch that should be used. OK, i will add "RFC" next to "PATCH" in the title.

Dmytro.

Quoted 44 lines · Matthieu Baerts

Hi Dmytro,

Thank you for sharing this new version.

Quoted 6 lines · Dmytro SHYTYI

Hello,

I think i fixed this locally but I'm not going to submit a new patch with a correction to avoid CI resource wasting. I wait until major change. If you think it might be interesting to upload a new patch with this minor change, please let me know.

Up to you. It is fine to submit a new version if you want more feedback from the CI. It can also help for the reviews if people can apply the patch on top of our "export" branch, please see below.

Just if you do re-submit, please add "RFC" next to "PATCH" in the title.

Quoted 11 lines

sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true); | ^~~~~~~~~~~~~~~~~~~
| tcp_stream_alloc_skb

Also I'm curious as this patch is failed to apply to current master, but I don't know the reason (which conflict do I have?)... ...locally I successfully build this patch against: 5.16.0-rc8 met-next Auto-merging net/mptcp/subflow.cCONFLICT (content): Merge conflict in net/mptcp/subflow.c
Auto-merging net/mptcp/sockopt.cCONFLICT (content): Merge conflict in net/mptcp/sockopt.c

Your patch should be on top of our "export" branch -- or the 'for-review' one, same content but a continuous Git history -- from our repository on Github.

https://github.com/multipath-tcp/mptcp_net-next/wiki/Git-Branches

You can also see on Patchew it was not possible to apply your patch:

https://patchew.org/MPTCP/[email protected]/

Cheers,
Matt

#5 lore raw
In reply to Dmytro SHYTYI
Thank you for the patch! Yet something to improve:

Hi Dmytro,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.16]
[cannot apply to net-next/master linus/master next-20220116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430
base:    df0cc57e057f18e44dac8e6c18aba47ab53202f9
config: i386-randconfig-a012 (https://download.01.org/0day-ci/archive/20220116/202201162159.uZep2msW-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430 git checkout 52c7bf82e2e91eb10c89ef6169fe02e0b63a6772
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

net/mptcp/protocol.c: In function 'mptcp_sendmsg_fastopen':

>> net/mptcp/protocol.c:1650:8: error: implicit declaration of function 'sk_stream_alloc_skb'; did you mean 'tcp_stream_alloc_skb'? [-Werror=implicit-function-declaration]
    1650 |  skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
         |        ^~~~~~~~~~~~~~~~~~~
         |        tcp_stream_alloc_skb
   net/mptcp/protocol.c:1650:6: warning: assignment to 'struct sk_buff *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    1650 |  skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);
         |      ^

cc1: some warnings being treated as errors

vim +1650 net/mptcp/protocol.c

1635
1636 static int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
1637 size_t len, struct mptcp_sock *msk, size_t copied)
1638 {
1639 const struct iphdr *iph;
1640 struct ubuf_info *uarg;
1641 struct sockaddr *uaddr;
1642 struct sk_buff *skb;
1643 struct tcp_sock *tp;
1644 struct socket *ssk;
1645 int ret;
1646
1647 ssk = __mptcp_nmpc_socket(msk);
1648 if (unlikely(!ssk))
1649 goto out_EFAULT;

> 1650		skb = sk_stream_alloc_skb(ssk->sk, 0, ssk->sk->sk_allocation, true);

1651 if (unlikely(!skb))
1652 goto out_EFAULT;
1653 iph = ip_hdr(skb);
1654 if (unlikely(!iph))
1655 goto out_EFAULT;
1656 uarg = msg_zerocopy_realloc(sk, len, skb_zcopy(skb));
1657 if (unlikely(!uarg))
1658 goto out_EFAULT;
1659 uaddr = msg->msg_name;
1660
1661 tp = tcp_sk(ssk->sk);
1662 if (unlikely(!tp))
1663 goto out_EFAULT;
1664 if (!tp->fastopen_req)
1665 tp->fastopen_req = kzalloc(sizeof(*tp->fastopen_req), ssk->sk->sk_allocation);
1666
1667 if (unlikely(!tp->fastopen_req))
1668 goto out_EFAULT;
1669 tp->fastopen_req->data = msg;
1670 tp->fastopen_req->size = len;
1671 tp->fastopen_req->uarg = uarg;
1672
1673 /* requests a cookie */
1674 ret = mptcp_stream_connect(sk->sk_socket, uaddr,
1675 msg->msg_namelen, msg->msg_flags);
1676
1677 return ret;
1678 out_EFAULT:
1679 ret = -EFAULT;
1680 return ret;
1681 }
1682

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

build bot
#6 lore raw
In reply to Dmytro SHYTYI
CC: kbuild-all(a)lists.01.org In-Reply-To: <[email protected]> References: <[email protected]> TO: Dmytro SHYTYI <[email protected]> TO…

CC: kbuild-all(a)lists.01.org
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Dmytro SHYTYI <[email protected]>
TO: mptcp(a)lists.linux.dev
CC: Dmytro SHYTYI <[email protected]>

Hi Dmytro,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.16]
[cannot apply to net-next/master linus/master next-20220116] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430
base:    df0cc57e057f18e44dac8e6c18aba47ab53202f9

:::::: branch date: 18 hours ago
:::::: commit date: 18 hours ago
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220117/202201170247.BMTU5XYy-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
net/ipv4/tcp_input.c:6960 tcp_conn_request() warn: ignoring unreachable code.

vim +6960 net/ipv4/tcp_input.c

1fb6f159fd21c6 Octavian Purdila      2014-06-25  6864  
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6865  	tcp_clear_options(&tmp_opt);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6866  	tmp_opt.mss_clamp = af_ops->mss_clamp;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6867  	tmp_opt.user_mss  = tp->rx_opt.user_mss;
eed29f17f09ad7 Eric Dumazet          2017-06-07  6868  	tcp_parse_options(sock_net(sk), skb, &tmp_opt, 0,
eed29f17f09ad7 Eric Dumazet          2017-06-07  6869  			  want_cookie ? NULL : &foc);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6870  
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6871  	if (want_cookie && !tmp_opt.saw_tstamp)
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6872  		tcp_clear_options(&tmp_opt);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6873  
bc58a1baf2a978 Hans Wippel           2018-03-23  6874  	if (IS_ENABLED(CONFIG_SMC) && want_cookie)
bc58a1baf2a978 Hans Wippel           2018-03-23  6875  		tmp_opt.smc_ok = 0;
bc58a1baf2a978 Hans Wippel           2018-03-23  6876  
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6877  	tmp_opt.tstamp_ok = tmp_opt.saw_tstamp;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6878  	tcp_openreq_init(req, &tmp_opt, skb, sk);
7a682575ad4829 KOVACS Krisztian      2016-09-23  6879  	inet_rsk(req)->no_srccheck = inet_sk(sk)->transparent;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6880  
16f86165bd0a94 Eric Dumazet          2015-03-13  6881  	/* Note: tcp_v6_init_req() might override ir_iif for link locals */
6dd9a14e92e548 David Ahern           2015-12-16  6882  	inet_rsk(req)->ir_iif = inet_request_bound_dev_if(sk, skb);
16f86165bd0a94 Eric Dumazet          2015-03-13  6883  
7ea851d19b2359 Florian Westphal      2020-11-30  6884  	dst = af_ops->route_req(sk, skb, &fl, req);
7ea851d19b2359 Florian Westphal      2020-11-30  6885  	if (!dst)
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6886  		goto drop_and_free;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6887  
84b114b98452c4 Eric Dumazet          2017-05-05  6888  	if (tmp_opt.tstamp_ok)
5d2ed0521ac98f Eric Dumazet          2017-06-07  6889  		tcp_rsk(req)->ts_off = af_ops->init_ts_off(net, skb);
95a22caee396ce Florian Westphal      2016-12-01  6890  
f7b3bec6f5167e Florian Westphal      2014-11-03  6891  	if (!want_cookie && !isn) {
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6892  		/* Kill the following clause, if you dislike this way. */
4396e46187ca50 Soheil Hassas Yeganeh 2017-03-15  6893  		if (!net->ipv4.sysctl_tcp_syncookies &&
fee83d097b1620 Haishuang Yan         2016-12-28  6894  		    (net->ipv4.sysctl_max_syn_backlog - inet_csk_reqsk_queue_len(sk) <
fee83d097b1620 Haishuang Yan         2016-12-28  6895  		     (net->ipv4.sysctl_max_syn_backlog >> 2)) &&
d82bae12dc38d7 Soheil Hassas Yeganeh 2017-03-15  6896  		    !tcp_peer_is_proven(req, dst)) {
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6897  			/* Without syncookies last quarter of
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6898  			 * backlog is filled with destinations,
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6899  			 * proven to be alive.
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6900  			 * It means that we continue to communicate
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6901  			 * to destinations, already remembered
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6902  			 * to the moment of synflood.
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6903  			 */
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6904  			pr_drop_req(req, ntohs(tcp_hdr(skb)->source),
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6905  				    rsk_ops->family);
52c7bf82e2e91e Dmytro SHYTYI         2022-01-16  6906  			//goto drop_and_release;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6907  		}
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6908  
84b114b98452c4 Eric Dumazet          2017-05-05  6909  		isn = af_ops->init_seq(skb);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6910  	}
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6911  
f7b3bec6f5167e Florian Westphal      2014-11-03  6912  	tcp_ecn_create_request(req, skb, sk, dst);
f7b3bec6f5167e Florian Westphal      2014-11-03  6913  
f7b3bec6f5167e Florian Westphal      2014-11-03  6914  	if (want_cookie) {
f7b3bec6f5167e Florian Westphal      2014-11-03  6915  		isn = cookie_init_sequence(af_ops, sk, skb, &req->mss);
f7b3bec6f5167e Florian Westphal      2014-11-03  6916  		if (!tmp_opt.tstamp_ok)
f7b3bec6f5167e Florian Westphal      2014-11-03  6917  			inet_rsk(req)->ecn_ok = 0;
f7b3bec6f5167e Florian Westphal      2014-11-03  6918  	}
f7b3bec6f5167e Florian Westphal      2014-11-03  6919  
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6920  	tcp_rsk(req)->snt_isn = isn;
58d607d3e52f2b Eric Dumazet          2015-09-15  6921  	tcp_rsk(req)->txhash = net_tx_rndhash();
e9b12edc133b54 Wei Wang              2020-09-09  6922  	tcp_rsk(req)->syn_tos = TCP_SKB_CB(skb)->ip_dsfield;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6923  	tcp_openreq_init_rwin(req, sk, dst);
c6345ce7d361dc Amritha Nambiar       2018-06-29  6924  	sk_rx_queue_set(req_to_sk(req), skb);
ca6fb06518836e Eric Dumazet          2015-10-02  6925  	if (!want_cookie) {
ca6fb06518836e Eric Dumazet          2015-10-02  6926  		tcp_reqsk_record_syn(sk, req, skb);
71c02379c762cb Christoph Paasch      2017-10-23  6927  		fastopen_sk = tcp_try_fastopen(sk, skb, req, &foc, dst);
ca6fb06518836e Eric Dumazet          2015-10-02  6928  	}
7c85af8810448d Eric Dumazet          2015-09-24  6929  	if (fastopen_sk) {
ca6fb06518836e Eric Dumazet          2015-10-02  6930  		af_ops->send_synack(fastopen_sk, dst, &fl, req,
331fca4315efa3 Martin KaFai Lau      2020-08-20  6931  				    &foc, TCP_SYNACK_FASTOPEN, skb);
7656d842de93fd Eric Dumazet          2015-10-04  6932  		/* Add the child socket directly into the accept queue */
9d3e1368bb4589 Guillaume Nault       2019-03-08  6933  		if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) {
9d3e1368bb4589 Guillaume Nault       2019-03-08  6934  			reqsk_fastopen_remove(fastopen_sk, req, false);
9d3e1368bb4589 Guillaume Nault       2019-03-08  6935  			bh_unlock_sock(fastopen_sk);
9d3e1368bb4589 Guillaume Nault       2019-03-08  6936  			sock_put(fastopen_sk);
9403cf23025880 Guillaume Nault       2019-03-19  6937  			goto drop_and_free;
9d3e1368bb4589 Guillaume Nault       2019-03-08  6938  		}
7656d842de93fd Eric Dumazet          2015-10-04  6939  		sk->sk_data_ready(sk);
7656d842de93fd Eric Dumazet          2015-10-04  6940  		bh_unlock_sock(fastopen_sk);
7c85af8810448d Eric Dumazet          2015-09-24  6941  		sock_put(fastopen_sk);
7c85af8810448d Eric Dumazet          2015-09-24  6942  	} else {
9439ce00f208d9 Eric Dumazet          2015-03-17  6943  		tcp_rsk(req)->tfo_listener = false;
ca6fb06518836e Eric Dumazet          2015-10-02  6944  		if (!want_cookie)
8550f328f45db6 Lawrence Brakmo       2017-06-30  6945  			inet_csk_reqsk_queue_hash_add(sk, req,
8550f328f45db6 Lawrence Brakmo       2017-06-30  6946  				tcp_timeout_init((struct sock *)req));
b3d051477cf94e Eric Dumazet          2016-04-13  6947  		af_ops->send_synack(sk, dst, &fl, req, &foc,
b3d051477cf94e Eric Dumazet          2016-04-13  6948  				    !want_cookie ? TCP_SYNACK_NORMAL :
331fca4315efa3 Martin KaFai Lau      2020-08-20  6949  						   TCP_SYNACK_COOKIE,
331fca4315efa3 Martin KaFai Lau      2020-08-20  6950  				    skb);
9caad864151e52 Eric Dumazet          2016-04-01  6951  		if (want_cookie) {
9caad864151e52 Eric Dumazet          2016-04-01  6952  			reqsk_free(req);
9caad864151e52 Eric Dumazet          2016-04-01  6953  			return 0;
9caad864151e52 Eric Dumazet          2016-04-01  6954  		}
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6955  	}
ca6fb06518836e Eric Dumazet          2015-10-02  6956  	reqsk_put(req);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6957  	return 0;
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6958  
52c7bf82e2e91e Dmytro SHYTYI         2022-01-16  6959  //drop_and_release:

1fb6f159fd21c6 Octavian Purdila 2014-06-25 @6960 dst_release(dst);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#7 lore raw

Hi Dan,

Quoted 25 lines · Dan Carpenter

Hi Dmytro,

url:    https://github.com/0day-ci/linux/commits/Dmytro-SHYTYI/net-mptcp-Fast-Open-Mechanism/20220116-081430
base:    df0cc57e057f18e44dac8e6c18aba47ab53202f9
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220117/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate

smatch warnings:
net/ipv4/tcp_input.c:6960 tcp_conn_request() warn: ignoring unreachable code.

vim +6960 net/ipv4/tcp_input.c

9caad864151e52 Eric Dumazet          2016-04-01  6951  		if (want_cookie) {
9caad864151e52 Eric Dumazet          2016-04-01  6952  			reqsk_free(req);
9caad864151e52 Eric Dumazet          2016-04-01  6953  			return 0;
9caad864151e52 Eric Dumazet          2016-04-01  6954  		}
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6955  	}
ca6fb06518836e Eric Dumazet          2015-10-02  6956  	reqsk_put(req);
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6957  	return 0;
                                                         ^^^^^^^^
Quoted 5 lines
1fb6f159fd21c6 Octavian Purdila      2014-06-25  6958
52c7bf82e2e91e Dmytro SHYTYI         2022-01-16  6959  //drop_and_release:
1fb6f159fd21c6 Octavian Purdila      2014-06-25 @6960  	dst_release(dst);
                                                         ^^^^^^^^^^^^^^^^

Unreachable code.

Indeed. It is going to be fixed in next version of PATCH.

Thanks.

Quoted 4 lines

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

maintainer
#8 lore raw
In reply to Dmytro SHYTYI

Hello,

Quoted 7 lines · Dmytro SHYTYI

This set of patches will bring "Fast Open" Option support to MPTCP. The aim of Fast Open Mechanism is to eliminate one round trip time from a TCP conversation by allowing data to be included as part of the SYN segment that initiates the connection.

IETF RFC 8684: Appendix B. TCP Fast Open and MPTCP.

Quoted 8 lines

[PATCH v2] includes "client-server" partial support for :
1. MPTCP cookie request from client.
2. MPTCP cookie offering from server.
3. MPTCP SYN+DATA+COOKIE from client.
4. subsequent write + read on the opened socket.

This patch is Work In Progress and an early draft shared due community request.

It looks like this is more far from an RFC status than I thought.

There are a number of tasks to be completed for that:
- do not comment out existing working code, expecially TCP one.
- split the patch in several small one, clearly documenting in the individual commit message what each patch is doing and why. A possible skeleton could be:
* create the needed hooks in the TCP code, providing a dummy implementation. Each hook will need a solid justification, and they should not affect the TCP critical path.
The number of added hooks should be as low as possible. You should try to use the existing hooking whenever it should be possible.
No patch should touch the TCP code after the hooks are created. Side note: I'm unsure if any additional hooks are really needed.
* add the real MPTCP impl, possibly with separate patches for the client and the server side
* add self-tests
- avoid introducing white-space only changes.

There are a bunch of specific inline notes below, which are still very important.

Quoted 17 lines
---
 include/linux/tcp.h             |  7 ++++
 net/ipv4/inet_connection_sock.c |  3 +-
 net/ipv4/tcp_fastopen.c         | 42 +++++++++++++++++++----
 net/ipv4/tcp_input.c            | 16 +++++----
 net/mptcp/protocol.c            | 59 ++++++++++++++++++++++++++++++---
 net/mptcp/sockopt.c             | 40 ++++++++++++++++++++++
 net/mptcp/subflow.c             | 14 ++++++++
 7 files changed, 162 insertions(+), 19 deletions(-)
include/linux/tcp.h +0 -0
index 48d8a363319e..d7092234d442 100644

include/linux/tcp.h static inline unsigned int tcp_optlen(const struct sk_buff *skb) · line 62

Quoted 9 lines
include/linux/tcp.h +5 -0
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
 /* TCP Fast Open */
 #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
 #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
 #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif

You really need to document this kind of changes in the code, possibly referring to the RFC bits requiring it.

Quoted 10 lines
include/linux/tcp.h +2 -0
+
+
 
 /* TCP Fast Open Cookie as stored in memory */
 struct tcp_fastopen_cookie {
net/ipv4/inet_connection_sock.c +0 -0
index f7fea3a7c5e6..4b4159c0258d 100644

net/ipv4/inet_connection_sock.c struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) · line 508

Quoted 9 lines
net/ipv4/inet_connection_sock.c +2 -1
@@ -501,7 +501,8 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
 	req = reqsk_queue_remove(queue, sk);
 	newsk = req->sk;
 
-	if (sk->sk_protocol == IPPROTO_TCP &&
+	if ((sk->sk_protocol == IPPROTO_TCP ||
+	     sk->sk_protocol == IPPROTO_MPTCP) &&
 	    tcp_rsk(req)->tfo_listener) {
 		spin_lock_bh(&queue->fastopenq.lock);
 		if (tcp_rsk(req)->tfo_listener) {

This chunk is really not needed. mptcp invokes inet_csk_accept(), passing the initial subflow as the first argument. That socket is really a TCP one.

Cheers,

Paolo

maintainer
#9 lore raw
Quoted 9 lines · Paolo Abeni
Quoted 9 lines
include/linux/tcp.h +1 -0
index 48d8a363319e..d7092234d442 100644
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
 /* TCP Fast Open */
 #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
 #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
Quoted 8 lines

include/linux/tcp.h static inline unsigned int tcp_optlen(const struct sk_buff *skb) · line 62

Quoted 5 lines
include/linux/tcp.h +4 -0
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
 #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif

You really need to document this kind of changes in the code, possibly referring to the RFC bits requiring it.

Note that MPC + syn currently uses 24 bytes of TCP option spaces, and MPC + syn + ack is using 32 bytes, to there is enough room for 8 bytes cookies.

/P

#10 lore raw

Hi Dmytro,

Quoted 19 lines · Paolo Abeni
Quoted 9 lines · Paolo Abeni
Quoted 9 lines
include/linux/tcp.h +1 -0
index 48d8a363319e..d7092234d442 100644
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
 /* TCP Fast Open */
 #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
 #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
Quoted 8 lines

include/linux/tcp.h static inline unsigned int tcp_optlen(const struct sk_buff *skb) · line 62

Quoted 5 lines
include/linux/tcp.h +4 -0
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
 #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif

You really need to document this kind of changes in the code, possibly referring to the RFC bits requiring it.

Quoted 3 lines

Note that MPC + syn currently uses 24 bytes of TCP option spaces, and MPC + syn + ack is using 32 bytes, to there is enough room for 8 bytes cookies.

Indeed, in MPTCPv1 (RFC8684), there is more space in the MPC+SYN as mentioned in the Appendix B you referred to.

Also, you cannot change the value here depending on the kernel
configuration: that will break TFO for "plain" TCP I suppose.

Adding this feature is quite complex because our primary goal is not to have any impact on TCP connections without MPTCP. Any modification in TCP code needs to be very well justified to be accepted upstream.

Do not hesitate to join one of our weekly meeting and/or IRC channel [1] to discuss about the implementation of this feature. Because of the task's complexity, it is probably better to discuss than having long and probably discouraging feedback loops by email. WDYT?

[1] https://github.com/multipath-tcp/mptcp_net-next/wiki#resources

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#11 lore raw

Hello Matthieu,

Quoted 26 lines · Matthieu Baerts

Hi Dmytro,

Quoted 19 lines · Paolo Abeni
Quoted 9 lines · Paolo Abeni
Quoted 9 lines
include/linux/tcp.h +1 -0
index 48d8a363319e..d7092234d442 100644
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
  /* TCP Fast Open */
  #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
  #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
Quoted 8 lines

include/linux/tcp.h static inline unsigned int tcp_optlen(const struct sk_buff *skb) · line 62

Quoted 5 lines
include/linux/tcp.h +4 -0
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
  #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif

You really need to document this kind of changes in the code, possibly referring to the RFC bits requiring it.

Quoted 3 lines

Note that MPC + syn currently uses 24 bytes of TCP option spaces, and MPC + syn + ack is using 32 bytes, to there is enough room for 8 bytes cookies.

Quoted 5 lines

Indeed, in MPTCPv1 (RFC8684), there is more space in the MPC+SYN as mentioned in the Appendix B you referred to.

Also, you cannot change the value here depending on the kernel
configuration: that will break TFO for "plain" TCP I suppose.

I agree. I might find other way to enter this particular case if needed at all.

Quoted 3 lines

Adding this feature is quite complex because our primary goal is not to have any impact on TCP connections without MPTCP. Any modification in TCP code needs to be very well justified to be accepted upstream.

Indeed. :)

Quoted 6 lines

Do not hesitate to join one of our weekly meeting and/or IRC channel [1] to discuss about the implementation of this feature. Because of the task's complexity, it is probably better to discuss than having long and probably discouraging feedback loops by email. WDYT?

[1] https://github.com/multipath-tcp/mptcp_net-next/wiki#resources

I will try to participate. Thank you for invitation!

Quoted 3 lines

Cheers,
Matt

Best regards,
Dmytro.

#12 lore raw
In reply to Paolo Abeni

Hi Paolo,

AFAIK, TFO option requires more that 8 bytes, if cookie len is 8 bytes:

In file /net/ipv4/tcp_output.c (line 689):

static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
struct tcp_out_options *opts)
....

{
        if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) {
                struct tcp_fastopen_cookie *foc = opts->fastopen_cookie;
                u8 *p = (u8 *)ptr;
                u32 len; /* Fast Open option length */

                if (foc->exp) {
                        len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
                        *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) |
                                     TCPOPT_FASTOPEN_MAGIC);
                        p += TCPOLEN_EXP_FASTOPEN_BASE;
                } else {
                        len = TCPOLEN_FASTOPEN_BASE + foc->len;
                        *p++ = TCPOPT_FASTOPEN;
                        *p++ = len;
                }

                memcpy(p, foc->val, foc->len);
                if ((len & 3) == 2) {
                        p[foc->len] = TCPOPT_NOP;
                        p[foc->len + 1] = TCPOPT_NOP;
                }
                ptr += (len + 3) >> 2;
        }

...

Here we do have "len = TCPOLEN_FASTOPEN_BASE + foc->len" that is slightly more than 8 bytes.

This is the cause of introducing 4 byte cookie for MPTCP implementation.

The RFC 8684 B.1. says:
This is done with the TCP cookie request/response
options, of 2 bytes and 6-18 bytes, respectively (depending on the chosen cookie length).

So in my understanding, the "selected cookie size + TCPOLEN_FASTOPEN_BASE" = 6, is not prohibited by, and in the allowed range of the RFC 8684.

As you suggested I will document the size of the cookie, if there is no objections to above information :)

Dmytro.

Quoted 24 lines · Paolo Abeni
Quoted 9 lines · Paolo Abeni
Quoted 9 lines
include/linux/tcp.h +1 -0
index 48d8a363319e..d7092234d442 100644
@@ -54,7 +54,14 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
  /* TCP Fast Open */
  #define TCP_FASTOPEN_COOKIE_MIN	4	/* Min Fast Open Cookie size in bytes */
  #define TCP_FASTOPEN_COOKIE_MAX	16	/* Max Fast Open Cookie size in bytes */
+
Quoted 8 lines

include/linux/tcp.h static inline unsigned int tcp_optlen(const struct sk_buff *skb) · line 62

Quoted 5 lines
include/linux/tcp.h +4 -0
+#if IS_ENABLED(CONFIG_MPTCP)
+#define TCP_FASTOPEN_COOKIE_SIZE 4	/* the size employed by MPTCP impl. */
+#else
  #define TCP_FASTOPEN_COOKIE_SIZE 8	/* the size employed by this impl. */
+#endif

You really need to document this kind of changes in the code, possibly referring to the RFC bits requiring it.

Note that MPC + syn currently uses 24 bytes of TCP option spaces, and MPC + syn + ack is using 32 bytes, to there is enough room for 8 bytes cookies.

/P

maintainer
#13 lore raw
Quoted 40 lines · Dmytro SHYTYI

Hi Paolo,

AFAIK, TFO option requires more that 8 bytes, if cookie len is 8 bytes:

In file /net/ipv4/tcp_output.c (line 689):

static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
struct tcp_out_options *opts)
....

{
         if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) {
                 struct tcp_fastopen_cookie *foc = opts->fastopen_cookie;
                 u8 *p = (u8 *)ptr;
                 u32 len; /* Fast Open option length */

                 if (foc->exp) {
                         len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
                         *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) |
                                      TCPOPT_FASTOPEN_MAGIC);
                         p += TCPOLEN_EXP_FASTOPEN_BASE;
                 } else {
                         len = TCPOLEN_FASTOPEN_BASE + foc->len;
                         *p++ = TCPOPT_FASTOPEN;
                         *p++ = len;
                 }

                 memcpy(p, foc->val, foc->len);
                 if ((len & 3) == 2) {
                         p[foc->len] = TCPOPT_NOP;
                         p[foc->len + 1] = TCPOPT_NOP;
                 }
                 ptr += (len + 3) >> 2;
         }

...

Here we do have "len = TCPOLEN_FASTOPEN_BASE + foc->len" that is slightly more than 8 bytes.

This is the cause of introducing 4 byte cookie for MPTCP implementation.

Quoted 8 lines

The RFC 8684 B.1. says:
This is done with the TCP cookie request/response
options, of 2 bytes and 6-18 bytes, respectively (depending on the chosen cookie length).

So in my understanding, the "selected cookie size + TCPOLEN_FASTOPEN_BASE" = 6, is not prohibited by, and in the allowed range of the RFC 8684.

You are right, I underlooked the TFO option writing.

Quoted 2 lines

As you suggested I will document the size of the cookie, if there is no objections to above information :)

Shrinking the TFO cookie size has both security and functional impact:

- we do not want to change the TFO cookie size for TCP connection in MPTCP enabled build.
- dynamically selecting the TFO cookie size depending on the specific rsk type will add more complexity to the TCP code.

rfc8684 suggests we could remove the TS option from the synack packet. I think it's worthy to try such idea.

To do that, we need to change the 'mptcp_synack_options()' hook signature, to accept a 'struct tcp_out_options' as the 3rd argument, so that mptcp_synack_options() can clear the TCPOLEN_TSTAMP_ALIGNED bit when needed.

Thanks

Paolo

#14 lore raw

Hello Paolo,

Quoted 55 lines · Paolo Abeni
Quoted 40 lines · Dmytro SHYTYI

Hi Paolo,

AFAIK, TFO option requires more that 8 bytes, if cookie len is 8 bytes:

In file /net/ipv4/tcp_output.c (line 689):

static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp,
struct tcp_out_options *opts)
....

{
          if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) {
                  struct tcp_fastopen_cookie *foc = opts->fastopen_cookie;
                  u8 *p = (u8 *)ptr;
                  u32 len; /* Fast Open option length */

                  if (foc->exp) {
                          len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
                          *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) |
                                       TCPOPT_FASTOPEN_MAGIC);
                          p += TCPOLEN_EXP_FASTOPEN_BASE;
                  } else {
                          len = TCPOLEN_FASTOPEN_BASE + foc->len;
                          *p++ = TCPOPT_FASTOPEN;
                          *p++ = len;
                  }

                  memcpy(p, foc->val, foc->len);
                  if ((len & 3) == 2) {
                          p[foc->len] = TCPOPT_NOP;
                          p[foc->len + 1] = TCPOPT_NOP;
                  }
                  ptr += (len + 3) >> 2;
          }

...

Here we do have "len = TCPOLEN_FASTOPEN_BASE + foc->len" that is slightly more than 8 bytes.

This is the cause of introducing 4 byte cookie for MPTCP implementation.

Quoted 8 lines

The RFC 8684 B.1. says:
This is done with the TCP cookie request/response
options, of 2 bytes and 6-18 bytes, respectively (depending on the chosen cookie length).

So in my understanding, the "selected cookie size + TCPOLEN_FASTOPEN_BASE" = 6, is not prohibited by, and in the allowed range of the RFC 8684.

You are right, I underlooked the TFO option writing.

Quoted 2 lines

As you suggested I will document the size of the cookie, if there is no objections to above information :)

Quoted 6 lines

Shrinking the TFO cookie size has both security and functional impact:

- we do not want to change the TFO cookie size for TCP connection in MPTCP enabled build.
- dynamically selecting the TFO cookie size depending on the specific rsk type will add more complexity to the TCP code.

I agree with functional and future security impact in case if we reduce the cookie size.

Quoted 7 lines

rfc8684 suggests we could remove the TS option from the synack packet. I think it's worthy to try such idea.

To do that, we need to change the 'mptcp_synack_options()' hook signature, to accept a 'struct tcp_out_options' as the 3rd argument, so that mptcp_synack_options() can clear the TCPOLEN_TSTAMP_ALIGNED bit when needed.

With this we can try to keep "cookie len == 8". It will simplify things. I will look into it.

Quoted 4 lines

Thanks

Paolo

Thanks,
Dmytro.

#15 lore raw

Hello Paolo,

Quoted 70 lines · Dmytro SHYTYI

Hello Paolo,

Quoted 55 lines · Paolo Abeni
Quoted 40 lines · Dmytro SHYTYI

Hi Paolo,

AFAIK, TFO option requires more that 8 bytes, if cookie len is 8 bytes:

In file /net/ipv4/tcp_output.c (line 689):

static void tcp_options_write(__be32 *ptr, struct tcp_sock *tp, struct tcp_out_options *opts)
....
{
          if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) { struct tcp_fastopen_cookie *foc = opts->fastopen_cookie; u8 *p = (u8 *)ptr;
                  u32 len; /* Fast Open option length */

                  if (foc->exp) {
                          len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len; *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) | TCPOPT_FASTOPEN_MAGIC); p += TCPOLEN_EXP_FASTOPEN_BASE;
                  } else {
                          len = TCPOLEN_FASTOPEN_BASE + foc->len; *p++ = TCPOPT_FASTOPEN;
                          *p++ = len;
                  }

                  memcpy(p, foc->val, foc->len); if ((len & 3) == 2) { p[foc->len] = TCPOPT_NOP; p[foc->len + 1] = TCPOPT_NOP; }
                  ptr += (len + 3) >> 2;
          }
...

Here we do have  "len = TCPOLEN_FASTOPEN_BASE + foc->len" that is slightly more than 8 bytes.

This is the cause of introducing 4 byte cookie for MPTCP implementation.

Quoted 8 lines

The RFC 8684 B.1. says:
    This is done with the TCP cookie request/response options, of 2 bytes and 6-18 bytes, respectively (depending on the chosen cookie length).

So in my understanding, the "selected cookie size + TCPOLEN_FASTOPEN_BASE" = 6, is not prohibited by, and in the allowed range of the RFC 8684.

You are right, I underlooked the TFO option writing.

Quoted 2 lines

As you suggested I will document the size of the cookie, if there is no objections to above information :)

Quoted 6 lines

Shrinking the TFO cookie size has both security and functional impact:

- we do not want to change the TFO cookie size for TCP connection in MPTCP enabled build.
- dynamically selecting the TFO cookie size depending on the specific rsk type will add more complexity to the TCP code.

I agree with functional and future security impact in case if we reduce the cookie size.

Quoted 3 lines

rfc8684 suggests we could remove the TS option from the synack packet. I think it's worthy to try such idea.

Quoted 6 lines
Quoted 4 lines

To do that, we need to change the 'mptcp_synack_options()' hook signature, to accept a 'struct tcp_out_options' as the 3rd argument, so that mptcp_synack_options() can clear the TCPOLEN_TSTAMP_ALIGNED bit when needed.

With this we can try to keep "cookie len == 8". It will simplify things. I will look into it.

Thanks Paolo!

It looks like it works in my local setup with "MPTCP" and "cookie len == 8", while changing the function signature to:
bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, struct mptcp_out_options *opts, u16 *tcp_options)

and further, edit tcp_options with:

        *tcp_options ^= OPTION_TS;

Also I needed to do something like this in func "mptcp_synack_options":
*size = TCPOLEN_MPTCP_MPC_SYNACK - TCPOLEN_TSTAMP_ALIGNED + TCPOLEN_SACKPERM_ALIGNED;

This affected (excluded) some parts of my code that not anymore have impact on the TCP implementation.

Result:
tcpdump with 8 byte cookie len + mptcp option without TSvals in SYNACK:

Quoted 1 line
Quoted 1 line

cookie req:

2022-01-20 22:10:04.275317 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [S], seq 4140071331, win 64240, options [mss 1460,sackOK,TS val 608747398 ecr 0,nop,wscale 7,tfo  cookiereq,nop,nop,mptcp capable[bad opt]>
2022-01-20 22:10:04.275353 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags
Quoted 1 line
Quoted 1 line

cookie offer "0696fccb1b35cc39" + mptcp capable:

[S.], seq 2992182232, ack 4140071332, win 65160, options [mss 1460,nop,nop,sackOK,nop,wscale 7,tfo cookie 0696fccb1b35cc39,nop,nop,mptcp capable Unknown Version (1)], length 0

2022-01-20 22:10:04.275406 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [.], ack 1, win 502, options [mptcp capable Unknown Version (1)], length 0
2022-01-20 22:10:04.275535 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [P.], seq 1:4, ack 1, win 502, options [mptcp capable[bad opt]
2022-01-20 22:10:04.275597 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags [.], ack 4, win 510, options [nop,nop,TS val 458375399 ecr 608747398,mptcp dss ack 17405876484214860771], length 0
2022-01-20 22:10:04.275745 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [P.], seq 4:7, ack 1, win 502, options [mptcp dss ack 3584389301 seq 17405876484214860771 subseq 4 len 3,nop,nop], length 3
2022-01-20 22:10:04.275850 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags [.], ack 7, win 510, options [nop,nop,TS val 458375399 ecr 608747398,mptcp dss ack 17405876484214860774], length 0
2022-01-20 22:10:04.275967 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [P.], seq 7:10, ack 1, win 502, options [mptcp dss ack 3584389301 seq 17405876484214860774 subseq 7 len 3,nop,nop], length 3
2022-01-20 22:10:04.275977 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags [.], ack 10, win 510, options [nop,nop,TS val 458375399 ecr 608747398,mptcp dss ack 17405876484214860777], length 0
2022-01-20 22:10:04.276073 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [P.], seq 10:13, ack 1, win 502, options [mptcp dss ack 3584389301 seq 17405876484214860777 subseq 10 len 3,nop,nop], length 3
2022-01-20 22:10:04.276133 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags [.], ack 13, win 510, options [nop,nop,TS val 458375399 ecr 608747398,mptcp dss ack 17405876484214860780], length 0
2022-01-20 22:10:04.276156 IP 10.0.0.1.49572 > 10.0.0.2.7003: Flags [P.], seq 13:16, ack 1, win 502, options [mptcp dss ack 3584389301 seq 17405876484214860780 subseq 13 len 3,nop,nop], length 3
2022-01-20 22:10:04.276161 IP 10.0.0.2.7003 > 10.0.0.1.49572: Flags [.], ack 16, win 510, options [nop,nop,TS val 458375399 ecr 608747398,mptcp dss ack 17405876484214860783], length 0
2022-01-20 22:10:05.902411 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [S], seq 3696317251:3696317254, win 64240, options [mss 1460,sackOK,TS val 608749026 ecr 0,nop,wscale 7,tfo  cookie 0696fccb1b35cc39,nop,nop,mptcp capable[bad opt]>
2022-01-20 22:10:05.902456 IP 10.0.0.2.7003 > 10.0.0.1.49574: Flags [S.], seq 3169634712, ack 3696317255, win 65160, options [mss 1460,nop,nop,sackOK,nop,wscale 7,mptcp capable Unknown Version (1)], length 0
2022-01-20 22:10:05.902496 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [.], ack 1, win 502, options [mptcp capable Unknown Version (1)], length 0
2022-01-20 22:10:05.902559 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [P.], seq 1:4, ack 1, win 502, options [mptcp capable[bad opt]
2022-01-20 22:10:05.902597 IP 10.0.0.2.7003 > 10.0.0.1.49574: Flags [.], ack 4, win 510, options [nop,nop,TS val 458377026 ecr 608749026,mptcp dss ack 1878450330782657922], length 0
2022-01-20 22:10:05.902620 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [P.], seq 4:7, ack 1, win 502, options [mptcp dss ack 414760887 seq 2527731727539835193 subseq 4 len 3,nop,nop], length 3
2022-01-20 22:10:05.902638 IP 10.0.0.2.7003 > 10.0.0.1.49574: Flags [.], ack 7, win 510, options [nop,nop,TS val 458377026 ecr 608749026,mptcp dss ack 1878450330782657925], length 0
2022-01-20 22:10:05.902644 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [P.], seq 7:10, ack 1, win 502, options [mptcp dss ack 414760887 seq 2527731727539835196 subseq 7 len 3,nop,nop], length 3
2022-01-20 22:10:05.902647 IP 10.0.0.2.7003 > 10.0.0.1.49574: Flags [.], ack 10, win 510, options [nop,nop,TS val 458377026 ecr 608749026,mptcp dss ack 1878450330782657928], length 0
2022-01-20 22:10:05.902653 IP 10.0.0.1.49574 > 10.0.0.2.7003: Flags [P.], seq 10:13, ack 1, win 502, options [mptcp dss ack 414760887 seq 2527731727539835199 subseq 10 len 3,nop,nop], length 3
2022-01-20 22:10:05.902680 IP 10.0.0.2.7003 > 10.0.0.1.49574: Flags [.], ack 13, win 510, options [nop,nop,TS val 458377026 ecr 608749026,mptcp dss ack 1878450330782657931], length 0

Dmytro.

Quoted 7 lines
Quoted 4 lines

Thanks

Paolo

Thanks,
Dmytro.

#16 lore raw
In reply to Paolo Abeni

Hello Paolo,

Quoted 16 lines · Paolo Abeni

Hello,

Quoted 13 lines · Dmytro SHYTYI

This set of patches will bring "Fast Open" Option support to MPTCP. The aim of Fast Open Mechanism is to eliminate one round trip time from a TCP conversation by allowing data to be included as part of the SYN segment that initiates the connection.

IETF RFC 8684: Appendix B. TCP Fast Open and MPTCP.

[PATCH v2] includes "client-server" partial support for :
1. MPTCP cookie request from client.
2. MPTCP cookie offering from server.
3. MPTCP SYN+DATA+COOKIE from client.
4. subsequent write + read on the opened socket.

Quoted 4 lines
Quoted 2 lines

This patch is Work In Progress and an early draft shared due community request.

It looks like this is more far from an RFC status than I thought.

I agree.

Quoted 9 lines

There are a number of tasks to be completed for that:
- do not comment out existing working code, expecially TCP one.
- split the patch in several small one, clearly documenting in the individual commit message what each patch is doing and why. A possible skeleton could be:
* create the needed hooks in the TCP code, providing a dummy implementation. Each hook will need a solid justification, and they should not affect the TCP critical path. The number of added hooks should be as low as possible.

Quoted 8 lines

You should try to use the existing hooking whenever it should be possible.
No patch should touch the TCP code after the hooks are created. Side note: I'm unsure if any additional hooks are really needed.
* add the real MPTCP impl, possibly with separate patches for the client and the server side
* add self-tests
- avoid introducing white-space only changes.

Thank you for sharing this. I'm going to take this into account. I might participate in the next MPTCP meeting to clarify some points.

Quoted 2 lines

There are a bunch of specific inline notes below, which are still very important.

Thanks!

Quoted 22 lines
Quoted 22 lines
---
  include/linux/tcp.h             |  7 ++++
  net/ipv4/inet_connection_sock.c |  3 +-
  net/ipv4/tcp_fastopen.c         | 42 +++++++++++++++++++----
  net/ipv4/tcp_input.c            | 16 +++++----
  net/mptcp/protocol.c            | 59 ++++++++++++++++++++++++++++++---
  net/mptcp/sockopt.c             | 40 ++++++++++++++++++++++
  net/mptcp/subflow.c             | 14 ++++++++
  7 files changed, 162 insertions(+), 19 deletions(-)

/* TCP Fast Open Cookie as stored in memory */
struct tcp_fastopen_cookie {

net/ipv4/inet_connection_sock.c +0 -0
index f7fea3a7c5e6..4b4159c0258d 100644
@@ -501,7 +501,8 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
  	req = reqsk_queue_remove(queue, sk);
  	newsk = req->sk;
 
Quoted 10 lines

net/ipv4/inet_connection_sock.c struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern) · line 508

Quoted 6 lines
net/ipv4/inet_connection_sock.c +2 -1
-	if (sk->sk_protocol == IPPROTO_TCP &&
+	if ((sk->sk_protocol == IPPROTO_TCP ||
+	     sk->sk_protocol == IPPROTO_MPTCP) &&
  	    tcp_rsk(req)->tfo_listener) {
  		spin_lock_bh(&queue->fastopenq.lock);
  		if (tcp_rsk(req)->tfo_listener) {

This chunk is really not needed. mptcp invokes inet_csk_accept(), passing the initial subflow as the first argument. That socket is really a TCP one.

I agree.

Quoted 4 lines

Cheers,

Paolo

Best regards,
Dmytro