Skip to content

Commit

Permalink
mptcp: use "middlebox interference" for MP_TCPRST in case map_valid i…
Browse files Browse the repository at this point in the history
…s false

RFC8684 suggests use of "Middlebox interference (code 0x06)" in case of
MPJ subflow that carries data at TCP level with no DSS sub-option. This
is generally the case when mpext is NULL or mpext->use_map is 0: use a
dedicated value of 'mapping_status' and use it before closing the socket
in subflow_check_data_avail().

Link: #518 (comment)
Signed-off-by: Davide Caratti <[email protected]>
Message-Id: <4b2cee91613e597a172b46bb0d9d3143053c52da.1728408247.git.dcaratti@redhat.com>
  • Loading branch information
dcaratti authored and Patchew Applier committed Oct 8, 2024
1 parent 8837df5 commit 184902b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,8 @@ enum mapping_status {
MAPPING_EMPTY,
MAPPING_DATA_FIN,
MAPPING_DUMMY,
MAPPING_BAD_CSUM
MAPPING_BAD_CSUM,
MAPPING_NODSS
};

static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
Expand Down Expand Up @@ -1118,7 +1119,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
}

if (!subflow->map_valid)
return MAPPING_INVALID;
return MAPPING_NODSS;

goto validate_seq;
}
Expand Down Expand Up @@ -1332,7 +1333,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
status = get_mapping_status(ssk, msk);
trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
if (unlikely(status == MAPPING_INVALID || status == MAPPING_DUMMY ||
status == MAPPING_BAD_CSUM))
status == MAPPING_BAD_CSUM || status == MAPPING_NODSS))
goto fallback;

if (status != MAPPING_OK)
Expand Down Expand Up @@ -1385,7 +1386,13 @@ static bool subflow_check_data_avail(struct sock *ssk)
* subflow_error_report() will introduce the appropriate barriers
*/
subflow->reset_transient = 0;
subflow->reset_reason = MPTCP_RST_EMPTCP;
switch (status) {
case MAPPING_NODSS:
subflow->reset_reason = MPTCP_RST_EMIDDLEBOX;
break;
default:
subflow->reset_reason = MPTCP_RST_EMPTCP;
}

reset:
WRITE_ONCE(ssk->sk_err, EBADMSG);
Expand Down

0 comments on commit 184902b

Please sign in to comment.