[PATCH mptcp-next 2/3] Squash to "mptcp: infinite mapping receiving"

Geliang Tang posted 3 patches 4 years ago
Maintainers: "David S. Miller" <davem@davemloft.net>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Matthieu Baerts <matthieu.baerts@tessares.net>, Jakub Kicinski <kuba@kernel.org>, Shuah Khan <shuah@kernel.org>
There is a newer version of this series
[PATCH mptcp-next 2/3] Squash to "mptcp: infinite mapping receiving"
Posted by Geliang Tang 4 years ago
Add a flag infinite_expect in struct mptcp_subflow_context, to avoid
resetting the subflow when the infinite map wasn't received.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 net/mptcp/protocol.h | 1 +
 net/mptcp/subflow.c  | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 6bcf6cbded45..ddaa86acadce 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -451,6 +451,7 @@ struct mptcp_subflow_context {
 		send_fastclose : 1,
 		send_infinite_map : 1,
 		infinite_sent : 1,
+		infinite_expect : 1,
 		rx_eof : 1,
 		can_ack : 1,        /* only after processing the remote a key */
 		disposable : 1,	    /* ctx can be free at ulp release time */
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index c8126986793e..e41161048498 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -964,7 +964,9 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
 
 	data_len = mpext->data_len;
 	if (data_len == 0) {
+		pr_debug("infinite mapping received");
 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
+		subflow->infinite_expect = 0;
 		subflow->map_data_len = 0;
 		return MAPPING_INVALID;
 	}
@@ -1174,12 +1176,15 @@ static bool subflow_check_data_avail(struct sock *ssk)
 				tcp_send_active_reset(ssk, GFP_ATOMIC);
 				while ((skb = skb_peek(&ssk->sk_receive_queue)))
 					sk_eat_skb(ssk, skb);
+			} else {
+				subflow->infinite_expect = 1;
 			}
 			WRITE_ONCE(subflow->data_avail, 0);
 			return true;
 		}
 
-		if ((subflow->mp_join || subflow->fully_established) && subflow->map_data_len) {
+		if ((subflow->mp_join || subflow->fully_established) &&
+		    !subflow->infinite_expect && subflow->map_data_len) {
 			/* fatal protocol error, close the socket.
 			 * subflow_error_report() will introduce the appropriate barriers
 			 */
-- 
2.31.1


Re: [PATCH mptcp-next 2/3] Squash to "mptcp: infinite mapping receiving"
Posted by Mat Martineau 4 years ago
On Tue, 25 Jan 2022, Geliang Tang wrote:

> Add a flag infinite_expect in struct mptcp_subflow_context, to avoid
> resetting the subflow when the infinite map wasn't received.
>

Could you give some more details about this too? Does the reset happen 
when the infinite mapping is lost and the peer stops sending MPTCP 
options?

I think a flag like infinite_expect may be needed, but with a bit more 
complexity to discard in-flight data from the peer until the expected 
infinite mapping arrives. Look back at earlier discussions about MP_FAIL 
and dropping data:

https://lore.kernel.org/mptcp/DEA13B0F-B535-42A3-95C6-595859A1CD55@apple.com/


> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> net/mptcp/protocol.h | 1 +
> net/mptcp/subflow.c  | 7 ++++++-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
> index 6bcf6cbded45..ddaa86acadce 100644
> --- a/net/mptcp/protocol.h
> +++ b/net/mptcp/protocol.h
> @@ -451,6 +451,7 @@ struct mptcp_subflow_context {
> 		send_fastclose : 1,
> 		send_infinite_map : 1,
> 		infinite_sent : 1,
> +		infinite_expect : 1,
> 		rx_eof : 1,
> 		can_ack : 1,        /* only after processing the remote a key */
> 		disposable : 1,	    /* ctx can be free at ulp release time */
> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index c8126986793e..e41161048498 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
> @@ -964,7 +964,9 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
>
> 	data_len = mpext->data_len;
> 	if (data_len == 0) {
> +		pr_debug("infinite mapping received");
> 		MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
> +		subflow->infinite_expect = 0;
> 		subflow->map_data_len = 0;
> 		return MAPPING_INVALID;
> 	}
> @@ -1174,12 +1176,15 @@ static bool subflow_check_data_avail(struct sock *ssk)
> 				tcp_send_active_reset(ssk, GFP_ATOMIC);
> 				while ((skb = skb_peek(&ssk->sk_receive_queue)))
> 					sk_eat_skb(ssk, skb);
> +			} else {
> +				subflow->infinite_expect = 1;
> 			}
> 			WRITE_ONCE(subflow->data_avail, 0);
> 			return true;
> 		}
>
> -		if ((subflow->mp_join || subflow->fully_established) && subflow->map_data_len) {
> +		if ((subflow->mp_join || subflow->fully_established) &&
> +		    !subflow->infinite_expect && subflow->map_data_len) {
> 			/* fatal protocol error, close the socket.
> 			 * subflow_error_report() will introduce the appropriate barriers
> 			 */
> -- 
> 2.31.1
>
>
>

--
Mat Martineau
Intel