[RFC PATCH mptcp-next 3/4] tcp: Check for the presence of a MP_JOIN option

Mat Martineau posted 4 patches 3 years, 11 months ago
Maintainers: "David S. Miller" <davem@davemloft.net>, David Ahern <dsahern@kernel.org>, Matthieu Baerts <matthieu.baerts@tessares.net>, Eric Dumazet <edumazet@google.com>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Jakub Kicinski <kuba@kernel.org>
[RFC PATCH mptcp-next 3/4] tcp: Check for the presence of a MP_JOIN option
Posted by Mat Martineau 3 years, 11 months ago
Add a bit to struct tcp_options_received and set that bit if a
MPTCP option with the MP_JOIN subtype is present in a TCP header.

Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
---
 include/linux/tcp.h  | 3 ++-
 net/ipv4/tcp_input.c | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 1168302b7927..46a14bce8019 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -93,7 +93,8 @@ struct tcp_options_received {
 		snd_wscale : 4,	/* Window scaling received from sender	*/
 		rcv_wscale : 4;	/* Window scaling to send to receiver	*/
 	u8	saw_unknown:1,	/* Received unknown option		*/
-		unused:7;
+		saw_mp_join:1,	/* Received MPTCP MP_JOIN		*/
+		unused:6;
 	u8	num_sacks;	/* Number of SACK blocks		*/
 	u16	user_mss;	/* mss requested by user in ioctl	*/
 	u16	mss_clamp;	/* Maximal mss, negotiated at connection setup */
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 7eb02f9da3c9..845f0e6906b5 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4122,6 +4122,14 @@ void tcp_parse_options(const struct net *net,
 				opt_rx->saw_unknown = 1;
 				break;
 
+			case TCPOPT_MPTCP:
+				__u8 mptcp_subtype = *ptr >> 4;
+
+				if (mptcp_subtype == MPTCPOPT_MP_JOIN)
+					opt_rx->saw_mp_join = 1;
+
+				break;
+
 			default:
 				opt_rx->saw_unknown = 1;
 			}
-- 
2.35.1