Skip to content

Commit 3aced73

Browse files
matttbeintel-lab-lkp
authored andcommitted
mptcp: only fallback due to inf mapping if allowed
Any fallback should happen only if allowed, so only if this variable is set: msk->allow_infinite_fallback. This boolean will be set to false once MPTCP-specific operations acting on the whole MPTCP connection vs the initial path have been done, e.g. a second path has been created, or an MPTCP re-injection -- yes, possible even with a single subflow. In other words, the !msk->allow_infinite_fallback condition should be placed first. If it is no longer possible to do a fallback, there should not be any bypass, e.g. when receiving an infinite mapping. Now, regarding the conditions to do a fallback, the RFC mentions [1] that if the checksum is used, a fallback is only possible when "it is known that all unacknowledged data in flight is contiguous (which will usually be the case with a single subflow)". In other words, if the checksum is used, a fallback is possible when the other peer sent an infinite mapping indicating the flow has been altered. Note that the issue is present since a merge commit, where both subflow_can_fallback() and the previous extra condition with 'subflow->map_data_len' got introduced. Fixes: d7e6f58 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net") Link: https://datatracker.ietf.org/doc/html/rfc8684#section-3.7-11 [1] Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
1 parent e149927 commit 3aced73

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

net/mptcp/subflow.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,16 +1298,20 @@ static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ss
12981298
mptcp_schedule_work(sk);
12991299
}
13001300

1301-
static bool subflow_can_fallback(struct mptcp_subflow_context *subflow)
1301+
static bool subflow_can_fallback(struct mptcp_subflow_context *subflow,
1302+
enum mapping_status status)
13021303
{
13031304
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
13041305

1305-
if (subflow->mp_join)
1306+
/* If not allowed (additional paths, MPTCP reinjections): no fallback */
1307+
if (!READ_ONCE(msk->allow_infinite_fallback))
13061308
return false;
1307-
else if (READ_ONCE(msk->csum_enabled))
1309+
1310+
/* More strict with csum: fallback in 2 cases: inf map or never valid */
1311+
if (status != MAPPING_INFINITE && READ_ONCE(msk->csum_enabled))
13081312
return !subflow->valid_csum_seen;
1309-
else
1310-
return READ_ONCE(msk->allow_infinite_fallback);
1313+
1314+
return true;
13111315
}
13121316

13131317
static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk)
@@ -1406,7 +1410,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
14061410
return true;
14071411
}
14081412

1409-
if (!subflow_can_fallback(subflow) && status != MAPPING_INFINITE) {
1413+
if (!subflow_can_fallback(subflow, status)) {
14101414
/* fatal protocol error, close the socket.
14111415
* subflow_error_report() will introduce the appropriate barriers
14121416
*/

0 commit comments

Comments
 (0)