Commit 237c3851 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'mptcp-close-subflow-when-receiving-tcp-fin-and-misc'

Matthieu Baerts says:

====================
mptcp: close subflow when receiving TCP+FIN and misc.

Here are different fixes:

Patch 1 closes the subflow after having received a FIN, instead
of leaving it half-closed until the end of the MPTCP connection.
A fix for v5.12.

Patch 2 validates the previous patch.

Patch 3 is a fix for a recent fix to check both directions for the
backup flag. It can follow the 'Fixes' commit and be backported up
to v5.7.

Patch 4 adds a missing \n at the end of pr_debug(), causing debug
messages to be displayed with a delay, which confuses the debugger.
A fix for v5.6.
====================

Link: https://patch.msgid.link/20240826-net-mptcp-close-extra-sf-fin-v1-0-905199fe1172@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents bac76cf8 cb41b195
...@@ -68,12 +68,12 @@ void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflo ...@@ -68,12 +68,12 @@ void __mptcp_fastopen_gen_msk_ackseq(struct mptcp_sock *msk, struct mptcp_subflo
skb = skb_peek_tail(&sk->sk_receive_queue); skb = skb_peek_tail(&sk->sk_receive_queue);
if (skb) { if (skb) {
WARN_ON_ONCE(MPTCP_SKB_CB(skb)->end_seq); WARN_ON_ONCE(MPTCP_SKB_CB(skb)->end_seq);
pr_debug("msk %p moving seq %llx -> %llx end_seq %llx -> %llx", sk, pr_debug("msk %p moving seq %llx -> %llx end_seq %llx -> %llx\n", sk,
MPTCP_SKB_CB(skb)->map_seq, MPTCP_SKB_CB(skb)->map_seq + msk->ack_seq, MPTCP_SKB_CB(skb)->map_seq, MPTCP_SKB_CB(skb)->map_seq + msk->ack_seq,
MPTCP_SKB_CB(skb)->end_seq, MPTCP_SKB_CB(skb)->end_seq + msk->ack_seq); MPTCP_SKB_CB(skb)->end_seq, MPTCP_SKB_CB(skb)->end_seq + msk->ack_seq);
MPTCP_SKB_CB(skb)->map_seq += msk->ack_seq; MPTCP_SKB_CB(skb)->map_seq += msk->ack_seq;
MPTCP_SKB_CB(skb)->end_seq += msk->ack_seq; MPTCP_SKB_CB(skb)->end_seq += msk->ack_seq;
} }
pr_debug("msk=%p ack_seq=%llx", msk, msk->ack_seq); pr_debug("msk=%p ack_seq=%llx\n", msk, msk->ack_seq);
} }
...@@ -117,7 +117,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -117,7 +117,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD; mp_opt->suboptions |= OPTION_MPTCP_CSUMREQD;
ptr += 2; ptr += 2;
} }
pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u", pr_debug("MP_CAPABLE version=%x, flags=%x, optlen=%d sndr=%llu, rcvr=%llu len=%d csum=%u\n",
version, flags, opsize, mp_opt->sndr_key, version, flags, opsize, mp_opt->sndr_key,
mp_opt->rcvr_key, mp_opt->data_len, mp_opt->csum); mp_opt->rcvr_key, mp_opt->data_len, mp_opt->csum);
break; break;
...@@ -131,7 +131,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -131,7 +131,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
ptr += 4; ptr += 4;
mp_opt->nonce = get_unaligned_be32(ptr); mp_opt->nonce = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
pr_debug("MP_JOIN bkup=%u, id=%u, token=%u, nonce=%u", pr_debug("MP_JOIN bkup=%u, id=%u, token=%u, nonce=%u\n",
mp_opt->backup, mp_opt->join_id, mp_opt->backup, mp_opt->join_id,
mp_opt->token, mp_opt->nonce); mp_opt->token, mp_opt->nonce);
} else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) { } else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) {
...@@ -142,19 +142,19 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -142,19 +142,19 @@ static void mptcp_parse_option(const struct sk_buff *skb,
ptr += 8; ptr += 8;
mp_opt->nonce = get_unaligned_be32(ptr); mp_opt->nonce = get_unaligned_be32(ptr);
ptr += 4; ptr += 4;
pr_debug("MP_JOIN bkup=%u, id=%u, thmac=%llu, nonce=%u", pr_debug("MP_JOIN bkup=%u, id=%u, thmac=%llu, nonce=%u\n",
mp_opt->backup, mp_opt->join_id, mp_opt->backup, mp_opt->join_id,
mp_opt->thmac, mp_opt->nonce); mp_opt->thmac, mp_opt->nonce);
} else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) { } else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) {
mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK; mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK;
ptr += 2; ptr += 2;
memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN); memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN);
pr_debug("MP_JOIN hmac"); pr_debug("MP_JOIN hmac\n");
} }
break; break;
case MPTCPOPT_DSS: case MPTCPOPT_DSS:
pr_debug("DSS"); pr_debug("DSS\n");
ptr++; ptr++;
/* we must clear 'mpc_map' be able to detect MP_CAPABLE /* we must clear 'mpc_map' be able to detect MP_CAPABLE
...@@ -169,7 +169,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -169,7 +169,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0; mp_opt->ack64 = (flags & MPTCP_DSS_ACK64) != 0;
mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK); mp_opt->use_ack = (flags & MPTCP_DSS_HAS_ACK);
pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d", pr_debug("data_fin=%d dsn64=%d use_map=%d ack64=%d use_ack=%d\n",
mp_opt->data_fin, mp_opt->dsn64, mp_opt->data_fin, mp_opt->dsn64,
mp_opt->use_map, mp_opt->ack64, mp_opt->use_map, mp_opt->ack64,
mp_opt->use_ack); mp_opt->use_ack);
...@@ -207,7 +207,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -207,7 +207,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
ptr += 4; ptr += 4;
} }
pr_debug("data_ack=%llu", mp_opt->data_ack); pr_debug("data_ack=%llu\n", mp_opt->data_ack);
} }
if (mp_opt->use_map) { if (mp_opt->use_map) {
...@@ -231,7 +231,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -231,7 +231,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
ptr += 2; ptr += 2;
} }
pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u", pr_debug("data_seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n",
mp_opt->data_seq, mp_opt->subflow_seq, mp_opt->data_seq, mp_opt->subflow_seq,
mp_opt->data_len, !!(mp_opt->suboptions & OPTION_MPTCP_CSUMREQD), mp_opt->data_len, !!(mp_opt->suboptions & OPTION_MPTCP_CSUMREQD),
mp_opt->csum); mp_opt->csum);
...@@ -293,7 +293,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -293,7 +293,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->ahmac = get_unaligned_be64(ptr); mp_opt->ahmac = get_unaligned_be64(ptr);
ptr += 8; ptr += 8;
} }
pr_debug("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d", pr_debug("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d\n",
(mp_opt->addr.family == AF_INET6) ? "6" : "", (mp_opt->addr.family == AF_INET6) ? "6" : "",
mp_opt->addr.id, mp_opt->ahmac, mp_opt->echo, ntohs(mp_opt->addr.port)); mp_opt->addr.id, mp_opt->ahmac, mp_opt->echo, ntohs(mp_opt->addr.port));
break; break;
...@@ -309,7 +309,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -309,7 +309,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->rm_list.nr = opsize - TCPOLEN_MPTCP_RM_ADDR_BASE; mp_opt->rm_list.nr = opsize - TCPOLEN_MPTCP_RM_ADDR_BASE;
for (i = 0; i < mp_opt->rm_list.nr; i++) for (i = 0; i < mp_opt->rm_list.nr; i++)
mp_opt->rm_list.ids[i] = *ptr++; mp_opt->rm_list.ids[i] = *ptr++;
pr_debug("RM_ADDR: rm_list_nr=%d", mp_opt->rm_list.nr); pr_debug("RM_ADDR: rm_list_nr=%d\n", mp_opt->rm_list.nr);
break; break;
case MPTCPOPT_MP_PRIO: case MPTCPOPT_MP_PRIO:
...@@ -318,7 +318,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -318,7 +318,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->suboptions |= OPTION_MPTCP_PRIO; mp_opt->suboptions |= OPTION_MPTCP_PRIO;
mp_opt->backup = *ptr++ & MPTCP_PRIO_BKUP; mp_opt->backup = *ptr++ & MPTCP_PRIO_BKUP;
pr_debug("MP_PRIO: prio=%d", mp_opt->backup); pr_debug("MP_PRIO: prio=%d\n", mp_opt->backup);
break; break;
case MPTCPOPT_MP_FASTCLOSE: case MPTCPOPT_MP_FASTCLOSE:
...@@ -329,7 +329,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -329,7 +329,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
mp_opt->rcvr_key = get_unaligned_be64(ptr); mp_opt->rcvr_key = get_unaligned_be64(ptr);
ptr += 8; ptr += 8;
mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE; mp_opt->suboptions |= OPTION_MPTCP_FASTCLOSE;
pr_debug("MP_FASTCLOSE: recv_key=%llu", mp_opt->rcvr_key); pr_debug("MP_FASTCLOSE: recv_key=%llu\n", mp_opt->rcvr_key);
break; break;
case MPTCPOPT_RST: case MPTCPOPT_RST:
...@@ -343,7 +343,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -343,7 +343,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
flags = *ptr++; flags = *ptr++;
mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT; mp_opt->reset_transient = flags & MPTCP_RST_TRANSIENT;
mp_opt->reset_reason = *ptr; mp_opt->reset_reason = *ptr;
pr_debug("MP_RST: transient=%u reason=%u", pr_debug("MP_RST: transient=%u reason=%u\n",
mp_opt->reset_transient, mp_opt->reset_reason); mp_opt->reset_transient, mp_opt->reset_reason);
break; break;
...@@ -354,7 +354,7 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -354,7 +354,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
ptr += 2; ptr += 2;
mp_opt->suboptions |= OPTION_MPTCP_FAIL; mp_opt->suboptions |= OPTION_MPTCP_FAIL;
mp_opt->fail_seq = get_unaligned_be64(ptr); mp_opt->fail_seq = get_unaligned_be64(ptr);
pr_debug("MP_FAIL: data_seq=%llu", mp_opt->fail_seq); pr_debug("MP_FAIL: data_seq=%llu\n", mp_opt->fail_seq);
break; break;
default: default:
...@@ -417,7 +417,7 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb, ...@@ -417,7 +417,7 @@ bool mptcp_syn_options(struct sock *sk, const struct sk_buff *skb,
*size = TCPOLEN_MPTCP_MPC_SYN; *size = TCPOLEN_MPTCP_MPC_SYN;
return true; return true;
} else if (subflow->request_join) { } else if (subflow->request_join) {
pr_debug("remote_token=%u, nonce=%u", subflow->remote_token, pr_debug("remote_token=%u, nonce=%u\n", subflow->remote_token,
subflow->local_nonce); subflow->local_nonce);
opts->suboptions = OPTION_MPTCP_MPJ_SYN; opts->suboptions = OPTION_MPTCP_MPJ_SYN;
opts->join_id = subflow->local_id; opts->join_id = subflow->local_id;
...@@ -500,7 +500,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, ...@@ -500,7 +500,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
*size = TCPOLEN_MPTCP_MPC_ACK; *size = TCPOLEN_MPTCP_MPC_ACK;
} }
pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d", pr_debug("subflow=%p, local_key=%llu, remote_key=%llu map_len=%d\n",
subflow, subflow->local_key, subflow->remote_key, subflow, subflow->local_key, subflow->remote_key,
data_len); data_len);
...@@ -509,7 +509,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb, ...@@ -509,7 +509,7 @@ static bool mptcp_established_options_mp(struct sock *sk, struct sk_buff *skb,
opts->suboptions = OPTION_MPTCP_MPJ_ACK; opts->suboptions = OPTION_MPTCP_MPJ_ACK;
memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN); memcpy(opts->hmac, subflow->hmac, MPTCPOPT_HMAC_LEN);
*size = TCPOLEN_MPTCP_MPJ_ACK; *size = TCPOLEN_MPTCP_MPJ_ACK;
pr_debug("subflow=%p", subflow); pr_debug("subflow=%p\n", subflow);
/* we can use the full delegate action helper only from BH context /* we can use the full delegate action helper only from BH context
* If we are in process context - sk is flushing the backlog at * If we are in process context - sk is flushing the backlog at
...@@ -675,7 +675,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * ...@@ -675,7 +675,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
*size = len; *size = len;
if (drop_other_suboptions) { if (drop_other_suboptions) {
pr_debug("drop other suboptions"); pr_debug("drop other suboptions\n");
opts->suboptions = 0; opts->suboptions = 0;
/* note that e.g. DSS could have written into the memory /* note that e.g. DSS could have written into the memory
...@@ -695,7 +695,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * ...@@ -695,7 +695,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *
} else { } else {
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADDTX);
} }
pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d", pr_debug("addr_id=%d, ahmac=%llu, echo=%d, port=%d\n",
opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port)); opts->addr.id, opts->ahmac, echo, ntohs(opts->addr.port));
return true; return true;
...@@ -726,7 +726,7 @@ static bool mptcp_established_options_rm_addr(struct sock *sk, ...@@ -726,7 +726,7 @@ static bool mptcp_established_options_rm_addr(struct sock *sk,
opts->rm_list = rm_list; opts->rm_list = rm_list;
for (i = 0; i < opts->rm_list.nr; i++) for (i = 0; i < opts->rm_list.nr; i++)
pr_debug("rm_list_ids[%d]=%d", i, opts->rm_list.ids[i]); pr_debug("rm_list_ids[%d]=%d\n", i, opts->rm_list.ids[i]);
MPTCP_ADD_STATS(sock_net(sk), MPTCP_MIB_RMADDRTX, opts->rm_list.nr); MPTCP_ADD_STATS(sock_net(sk), MPTCP_MIB_RMADDRTX, opts->rm_list.nr);
return true; return true;
} }
...@@ -752,7 +752,7 @@ static bool mptcp_established_options_mp_prio(struct sock *sk, ...@@ -752,7 +752,7 @@ static bool mptcp_established_options_mp_prio(struct sock *sk,
opts->suboptions |= OPTION_MPTCP_PRIO; opts->suboptions |= OPTION_MPTCP_PRIO;
opts->backup = subflow->request_bkup; opts->backup = subflow->request_bkup;
pr_debug("prio=%d", opts->backup); pr_debug("prio=%d\n", opts->backup);
return true; return true;
} }
...@@ -794,7 +794,7 @@ static bool mptcp_established_options_fastclose(struct sock *sk, ...@@ -794,7 +794,7 @@ static bool mptcp_established_options_fastclose(struct sock *sk,
opts->suboptions |= OPTION_MPTCP_FASTCLOSE; opts->suboptions |= OPTION_MPTCP_FASTCLOSE;
opts->rcvr_key = READ_ONCE(msk->remote_key); opts->rcvr_key = READ_ONCE(msk->remote_key);
pr_debug("FASTCLOSE key=%llu", opts->rcvr_key); pr_debug("FASTCLOSE key=%llu\n", opts->rcvr_key);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFASTCLOSETX);
return true; return true;
} }
...@@ -816,7 +816,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk, ...@@ -816,7 +816,7 @@ static bool mptcp_established_options_mp_fail(struct sock *sk,
opts->suboptions |= OPTION_MPTCP_FAIL; opts->suboptions |= OPTION_MPTCP_FAIL;
opts->fail_seq = subflow->map_seq; opts->fail_seq = subflow->map_seq;
pr_debug("MP_FAIL fail_seq=%llu", opts->fail_seq); pr_debug("MP_FAIL fail_seq=%llu\n", opts->fail_seq);
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_MPFAILTX);
return true; return true;
...@@ -904,7 +904,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, ...@@ -904,7 +904,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
opts->csum_reqd = subflow_req->csum_reqd; opts->csum_reqd = subflow_req->csum_reqd;
opts->allow_join_id0 = subflow_req->allow_join_id0; opts->allow_join_id0 = subflow_req->allow_join_id0;
*size = TCPOLEN_MPTCP_MPC_SYNACK; *size = TCPOLEN_MPTCP_MPC_SYNACK;
pr_debug("subflow_req=%p, local_key=%llu", pr_debug("subflow_req=%p, local_key=%llu\n",
subflow_req, subflow_req->local_key); subflow_req, subflow_req->local_key);
return true; return true;
} else if (subflow_req->mp_join) { } else if (subflow_req->mp_join) {
...@@ -913,7 +913,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size, ...@@ -913,7 +913,7 @@ bool mptcp_synack_options(const struct request_sock *req, unsigned int *size,
opts->join_id = subflow_req->local_id; opts->join_id = subflow_req->local_id;
opts->thmac = subflow_req->thmac; opts->thmac = subflow_req->thmac;
opts->nonce = subflow_req->local_nonce; opts->nonce = subflow_req->local_nonce;
pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u", pr_debug("req=%p, bkup=%u, id=%u, thmac=%llu, nonce=%u\n",
subflow_req, opts->backup, opts->join_id, subflow_req, opts->backup, opts->join_id,
opts->thmac, opts->nonce); opts->thmac, opts->nonce);
*size = TCPOLEN_MPTCP_MPJ_SYNACK; *size = TCPOLEN_MPTCP_MPJ_SYNACK;
......
...@@ -19,7 +19,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, ...@@ -19,7 +19,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,
{ {
u8 add_addr = READ_ONCE(msk->pm.addr_signal); u8 add_addr = READ_ONCE(msk->pm.addr_signal);
pr_debug("msk=%p, local_id=%d, echo=%d", msk, addr->id, echo); pr_debug("msk=%p, local_id=%d, echo=%d\n", msk, addr->id, echo);
lockdep_assert_held(&msk->pm.lock); lockdep_assert_held(&msk->pm.lock);
...@@ -45,7 +45,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_ ...@@ -45,7 +45,7 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, const struct mptcp_rm_list *rm_
{ {
u8 rm_addr = READ_ONCE(msk->pm.addr_signal); u8 rm_addr = READ_ONCE(msk->pm.addr_signal);
pr_debug("msk=%p, rm_list_nr=%d", msk, rm_list->nr); pr_debug("msk=%p, rm_list_nr=%d\n", msk, rm_list->nr);
if (rm_addr) { if (rm_addr) {
MPTCP_ADD_STATS(sock_net((struct sock *)msk), MPTCP_ADD_STATS(sock_net((struct sock *)msk),
...@@ -66,7 +66,7 @@ void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int ...@@ -66,7 +66,7 @@ void mptcp_pm_new_connection(struct mptcp_sock *msk, const struct sock *ssk, int
{ {
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
pr_debug("msk=%p, token=%u side=%d", msk, READ_ONCE(msk->token), server_side); pr_debug("msk=%p, token=%u side=%d\n", msk, READ_ONCE(msk->token), server_side);
WRITE_ONCE(pm->server_side, server_side); WRITE_ONCE(pm->server_side, server_side);
mptcp_event(MPTCP_EVENT_CREATED, msk, ssk, GFP_ATOMIC); mptcp_event(MPTCP_EVENT_CREATED, msk, ssk, GFP_ATOMIC);
...@@ -90,7 +90,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) ...@@ -90,7 +90,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
subflows_max = mptcp_pm_get_subflows_max(msk); subflows_max = mptcp_pm_get_subflows_max(msk);
pr_debug("msk=%p subflows=%d max=%d allow=%d", msk, pm->subflows, pr_debug("msk=%p subflows=%d max=%d allow=%d\n", msk, pm->subflows,
subflows_max, READ_ONCE(pm->accept_subflow)); subflows_max, READ_ONCE(pm->accept_subflow));
/* try to avoid acquiring the lock below */ /* try to avoid acquiring the lock below */
...@@ -114,7 +114,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk) ...@@ -114,7 +114,7 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
static bool mptcp_pm_schedule_work(struct mptcp_sock *msk, static bool mptcp_pm_schedule_work(struct mptcp_sock *msk,
enum mptcp_pm_status new_status) enum mptcp_pm_status new_status)
{ {
pr_debug("msk=%p status=%x new=%lx", msk, msk->pm.status, pr_debug("msk=%p status=%x new=%lx\n", msk, msk->pm.status,
BIT(new_status)); BIT(new_status));
if (msk->pm.status & BIT(new_status)) if (msk->pm.status & BIT(new_status))
return false; return false;
...@@ -129,7 +129,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) ...@@ -129,7 +129,7 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk)
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
bool announce = false; bool announce = false;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
spin_lock_bh(&pm->lock); spin_lock_bh(&pm->lock);
...@@ -153,14 +153,14 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk) ...@@ -153,14 +153,14 @@ void mptcp_pm_fully_established(struct mptcp_sock *msk, const struct sock *ssk)
void mptcp_pm_connection_closed(struct mptcp_sock *msk) void mptcp_pm_connection_closed(struct mptcp_sock *msk)
{ {
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
} }
void mptcp_pm_subflow_established(struct mptcp_sock *msk) void mptcp_pm_subflow_established(struct mptcp_sock *msk)
{ {
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
if (!READ_ONCE(pm->work_pending)) if (!READ_ONCE(pm->work_pending))
return; return;
...@@ -212,7 +212,7 @@ void mptcp_pm_add_addr_received(const struct sock *ssk, ...@@ -212,7 +212,7 @@ void mptcp_pm_add_addr_received(const struct sock *ssk,
struct mptcp_sock *msk = mptcp_sk(subflow->conn); struct mptcp_sock *msk = mptcp_sk(subflow->conn);
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
pr_debug("msk=%p remote_id=%d accept=%d", msk, addr->id, pr_debug("msk=%p remote_id=%d accept=%d\n", msk, addr->id,
READ_ONCE(pm->accept_addr)); READ_ONCE(pm->accept_addr));
mptcp_event_addr_announced(ssk, addr); mptcp_event_addr_announced(ssk, addr);
...@@ -243,7 +243,7 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk, ...@@ -243,7 +243,7 @@ void mptcp_pm_add_addr_echoed(struct mptcp_sock *msk,
{ {
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
spin_lock_bh(&pm->lock); spin_lock_bh(&pm->lock);
...@@ -267,7 +267,7 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, ...@@ -267,7 +267,7 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
struct mptcp_pm_data *pm = &msk->pm; struct mptcp_pm_data *pm = &msk->pm;
u8 i; u8 i;
pr_debug("msk=%p remote_ids_nr=%d", msk, rm_list->nr); pr_debug("msk=%p remote_ids_nr=%d\n", msk, rm_list->nr);
for (i = 0; i < rm_list->nr; i++) for (i = 0; i < rm_list->nr; i++)
mptcp_event_addr_removed(msk, rm_list->ids[i]); mptcp_event_addr_removed(msk, rm_list->ids[i]);
...@@ -299,19 +299,19 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq) ...@@ -299,19 +299,19 @@ void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq)
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn); struct mptcp_sock *msk = mptcp_sk(subflow->conn);
pr_debug("fail_seq=%llu", fail_seq); pr_debug("fail_seq=%llu\n", fail_seq);
if (!READ_ONCE(msk->allow_infinite_fallback)) if (!READ_ONCE(msk->allow_infinite_fallback))
return; return;
if (!subflow->fail_tout) { if (!subflow->fail_tout) {
pr_debug("send MP_FAIL response and infinite map"); pr_debug("send MP_FAIL response and infinite map\n");
subflow->send_mp_fail = 1; subflow->send_mp_fail = 1;
subflow->send_infinite_map = 1; subflow->send_infinite_map = 1;
tcp_send_ack(sk); tcp_send_ack(sk);
} else { } else {
pr_debug("MP_FAIL response received"); pr_debug("MP_FAIL response received\n");
WRITE_ONCE(subflow->fail_tout, 0); WRITE_ONCE(subflow->fail_tout, 0);
} }
} }
......
...@@ -287,7 +287,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) ...@@ -287,7 +287,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
struct mptcp_sock *msk = entry->sock; struct mptcp_sock *msk = entry->sock;
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
if (!msk) if (!msk)
return; return;
...@@ -306,7 +306,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer) ...@@ -306,7 +306,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
if (!mptcp_pm_should_add_signal_addr(msk)) { if (!mptcp_pm_should_add_signal_addr(msk)) {
pr_debug("retransmit ADD_ADDR id=%d", entry->addr.id); pr_debug("retransmit ADD_ADDR id=%d\n", entry->addr.id);
mptcp_pm_announce_addr(msk, &entry->addr, false); mptcp_pm_announce_addr(msk, &entry->addr, false);
mptcp_pm_add_addr_send_ack(msk); mptcp_pm_add_addr_send_ack(msk);
entry->retrans_times++; entry->retrans_times++;
...@@ -387,7 +387,7 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk) ...@@ -387,7 +387,7 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk)
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
LIST_HEAD(free_list); LIST_HEAD(free_list);
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
list_splice_init(&msk->pm.anno_list, &free_list); list_splice_init(&msk->pm.anno_list, &free_list);
...@@ -473,7 +473,7 @@ static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_con ...@@ -473,7 +473,7 @@ static void __mptcp_pm_send_ack(struct mptcp_sock *msk, struct mptcp_subflow_con
struct sock *ssk = mptcp_subflow_tcp_sock(subflow); struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
bool slow; bool slow;
pr_debug("send ack for %s", pr_debug("send ack for %s\n",
prio ? "mp_prio" : (mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr")); prio ? "mp_prio" : (mptcp_pm_should_add_signal(msk) ? "add_addr" : "rm_addr"));
slow = lock_sock_fast(ssk); slow = lock_sock_fast(ssk);
...@@ -708,7 +708,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) ...@@ -708,7 +708,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)
add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk); add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk);
subflows_max = mptcp_pm_get_subflows_max(msk); subflows_max = mptcp_pm_get_subflows_max(msk);
pr_debug("accepted %d:%d remote family %d", pr_debug("accepted %d:%d remote family %d\n",
msk->pm.add_addr_accepted, add_addr_accept_max, msk->pm.add_addr_accepted, add_addr_accept_max,
msk->pm.remote.family); msk->pm.remote.family);
...@@ -767,7 +767,7 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, ...@@ -767,7 +767,7 @@ int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
{ {
struct mptcp_subflow_context *subflow; struct mptcp_subflow_context *subflow;
pr_debug("bkup=%d", bkup); pr_debug("bkup=%d\n", bkup);
mptcp_for_each_subflow(msk, subflow) { mptcp_for_each_subflow(msk, subflow) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow); struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
...@@ -803,7 +803,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, ...@@ -803,7 +803,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
struct sock *sk = (struct sock *)msk; struct sock *sk = (struct sock *)msk;
u8 i; u8 i;
pr_debug("%s rm_list_nr %d", pr_debug("%s rm_list_nr %d\n",
rm_type == MPTCP_MIB_RMADDR ? "address" : "subflow", rm_list->nr); rm_type == MPTCP_MIB_RMADDR ? "address" : "subflow", rm_list->nr);
msk_owned_by_me(msk); msk_owned_by_me(msk);
...@@ -832,7 +832,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk, ...@@ -832,7 +832,7 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,
if (rm_type == MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match(msk, id, rm_id)) if (rm_type == MPTCP_MIB_RMSUBFLOW && !mptcp_local_id_match(msk, id, rm_id))
continue; continue;
pr_debug(" -> %s rm_list_ids[%d]=%u local_id=%u remote_id=%u mpc_id=%u", pr_debug(" -> %s rm_list_ids[%d]=%u local_id=%u remote_id=%u mpc_id=%u\n",
rm_type == MPTCP_MIB_RMADDR ? "address" : "subflow", rm_type == MPTCP_MIB_RMADDR ? "address" : "subflow",
i, rm_id, id, remote_id, msk->mpc_endpoint_id); i, rm_id, id, remote_id, msk->mpc_endpoint_id);
spin_unlock_bh(&msk->pm.lock); spin_unlock_bh(&msk->pm.lock);
...@@ -889,7 +889,7 @@ void mptcp_pm_nl_work(struct mptcp_sock *msk) ...@@ -889,7 +889,7 @@ void mptcp_pm_nl_work(struct mptcp_sock *msk)
spin_lock_bh(&msk->pm.lock); spin_lock_bh(&msk->pm.lock);
pr_debug("msk=%p status=%x", msk, pm->status); pr_debug("msk=%p status=%x\n", msk, pm->status);
if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) { if (pm->status & BIT(MPTCP_PM_ADD_ADDR_RECEIVED)) {
pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED); pm->status &= ~BIT(MPTCP_PM_ADD_ADDR_RECEIVED);
mptcp_pm_nl_add_addr_received(msk); mptcp_pm_nl_add_addr_received(msk);
...@@ -1476,7 +1476,7 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net, ...@@ -1476,7 +1476,7 @@ static int mptcp_nl_remove_subflow_and_signal_addr(struct net *net,
long s_slot = 0, s_num = 0; long s_slot = 0, s_num = 0;
struct mptcp_sock *msk; struct mptcp_sock *msk;
pr_debug("remove_id=%d", addr->id); pr_debug("remove_id=%d\n", addr->id);
list.ids[list.nr++] = addr->id; list.ids[list.nr++] = addr->id;
......
...@@ -139,7 +139,7 @@ static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to, ...@@ -139,7 +139,7 @@ static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to,
!skb_try_coalesce(to, from, &fragstolen, &delta)) !skb_try_coalesce(to, from, &fragstolen, &delta))
return false; return false;
pr_debug("colesced seq %llx into %llx new len %d new end seq %llx", pr_debug("colesced seq %llx into %llx new len %d new end seq %llx\n",
MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq, MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq,
to->len, MPTCP_SKB_CB(from)->end_seq); to->len, MPTCP_SKB_CB(from)->end_seq);
MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq; MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq;
...@@ -217,7 +217,7 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb) ...@@ -217,7 +217,7 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
end_seq = MPTCP_SKB_CB(skb)->end_seq; end_seq = MPTCP_SKB_CB(skb)->end_seq;
max_seq = atomic64_read(&msk->rcv_wnd_sent); max_seq = atomic64_read(&msk->rcv_wnd_sent);
pr_debug("msk=%p seq=%llx limit=%llx empty=%d", msk, seq, max_seq, pr_debug("msk=%p seq=%llx limit=%llx empty=%d\n", msk, seq, max_seq,
RB_EMPTY_ROOT(&msk->out_of_order_queue)); RB_EMPTY_ROOT(&msk->out_of_order_queue));
if (after64(end_seq, max_seq)) { if (after64(end_seq, max_seq)) {
/* out of window */ /* out of window */
...@@ -643,7 +643,7 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, ...@@ -643,7 +643,7 @@ static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk,
} }
} }
pr_debug("msk=%p ssk=%p", msk, ssk); pr_debug("msk=%p ssk=%p\n", msk, ssk);
tp = tcp_sk(ssk); tp = tcp_sk(ssk);
do { do {
u32 map_remaining, offset; u32 map_remaining, offset;
...@@ -724,7 +724,7 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk) ...@@ -724,7 +724,7 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
u64 end_seq; u64 end_seq;
p = rb_first(&msk->out_of_order_queue); p = rb_first(&msk->out_of_order_queue);
pr_debug("msk=%p empty=%d", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue)); pr_debug("msk=%p empty=%d\n", msk, RB_EMPTY_ROOT(&msk->out_of_order_queue));
while (p) { while (p) {
skb = rb_to_skb(p); skb = rb_to_skb(p);
if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq)) if (after64(MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq))
...@@ -746,7 +746,7 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk) ...@@ -746,7 +746,7 @@ static bool __mptcp_ofo_queue(struct mptcp_sock *msk)
int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq; int delta = msk->ack_seq - MPTCP_SKB_CB(skb)->map_seq;
/* skip overlapping data, if any */ /* skip overlapping data, if any */
pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d", pr_debug("uncoalesced seq=%llx ack seq=%llx delta=%d\n",
MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq, MPTCP_SKB_CB(skb)->map_seq, msk->ack_seq,
delta); delta);
MPTCP_SKB_CB(skb)->offset += delta; MPTCP_SKB_CB(skb)->offset += delta;
...@@ -1240,7 +1240,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, ...@@ -1240,7 +1240,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
size_t copy; size_t copy;
int i; int i;
pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u", pr_debug("msk=%p ssk=%p sending dfrag at seq=%llu len=%u already sent=%u\n",
msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent); msk, ssk, dfrag->data_seq, dfrag->data_len, info->sent);
if (WARN_ON_ONCE(info->sent > info->limit || if (WARN_ON_ONCE(info->sent > info->limit ||
...@@ -1341,7 +1341,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk, ...@@ -1341,7 +1341,7 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
mpext->use_map = 1; mpext->use_map = 1;
mpext->dsn64 = 1; mpext->dsn64 = 1;
pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d", pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d\n",
mpext->data_seq, mpext->subflow_seq, mpext->data_len, mpext->data_seq, mpext->subflow_seq, mpext->data_len,
mpext->dsn64); mpext->dsn64);
...@@ -1892,7 +1892,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) ...@@ -1892,7 +1892,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
if (!msk->first_pending) if (!msk->first_pending)
WRITE_ONCE(msk->first_pending, dfrag); WRITE_ONCE(msk->first_pending, dfrag);
} }
pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d", msk, pr_debug("msk=%p dfrag at seq=%llu len=%u sent=%u new=%d\n", msk,
dfrag->data_seq, dfrag->data_len, dfrag->already_sent, dfrag->data_seq, dfrag->data_len, dfrag->already_sent,
!dfrag_collapsed); !dfrag_collapsed);
...@@ -2248,7 +2248,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -2248,7 +2248,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
} }
} }
pr_debug("block timeout %ld", timeo); pr_debug("block timeout %ld\n", timeo);
sk_wait_data(sk, &timeo, NULL); sk_wait_data(sk, &timeo, NULL);
} }
...@@ -2264,7 +2264,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -2264,7 +2264,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
} }
} }
pr_debug("msk=%p rx queue empty=%d:%d copied=%d", pr_debug("msk=%p rx queue empty=%d:%d copied=%d\n",
msk, skb_queue_empty_lockless(&sk->sk_receive_queue), msk, skb_queue_empty_lockless(&sk->sk_receive_queue),
skb_queue_empty(&msk->receive_queue), copied); skb_queue_empty(&msk->receive_queue), copied);
if (!(flags & MSG_PEEK)) if (!(flags & MSG_PEEK))
...@@ -2326,7 +2326,7 @@ struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk) ...@@ -2326,7 +2326,7 @@ struct sock *mptcp_subflow_get_retrans(struct mptcp_sock *msk)
continue; continue;
} }
if (subflow->backup) { if (subflow->backup || subflow->request_bkup) {
if (!backup) if (!backup)
backup = ssk; backup = ssk;
continue; continue;
...@@ -2533,8 +2533,11 @@ static void __mptcp_close_subflow(struct sock *sk) ...@@ -2533,8 +2533,11 @@ static void __mptcp_close_subflow(struct sock *sk)
mptcp_for_each_subflow_safe(msk, subflow, tmp) { mptcp_for_each_subflow_safe(msk, subflow, tmp) {
struct sock *ssk = mptcp_subflow_tcp_sock(subflow); struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
int ssk_state = inet_sk_state_load(ssk);
if (inet_sk_state_load(ssk) != TCP_CLOSE) if (ssk_state != TCP_CLOSE &&
(ssk_state != TCP_CLOSE_WAIT ||
inet_sk_state_load(sk) != TCP_ESTABLISHED))
continue; continue;
/* 'subflow_data_ready' will re-sched once rx queue is empty */ /* 'subflow_data_ready' will re-sched once rx queue is empty */
...@@ -2714,7 +2717,7 @@ static void mptcp_mp_fail_no_response(struct mptcp_sock *msk) ...@@ -2714,7 +2717,7 @@ static void mptcp_mp_fail_no_response(struct mptcp_sock *msk)
if (!ssk) if (!ssk)
return; return;
pr_debug("MP_FAIL doesn't respond, reset the subflow"); pr_debug("MP_FAIL doesn't respond, reset the subflow\n");
slow = lock_sock_fast(ssk); slow = lock_sock_fast(ssk);
mptcp_subflow_reset(ssk); mptcp_subflow_reset(ssk);
...@@ -2888,7 +2891,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) ...@@ -2888,7 +2891,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
break; break;
default: default:
if (__mptcp_check_fallback(mptcp_sk(sk))) { if (__mptcp_check_fallback(mptcp_sk(sk))) {
pr_debug("Fallback"); pr_debug("Fallback\n");
ssk->sk_shutdown |= how; ssk->sk_shutdown |= how;
tcp_shutdown(ssk, how); tcp_shutdown(ssk, how);
...@@ -2898,7 +2901,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how) ...@@ -2898,7 +2901,7 @@ void mptcp_subflow_shutdown(struct sock *sk, struct sock *ssk, int how)
WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt); WRITE_ONCE(mptcp_sk(sk)->snd_una, mptcp_sk(sk)->snd_nxt);
mptcp_schedule_work(sk); mptcp_schedule_work(sk);
} else { } else {
pr_debug("Sending DATA_FIN on subflow %p", ssk); pr_debug("Sending DATA_FIN on subflow %p\n", ssk);
tcp_send_ack(ssk); tcp_send_ack(ssk);
if (!mptcp_rtx_timer_pending(sk)) if (!mptcp_rtx_timer_pending(sk))
mptcp_reset_rtx_timer(sk); mptcp_reset_rtx_timer(sk);
...@@ -2964,7 +2967,7 @@ static void mptcp_check_send_data_fin(struct sock *sk) ...@@ -2964,7 +2967,7 @@ static void mptcp_check_send_data_fin(struct sock *sk)
struct mptcp_subflow_context *subflow; struct mptcp_subflow_context *subflow;
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu", pr_debug("msk=%p snd_data_fin_enable=%d pending=%d snd_nxt=%llu write_seq=%llu\n",
msk, msk->snd_data_fin_enable, !!mptcp_send_head(sk), msk, msk->snd_data_fin_enable, !!mptcp_send_head(sk),
msk->snd_nxt, msk->write_seq); msk->snd_nxt, msk->write_seq);
...@@ -2988,7 +2991,7 @@ static void __mptcp_wr_shutdown(struct sock *sk) ...@@ -2988,7 +2991,7 @@ static void __mptcp_wr_shutdown(struct sock *sk)
{ {
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d", pr_debug("msk=%p snd_data_fin_enable=%d shutdown=%x state=%d pending=%d\n",
msk, msk->snd_data_fin_enable, sk->sk_shutdown, sk->sk_state, msk, msk->snd_data_fin_enable, sk->sk_shutdown, sk->sk_state,
!!mptcp_send_head(sk)); !!mptcp_send_head(sk));
...@@ -3003,7 +3006,7 @@ static void __mptcp_destroy_sock(struct sock *sk) ...@@ -3003,7 +3006,7 @@ static void __mptcp_destroy_sock(struct sock *sk)
{ {
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
might_sleep(); might_sleep();
...@@ -3111,7 +3114,7 @@ bool __mptcp_close(struct sock *sk, long timeout) ...@@ -3111,7 +3114,7 @@ bool __mptcp_close(struct sock *sk, long timeout)
mptcp_set_state(sk, TCP_CLOSE); mptcp_set_state(sk, TCP_CLOSE);
sock_hold(sk); sock_hold(sk);
pr_debug("msk=%p state=%d", sk, sk->sk_state); pr_debug("msk=%p state=%d\n", sk, sk->sk_state);
if (msk->token) if (msk->token)
mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL); mptcp_event(MPTCP_EVENT_CLOSED, msk, NULL, GFP_KERNEL);
...@@ -3543,7 +3546,7 @@ static int mptcp_get_port(struct sock *sk, unsigned short snum) ...@@ -3543,7 +3546,7 @@ static int mptcp_get_port(struct sock *sk, unsigned short snum)
{ {
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
pr_debug("msk=%p, ssk=%p", msk, msk->first); pr_debug("msk=%p, ssk=%p\n", msk, msk->first);
if (WARN_ON_ONCE(!msk->first)) if (WARN_ON_ONCE(!msk->first))
return -EINVAL; return -EINVAL;
...@@ -3560,7 +3563,7 @@ void mptcp_finish_connect(struct sock *ssk) ...@@ -3560,7 +3563,7 @@ void mptcp_finish_connect(struct sock *ssk)
sk = subflow->conn; sk = subflow->conn;
msk = mptcp_sk(sk); msk = mptcp_sk(sk);
pr_debug("msk=%p, token=%u", sk, subflow->token); pr_debug("msk=%p, token=%u\n", sk, subflow->token);
subflow->map_seq = subflow->iasn; subflow->map_seq = subflow->iasn;
subflow->map_subflow_seq = 1; subflow->map_subflow_seq = 1;
...@@ -3589,7 +3592,7 @@ bool mptcp_finish_join(struct sock *ssk) ...@@ -3589,7 +3592,7 @@ bool mptcp_finish_join(struct sock *ssk)
struct sock *parent = (void *)msk; struct sock *parent = (void *)msk;
bool ret = true; bool ret = true;
pr_debug("msk=%p, subflow=%p", msk, subflow); pr_debug("msk=%p, subflow=%p\n", msk, subflow);
/* mptcp socket already closing? */ /* mptcp socket already closing? */
if (!mptcp_is_fully_established(parent)) { if (!mptcp_is_fully_established(parent)) {
...@@ -3635,7 +3638,7 @@ bool mptcp_finish_join(struct sock *ssk) ...@@ -3635,7 +3638,7 @@ bool mptcp_finish_join(struct sock *ssk)
static void mptcp_shutdown(struct sock *sk, int how) static void mptcp_shutdown(struct sock *sk, int how)
{ {
pr_debug("sk=%p, how=%d", sk, how); pr_debug("sk=%p, how=%d\n", sk, how);
if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk)) if ((how & SEND_SHUTDOWN) && mptcp_close_state(sk))
__mptcp_wr_shutdown(sk); __mptcp_wr_shutdown(sk);
...@@ -3856,7 +3859,7 @@ static int mptcp_listen(struct socket *sock, int backlog) ...@@ -3856,7 +3859,7 @@ static int mptcp_listen(struct socket *sock, int backlog)
struct sock *ssk; struct sock *ssk;
int err; int err;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
lock_sock(sk); lock_sock(sk);
...@@ -3895,7 +3898,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, ...@@ -3895,7 +3898,7 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
struct mptcp_sock *msk = mptcp_sk(sock->sk); struct mptcp_sock *msk = mptcp_sk(sock->sk);
struct sock *ssk, *newsk; struct sock *ssk, *newsk;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
/* Buggy applications can call accept on socket states other then LISTEN /* Buggy applications can call accept on socket states other then LISTEN
* but no need to allocate the first subflow just to error out. * but no need to allocate the first subflow just to error out.
...@@ -3904,12 +3907,12 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock, ...@@ -3904,12 +3907,12 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
if (!ssk) if (!ssk)
return -EINVAL; return -EINVAL;
pr_debug("ssk=%p, listener=%p", ssk, mptcp_subflow_ctx(ssk)); pr_debug("ssk=%p, listener=%p\n", ssk, mptcp_subflow_ctx(ssk));
newsk = inet_csk_accept(ssk, arg); newsk = inet_csk_accept(ssk, arg);
if (!newsk) if (!newsk)
return arg->err; return arg->err;
pr_debug("newsk=%p, subflow is mptcp=%d", newsk, sk_is_mptcp(newsk)); pr_debug("newsk=%p, subflow is mptcp=%d\n", newsk, sk_is_mptcp(newsk));
if (sk_is_mptcp(newsk)) { if (sk_is_mptcp(newsk)) {
struct mptcp_subflow_context *subflow; struct mptcp_subflow_context *subflow;
struct sock *new_mptcp_sock; struct sock *new_mptcp_sock;
...@@ -4002,7 +4005,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock, ...@@ -4002,7 +4005,7 @@ static __poll_t mptcp_poll(struct file *file, struct socket *sock,
sock_poll_wait(file, sock, wait); sock_poll_wait(file, sock, wait);
state = inet_sk_state_load(sk); state = inet_sk_state_load(sk);
pr_debug("msk=%p state=%d flags=%lx", msk, state, msk->flags); pr_debug("msk=%p state=%d flags=%lx\n", msk, state, msk->flags);
if (state == TCP_LISTEN) { if (state == TCP_LISTEN) {
struct sock *ssk = READ_ONCE(msk->first); struct sock *ssk = READ_ONCE(msk->first);
......
...@@ -1177,7 +1177,7 @@ static inline bool mptcp_check_fallback(const struct sock *sk) ...@@ -1177,7 +1177,7 @@ static inline bool mptcp_check_fallback(const struct sock *sk)
static inline void __mptcp_do_fallback(struct mptcp_sock *msk) static inline void __mptcp_do_fallback(struct mptcp_sock *msk)
{ {
if (__mptcp_check_fallback(msk)) { if (__mptcp_check_fallback(msk)) {
pr_debug("TCP fallback already done (msk=%p)", msk); pr_debug("TCP fallback already done (msk=%p)\n", msk);
return; return;
} }
set_bit(MPTCP_FALLBACK_DONE, &msk->flags); set_bit(MPTCP_FALLBACK_DONE, &msk->flags);
...@@ -1213,7 +1213,7 @@ static inline void mptcp_do_fallback(struct sock *ssk) ...@@ -1213,7 +1213,7 @@ static inline void mptcp_do_fallback(struct sock *ssk)
} }
} }
#define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)", __func__, a) #define pr_fallback(a) pr_debug("%s:fallback to TCP (msk=%p)\n", __func__, a)
static inline bool mptcp_check_infinite_map(struct sk_buff *skb) static inline bool mptcp_check_infinite_map(struct sk_buff *skb)
{ {
......
...@@ -86,7 +86,7 @@ int mptcp_register_scheduler(struct mptcp_sched_ops *sched) ...@@ -86,7 +86,7 @@ int mptcp_register_scheduler(struct mptcp_sched_ops *sched)
list_add_tail_rcu(&sched->list, &mptcp_sched_list); list_add_tail_rcu(&sched->list, &mptcp_sched_list);
spin_unlock(&mptcp_sched_list_lock); spin_unlock(&mptcp_sched_list_lock);
pr_debug("%s registered", sched->name); pr_debug("%s registered\n", sched->name);
return 0; return 0;
} }
...@@ -118,7 +118,7 @@ int mptcp_init_sched(struct mptcp_sock *msk, ...@@ -118,7 +118,7 @@ int mptcp_init_sched(struct mptcp_sock *msk,
if (msk->sched->init) if (msk->sched->init)
msk->sched->init(msk); msk->sched->init(msk);
pr_debug("sched=%s", msk->sched->name); pr_debug("sched=%s\n", msk->sched->name);
return 0; return 0;
} }
......
...@@ -873,7 +873,7 @@ int mptcp_setsockopt(struct sock *sk, int level, int optname, ...@@ -873,7 +873,7 @@ int mptcp_setsockopt(struct sock *sk, int level, int optname,
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
struct sock *ssk; struct sock *ssk;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
if (level == SOL_SOCKET) if (level == SOL_SOCKET)
return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen); return mptcp_setsockopt_sol_socket(msk, optname, optval, optlen);
...@@ -1453,7 +1453,7 @@ int mptcp_getsockopt(struct sock *sk, int level, int optname, ...@@ -1453,7 +1453,7 @@ int mptcp_getsockopt(struct sock *sk, int level, int optname,
struct mptcp_sock *msk = mptcp_sk(sk); struct mptcp_sock *msk = mptcp_sk(sk);
struct sock *ssk; struct sock *ssk;
pr_debug("msk=%p", msk); pr_debug("msk=%p\n", msk);
/* @@ the meaning of setsockopt() when the socket is connected and /* @@ the meaning of setsockopt() when the socket is connected and
* there are multiple subflows is not yet defined. It is up to the * there are multiple subflows is not yet defined. It is up to the
......
...@@ -39,7 +39,7 @@ static void subflow_req_destructor(struct request_sock *req) ...@@ -39,7 +39,7 @@ static void subflow_req_destructor(struct request_sock *req)
{ {
struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req); struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
pr_debug("subflow_req=%p", subflow_req); pr_debug("subflow_req=%p\n", subflow_req);
if (subflow_req->msk) if (subflow_req->msk)
sock_put((struct sock *)subflow_req->msk); sock_put((struct sock *)subflow_req->msk);
...@@ -146,7 +146,7 @@ static int subflow_check_req(struct request_sock *req, ...@@ -146,7 +146,7 @@ static int subflow_check_req(struct request_sock *req,
struct mptcp_options_received mp_opt; struct mptcp_options_received mp_opt;
bool opt_mp_capable, opt_mp_join; bool opt_mp_capable, opt_mp_join;
pr_debug("subflow_req=%p, listener=%p", subflow_req, listener); pr_debug("subflow_req=%p, listener=%p\n", subflow_req, listener);
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
/* no MPTCP if MD5SIG is enabled on this socket or we may run out of /* no MPTCP if MD5SIG is enabled on this socket or we may run out of
...@@ -221,7 +221,7 @@ static int subflow_check_req(struct request_sock *req, ...@@ -221,7 +221,7 @@ static int subflow_check_req(struct request_sock *req,
} }
if (subflow_use_different_sport(subflow_req->msk, sk_listener)) { if (subflow_use_different_sport(subflow_req->msk, sk_listener)) {
pr_debug("syn inet_sport=%d %d", pr_debug("syn inet_sport=%d %d\n",
ntohs(inet_sk(sk_listener)->inet_sport), ntohs(inet_sk(sk_listener)->inet_sport),
ntohs(inet_sk((struct sock *)subflow_req->msk)->inet_sport)); ntohs(inet_sk((struct sock *)subflow_req->msk)->inet_sport));
if (!mptcp_pm_sport_in_anno_list(subflow_req->msk, sk_listener)) { if (!mptcp_pm_sport_in_anno_list(subflow_req->msk, sk_listener)) {
...@@ -243,7 +243,7 @@ static int subflow_check_req(struct request_sock *req, ...@@ -243,7 +243,7 @@ static int subflow_check_req(struct request_sock *req,
subflow_init_req_cookie_join_save(subflow_req, skb); subflow_init_req_cookie_join_save(subflow_req, skb);
} }
pr_debug("token=%u, remote_nonce=%u msk=%p", subflow_req->token, pr_debug("token=%u, remote_nonce=%u msk=%p\n", subflow_req->token,
subflow_req->remote_nonce, subflow_req->msk); subflow_req->remote_nonce, subflow_req->msk);
} }
...@@ -527,7 +527,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -527,7 +527,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
subflow->rel_write_seq = 1; subflow->rel_write_seq = 1;
subflow->conn_finished = 1; subflow->conn_finished = 1;
subflow->ssn_offset = TCP_SKB_CB(skb)->seq; subflow->ssn_offset = TCP_SKB_CB(skb)->seq;
pr_debug("subflow=%p synack seq=%x", subflow, subflow->ssn_offset); pr_debug("subflow=%p synack seq=%x\n", subflow, subflow->ssn_offset);
mptcp_get_options(skb, &mp_opt); mptcp_get_options(skb, &mp_opt);
if (subflow->request_mptcp) { if (subflow->request_mptcp) {
...@@ -559,7 +559,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -559,7 +559,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
subflow->thmac = mp_opt.thmac; subflow->thmac = mp_opt.thmac;
subflow->remote_nonce = mp_opt.nonce; subflow->remote_nonce = mp_opt.nonce;
WRITE_ONCE(subflow->remote_id, mp_opt.join_id); WRITE_ONCE(subflow->remote_id, mp_opt.join_id);
pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d", pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u backup=%d\n",
subflow, subflow->thmac, subflow->remote_nonce, subflow, subflow->thmac, subflow->remote_nonce,
subflow->backup); subflow->backup);
...@@ -585,7 +585,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -585,7 +585,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKBACKUPRX);
if (subflow_use_different_dport(msk, sk)) { if (subflow_use_different_dport(msk, sk)) {
pr_debug("synack inet_dport=%d %d", pr_debug("synack inet_dport=%d %d\n",
ntohs(inet_sk(sk)->inet_dport), ntohs(inet_sk(sk)->inet_dport),
ntohs(inet_sk(parent)->inet_dport)); ntohs(inet_sk(parent)->inet_dport));
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINPORTSYNACKRX); MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINPORTSYNACKRX);
...@@ -655,7 +655,7 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -655,7 +655,7 @@ static int subflow_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{ {
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
pr_debug("subflow=%p", subflow); pr_debug("subflow=%p\n", subflow);
/* Never answer to SYNs sent to broadcast or multicast */ /* Never answer to SYNs sent to broadcast or multicast */
if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) if (skb_rtable(skb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST))
...@@ -686,7 +686,7 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb) ...@@ -686,7 +686,7 @@ static int subflow_v6_conn_request(struct sock *sk, struct sk_buff *skb)
{ {
struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk); struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
pr_debug("subflow=%p", subflow); pr_debug("subflow=%p\n", subflow);
if (skb->protocol == htons(ETH_P_IP)) if (skb->protocol == htons(ETH_P_IP))
return subflow_v4_conn_request(sk, skb); return subflow_v4_conn_request(sk, skb);
...@@ -807,7 +807,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, ...@@ -807,7 +807,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
struct mptcp_sock *owner; struct mptcp_sock *owner;
struct sock *child; struct sock *child;
pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn); pr_debug("listener=%p, req=%p, conn=%p\n", listener, req, listener->conn);
/* After child creation we must look for MPC even when options /* After child creation we must look for MPC even when options
* are not parsed * are not parsed
...@@ -898,7 +898,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, ...@@ -898,7 +898,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
ctx->conn = (struct sock *)owner; ctx->conn = (struct sock *)owner;
if (subflow_use_different_sport(owner, sk)) { if (subflow_use_different_sport(owner, sk)) {
pr_debug("ack inet_sport=%d %d", pr_debug("ack inet_sport=%d %d\n",
ntohs(inet_sk(sk)->inet_sport), ntohs(inet_sk(sk)->inet_sport),
ntohs(inet_sk((struct sock *)owner)->inet_sport)); ntohs(inet_sk((struct sock *)owner)->inet_sport));
if (!mptcp_pm_sport_in_anno_list(owner, sk)) { if (!mptcp_pm_sport_in_anno_list(owner, sk)) {
...@@ -961,7 +961,7 @@ enum mapping_status { ...@@ -961,7 +961,7 @@ enum mapping_status {
static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn) static void dbg_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
{ {
pr_debug("Bad mapping: ssn=%d map_seq=%d map_data_len=%d", pr_debug("Bad mapping: ssn=%d map_seq=%d map_data_len=%d\n",
ssn, subflow->map_subflow_seq, subflow->map_data_len); ssn, subflow->map_subflow_seq, subflow->map_data_len);
} }
...@@ -1121,7 +1121,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, ...@@ -1121,7 +1121,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
data_len = mpext->data_len; data_len = mpext->data_len;
if (data_len == 0) { if (data_len == 0) {
pr_debug("infinite mapping received"); pr_debug("infinite mapping received\n");
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
subflow->map_data_len = 0; subflow->map_data_len = 0;
return MAPPING_INVALID; return MAPPING_INVALID;
...@@ -1133,7 +1133,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, ...@@ -1133,7 +1133,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
if (data_len == 1) { if (data_len == 1) {
bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq, bool updated = mptcp_update_rcv_data_fin(msk, mpext->data_seq,
mpext->dsn64); mpext->dsn64);
pr_debug("DATA_FIN with no payload seq=%llu", mpext->data_seq); pr_debug("DATA_FIN with no payload seq=%llu\n", mpext->data_seq);
if (subflow->map_valid) { if (subflow->map_valid) {
/* A DATA_FIN might arrive in a DSS /* A DATA_FIN might arrive in a DSS
* option before the previous mapping * option before the previous mapping
...@@ -1159,7 +1159,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, ...@@ -1159,7 +1159,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
data_fin_seq &= GENMASK_ULL(31, 0); data_fin_seq &= GENMASK_ULL(31, 0);
mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64); mptcp_update_rcv_data_fin(msk, data_fin_seq, mpext->dsn64);
pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d", pr_debug("DATA_FIN with mapping seq=%llu dsn64=%d\n",
data_fin_seq, mpext->dsn64); data_fin_seq, mpext->dsn64);
/* Adjust for DATA_FIN using 1 byte of sequence space */ /* Adjust for DATA_FIN using 1 byte of sequence space */
...@@ -1205,7 +1205,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk, ...@@ -1205,7 +1205,7 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
if (unlikely(subflow->map_csum_reqd != csum_reqd)) if (unlikely(subflow->map_csum_reqd != csum_reqd))
return MAPPING_INVALID; return MAPPING_INVALID;
pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u", pr_debug("new map seq=%llu subflow_seq=%u data_len=%u csum=%d:%u\n",
subflow->map_seq, subflow->map_subflow_seq, subflow->map_seq, subflow->map_subflow_seq,
subflow->map_data_len, subflow->map_csum_reqd, subflow->map_data_len, subflow->map_csum_reqd,
subflow->map_data_csum); subflow->map_data_csum);
...@@ -1240,7 +1240,7 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, ...@@ -1240,7 +1240,7 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb,
avail_len = skb->len - offset; avail_len = skb->len - offset;
incr = limit >= avail_len ? avail_len + fin : limit; incr = limit >= avail_len ? avail_len + fin : limit;
pr_debug("discarding=%d len=%d offset=%d seq=%d", incr, skb->len, pr_debug("discarding=%d len=%d offset=%d seq=%d\n", incr, skb->len,
offset, subflow->map_subflow_seq); offset, subflow->map_subflow_seq);
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA); MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DUPDATA);
tcp_sk(ssk)->copied_seq += incr; tcp_sk(ssk)->copied_seq += incr;
...@@ -1255,12 +1255,16 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb, ...@@ -1255,12 +1255,16 @@ static void mptcp_subflow_discard_data(struct sock *ssk, struct sk_buff *skb,
/* sched mptcp worker to remove the subflow if no more data is pending */ /* sched mptcp worker to remove the subflow if no more data is pending */
static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk) static void subflow_sched_work_if_closed(struct mptcp_sock *msk, struct sock *ssk)
{ {
if (likely(ssk->sk_state != TCP_CLOSE)) struct sock *sk = (struct sock *)msk;
if (likely(ssk->sk_state != TCP_CLOSE &&
(ssk->sk_state != TCP_CLOSE_WAIT ||
inet_sk_state_load(sk) != TCP_ESTABLISHED)))
return; return;
if (skb_queue_empty(&ssk->sk_receive_queue) && if (skb_queue_empty(&ssk->sk_receive_queue) &&
!test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags)) !test_and_set_bit(MPTCP_WORK_CLOSE_SUBFLOW, &msk->flags))
mptcp_schedule_work((struct sock *)msk); mptcp_schedule_work(sk);
} }
static bool subflow_can_fallback(struct mptcp_subflow_context *subflow) static bool subflow_can_fallback(struct mptcp_subflow_context *subflow)
...@@ -1337,7 +1341,7 @@ static bool subflow_check_data_avail(struct sock *ssk) ...@@ -1337,7 +1341,7 @@ static bool subflow_check_data_avail(struct sock *ssk)
old_ack = READ_ONCE(msk->ack_seq); old_ack = READ_ONCE(msk->ack_seq);
ack_seq = mptcp_subflow_get_mapped_dsn(subflow); ack_seq = mptcp_subflow_get_mapped_dsn(subflow);
pr_debug("msk ack_seq=%llx subflow ack_seq=%llx", old_ack, pr_debug("msk ack_seq=%llx subflow ack_seq=%llx\n", old_ack,
ack_seq); ack_seq);
if (unlikely(before64(ack_seq, old_ack))) { if (unlikely(before64(ack_seq, old_ack))) {
mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq); mptcp_subflow_discard_data(ssk, skb, old_ack - ack_seq);
...@@ -1409,7 +1413,7 @@ bool mptcp_subflow_data_available(struct sock *sk) ...@@ -1409,7 +1413,7 @@ bool mptcp_subflow_data_available(struct sock *sk)
subflow->map_valid = 0; subflow->map_valid = 0;
WRITE_ONCE(subflow->data_avail, false); WRITE_ONCE(subflow->data_avail, false);
pr_debug("Done with mapping: seq=%u data_len=%u", pr_debug("Done with mapping: seq=%u data_len=%u\n",
subflow->map_subflow_seq, subflow->map_subflow_seq,
subflow->map_data_len); subflow->map_data_len);
} }
...@@ -1519,7 +1523,7 @@ void mptcpv6_handle_mapped(struct sock *sk, bool mapped) ...@@ -1519,7 +1523,7 @@ void mptcpv6_handle_mapped(struct sock *sk, bool mapped)
target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk); target = mapped ? &subflow_v6m_specific : subflow_default_af_ops(sk);
pr_debug("subflow=%p family=%d ops=%p target=%p mapped=%d", pr_debug("subflow=%p family=%d ops=%p target=%p mapped=%d\n",
subflow, sk->sk_family, icsk->icsk_af_ops, target, mapped); subflow, sk->sk_family, icsk->icsk_af_ops, target, mapped);
if (likely(icsk->icsk_af_ops == target)) if (likely(icsk->icsk_af_ops == target))
...@@ -1612,7 +1616,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, ...@@ -1612,7 +1616,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc,
goto failed; goto failed;
mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL); mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk, pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d\n", msk,
remote_token, local_id, remote_id); remote_token, local_id, remote_id);
subflow->remote_token = remote_token; subflow->remote_token = remote_token;
WRITE_ONCE(subflow->remote_id, remote_id); WRITE_ONCE(subflow->remote_id, remote_id);
...@@ -1747,7 +1751,7 @@ int mptcp_subflow_create_socket(struct sock *sk, unsigned short family, ...@@ -1747,7 +1751,7 @@ int mptcp_subflow_create_socket(struct sock *sk, unsigned short family,
SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid; SOCK_INODE(sf)->i_gid = SOCK_INODE(sk->sk_socket)->i_gid;
subflow = mptcp_subflow_ctx(sf->sk); subflow = mptcp_subflow_ctx(sf->sk);
pr_debug("subflow=%p", subflow); pr_debug("subflow=%p\n", subflow);
*new_sock = sf; *new_sock = sf;
sock_hold(sk); sock_hold(sk);
...@@ -1776,7 +1780,7 @@ static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk, ...@@ -1776,7 +1780,7 @@ static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk,
INIT_LIST_HEAD(&ctx->node); INIT_LIST_HEAD(&ctx->node);
INIT_LIST_HEAD(&ctx->delegated_node); INIT_LIST_HEAD(&ctx->delegated_node);
pr_debug("subflow=%p", ctx); pr_debug("subflow=%p\n", ctx);
ctx->tcp_sock = sk; ctx->tcp_sock = sk;
WRITE_ONCE(ctx->local_id, -1); WRITE_ONCE(ctx->local_id, -1);
...@@ -1927,7 +1931,7 @@ static int subflow_ulp_init(struct sock *sk) ...@@ -1927,7 +1931,7 @@ static int subflow_ulp_init(struct sock *sk)
goto out; goto out;
} }
pr_debug("subflow=%p, family=%d", ctx, sk->sk_family); pr_debug("subflow=%p, family=%d\n", ctx, sk->sk_family);
tp->is_mptcp = 1; tp->is_mptcp = 1;
ctx->icsk_af_ops = icsk->icsk_af_ops; ctx->icsk_af_ops = icsk->icsk_af_ops;
......
...@@ -3429,14 +3429,12 @@ userspace_tests() ...@@ -3429,14 +3429,12 @@ userspace_tests()
"signal" "signal"
userspace_pm_chk_get_addr "${ns1}" "10" "id 10 flags signal 10.0.2.1" userspace_pm_chk_get_addr "${ns1}" "10" "id 10 flags signal 10.0.2.1"
userspace_pm_chk_get_addr "${ns1}" "20" "id 20 flags signal 10.0.3.1" userspace_pm_chk_get_addr "${ns1}" "20" "id 20 flags signal 10.0.3.1"
userspace_pm_rm_addr $ns1 10
userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $MPTCP_LIB_EVENT_SUB_ESTABLISHED userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $MPTCP_LIB_EVENT_SUB_ESTABLISHED
userspace_pm_chk_dump_addr "${ns1}" \ userspace_pm_chk_dump_addr "${ns1}" \
"id 20 flags signal 10.0.3.1" "after rm_addr 10" "id 20 flags signal 10.0.3.1" "after rm_sf 10"
userspace_pm_rm_addr $ns1 20 userspace_pm_rm_addr $ns1 20
userspace_pm_rm_sf $ns1 10.0.3.1 $MPTCP_LIB_EVENT_SUB_ESTABLISHED
userspace_pm_chk_dump_addr "${ns1}" "" "after rm_addr 20" userspace_pm_chk_dump_addr "${ns1}" "" "after rm_addr 20"
chk_rm_nr 2 2 invert chk_rm_nr 1 1 invert
chk_mptcp_info subflows 0 subflows 0 chk_mptcp_info subflows 0 subflows 0
chk_subflows_total 1 1 chk_subflows_total 1 1
kill_events_pids kill_events_pids
...@@ -3460,12 +3458,11 @@ userspace_tests() ...@@ -3460,12 +3458,11 @@ userspace_tests()
"id 20 flags subflow 10.0.3.2" \ "id 20 flags subflow 10.0.3.2" \
"subflow" "subflow"
userspace_pm_chk_get_addr "${ns2}" "20" "id 20 flags subflow 10.0.3.2" userspace_pm_chk_get_addr "${ns2}" "20" "id 20 flags subflow 10.0.3.2"
userspace_pm_rm_addr $ns2 20
userspace_pm_rm_sf $ns2 10.0.3.2 $MPTCP_LIB_EVENT_SUB_ESTABLISHED userspace_pm_rm_sf $ns2 10.0.3.2 $MPTCP_LIB_EVENT_SUB_ESTABLISHED
userspace_pm_chk_dump_addr "${ns2}" \ userspace_pm_chk_dump_addr "${ns2}" \
"" \ "" \
"after rm_addr 20" "after rm_sf 20"
chk_rm_nr 1 1 chk_rm_nr 0 1
chk_mptcp_info subflows 0 subflows 0 chk_mptcp_info subflows 0 subflows 0
chk_subflows_total 1 1 chk_subflows_total 1 1
kill_events_pids kill_events_pids
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment