mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 14:43:58 +08:00
mptcp: add csum_reqd in mptcp_options_received
This patch added a new flag csum_reqd in struct mptcp_options_received, if the flag MPTCP_CAP_CHECKSUM_REQD is set in the receiving MP_CAPABLE suboption, set this flag. In mptcp_sk_clone and subflow_finish_connect, if the csum_reqd flag is set, enable the msk->csum_enabled flag. Acked-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Geliang Tang <geliangtang@gmail.com> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c863225b79
commit
0625118115
@ -71,11 +71,9 @@ static void mptcp_parse_option(const struct sk_buff *skb,
|
|||||||
* "If a checksum is not present when its use has been
|
* "If a checksum is not present when its use has been
|
||||||
* negotiated, the receiver MUST close the subflow with a RST as
|
* negotiated, the receiver MUST close the subflow with a RST as
|
||||||
* it is considered broken."
|
* it is considered broken."
|
||||||
*
|
|
||||||
* We don't implement DSS checksum - fall back to TCP.
|
|
||||||
*/
|
*/
|
||||||
if (flags & MPTCP_CAP_CHECKSUM_REQD)
|
if (flags & MPTCP_CAP_CHECKSUM_REQD)
|
||||||
break;
|
mp_opt->csum_reqd = 1;
|
||||||
|
|
||||||
mp_opt->mp_capable = 1;
|
mp_opt->mp_capable = 1;
|
||||||
if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) {
|
if (opsize >= TCPOLEN_MPTCP_MPC_SYNACK) {
|
||||||
@ -327,6 +325,8 @@ void mptcp_get_options(const struct sock *sk,
|
|||||||
const struct sk_buff *skb,
|
const struct sk_buff *skb,
|
||||||
struct mptcp_options_received *mp_opt)
|
struct mptcp_options_received *mp_opt)
|
||||||
{
|
{
|
||||||
|
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
|
||||||
|
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
|
||||||
const struct tcphdr *th = tcp_hdr(skb);
|
const struct tcphdr *th = tcp_hdr(skb);
|
||||||
const unsigned char *ptr;
|
const unsigned char *ptr;
|
||||||
int length;
|
int length;
|
||||||
@ -342,6 +342,7 @@ void mptcp_get_options(const struct sock *sk,
|
|||||||
mp_opt->dss = 0;
|
mp_opt->dss = 0;
|
||||||
mp_opt->mp_prio = 0;
|
mp_opt->mp_prio = 0;
|
||||||
mp_opt->reset = 0;
|
mp_opt->reset = 0;
|
||||||
|
mp_opt->csum_reqd = READ_ONCE(msk->csum_enabled);
|
||||||
|
|
||||||
length = (th->doff * 4) - sizeof(struct tcphdr);
|
length = (th->doff * 4) - sizeof(struct tcphdr);
|
||||||
ptr = (const unsigned char *)(th + 1);
|
ptr = (const unsigned char *)(th + 1);
|
||||||
|
@ -2810,6 +2810,8 @@ struct sock *mptcp_sk_clone(const struct sock *sk,
|
|||||||
msk->token = subflow_req->token;
|
msk->token = subflow_req->token;
|
||||||
msk->subflow = NULL;
|
msk->subflow = NULL;
|
||||||
WRITE_ONCE(msk->fully_established, false);
|
WRITE_ONCE(msk->fully_established, false);
|
||||||
|
if (mp_opt->csum_reqd)
|
||||||
|
WRITE_ONCE(msk->csum_enabled, true);
|
||||||
|
|
||||||
msk->write_seq = subflow_req->idsn + 1;
|
msk->write_seq = subflow_req->idsn + 1;
|
||||||
msk->snd_nxt = msk->write_seq;
|
msk->snd_nxt = msk->write_seq;
|
||||||
|
@ -133,6 +133,7 @@ struct mptcp_options_received {
|
|||||||
rm_addr : 1,
|
rm_addr : 1,
|
||||||
mp_prio : 1,
|
mp_prio : 1,
|
||||||
echo : 1,
|
echo : 1,
|
||||||
|
csum_reqd : 1,
|
||||||
backup : 1;
|
backup : 1;
|
||||||
u32 token;
|
u32 token;
|
||||||
u32 nonce;
|
u32 nonce;
|
||||||
|
@ -405,6 +405,8 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
|
|||||||
goto fallback;
|
goto fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mp_opt.csum_reqd)
|
||||||
|
WRITE_ONCE(mptcp_sk(parent)->csum_enabled, true);
|
||||||
subflow->mp_capable = 1;
|
subflow->mp_capable = 1;
|
||||||
subflow->can_ack = 1;
|
subflow->can_ack = 1;
|
||||||
subflow->remote_key = mp_opt.sndr_key;
|
subflow->remote_key = mp_opt.sndr_key;
|
||||||
|
Loading…
Reference in New Issue
Block a user