diff --git a/include/net/mptcp.h b/include/net/mptcp.h index b9852081073f..a1ecb599f003 100644 --- a/include/net/mptcp.h +++ b/include/net/mptcp.h @@ -663,10 +663,10 @@ extern int sysctl_mptcp_syn_retries; extern struct workqueue_struct *mptcp_wq; -#define mptcp_debug(fmt, args...) \ - do { \ - if (unlikely(sysctl_mptcp_debug)) \ - pr_err(fmt, ##args); \ +#define mptcp_debug(fmt, args...) \ + do { \ + if (unlikely(sysctl_mptcp_debug)) \ + pr_err(fmt, ##args); \ } while (0) /* Iterates over all subflows */ diff --git a/net/mptcp/mptcp_ctrl.c b/net/mptcp/mptcp_ctrl.c index 62aa8c5e177b..29fe6485d69a 100644 --- a/net/mptcp/mptcp_ctrl.c +++ b/net/mptcp/mptcp_ctrl.c @@ -1315,8 +1315,8 @@ void mptcp_fallback_meta_sk(struct sock *meta_sk) int mptcp_add_sock(struct sock *meta_sk, struct sock *sk, u8 loc_id, u8 rem_id, gfp_t flags) { - struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; - struct tcp_sock *tp = tcp_sk(sk); + struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; + struct tcp_sock *tp = tcp_sk(sk); tp->mptcp = kmem_cache_zalloc(mptcp_sock_cache, flags); if (!tp->mptcp) @@ -2122,9 +2122,9 @@ struct sock *mptcp_check_req_child(struct sock *meta_sk, struct sk_buff *skb, const struct mptcp_options_received *mopt) { - struct tcp_sock *child_tp = tcp_sk(child); + const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; struct mptcp_request_sock *mtreq = mptcp_rsk(req); - struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; + struct tcp_sock *child_tp = tcp_sk(child); u8 hash_mac_check[20]; child_tp->inside_tk_table = 0; @@ -2490,6 +2490,23 @@ int mptcp_conn_request(struct sock *sk, struct sk_buff *skb) return 0; } +int mptcp_finish_handshake(struct sock *child, struct sk_buff *skb) + __releases(&child->sk_lock.slock) +{ + int ret; + + /* We don't call tcp_child_process here, because we hold + * already the meta-sk-lock and are sure that it is not owned + * by the user. + */ + tcp_sk(child)->segs_in += max_t(u16, 1, skb_shinfo(skb)->gso_segs); + ret = tcp_rcv_state_process(child, skb); + bh_unlock_sock(child); + sock_put(child); + + return ret; +} + static void __mptcp_get_info(const struct sock *meta_sk, struct mptcp_meta_info *info) { diff --git a/net/mptcp/mptcp_fullmesh.c b/net/mptcp/mptcp_fullmesh.c index 9690478fae70..d29102a1dffb 100644 --- a/net/mptcp/mptcp_fullmesh.c +++ b/net/mptcp/mptcp_fullmesh.c @@ -79,7 +79,7 @@ struct fullmesh_priv { u8 rem4_bits; u8 rem6_bits; - /* Are we established the additional subflows for primary pair? */ + /* Have we established the additional subflows for primary pair? */ u8 first_pair:1; }; diff --git a/net/mptcp/mptcp_input.c b/net/mptcp/mptcp_input.c index 12d7337b9b18..f3a4dbe45bc6 100644 --- a/net/mptcp/mptcp_input.c +++ b/net/mptcp/mptcp_input.c @@ -89,10 +89,7 @@ static inline int mptcp_tso_acked_reinject(const struct sock *meta_sk, return packets_acked; } -/** - * Cleans the meta-socket retransmission queue and the reinject-queue. - * @sk must be the metasocket. - */ +/* Cleans the meta-socket retransmission queue and the reinject-queue. */ static void mptcp_clean_rtx_queue(struct sock *meta_sk, u32 prior_snd_una) { struct sk_buff *skb, *tmp, *next; @@ -350,7 +347,7 @@ static int mptcp_verif_dss_csum(struct sock *sk) /* Now, checksum must be 0 */ if (unlikely(csum_fold(csum_tcp))) { - pr_err("%s csum is wrong: %#x data_seq %u dss_csum_added %d overflowed %d iterations %d\n", + pr_err("%s csum is wrong: %#x tcp-seq %u dss_csum_added %d overflowed %d iterations %d\n", __func__, csum_fold(csum_tcp), TCP_SKB_CB(last)->seq, dss_csum_added, overflowed, iter); diff --git a/net/mptcp/mptcp_ipv4.c b/net/mptcp/mptcp_ipv4.c index c1a2d89393f4..99ff09225ebf 100644 --- a/net/mptcp/mptcp_ipv4.c +++ b/net/mptcp/mptcp_ipv4.c @@ -96,11 +96,11 @@ static u32 mptcp_v4_cookie_init_seq(struct request_sock *req, const struct sock } #endif -static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *sk, +static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *meta_sk, struct sk_buff *skb, bool want_cookie) { struct mptcp_request_sock *mtreq = mptcp_rsk(req); - const struct mptcp_cb *mpcb = tcp_sk(sk)->mpcb; + const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; union inet_addr addr; int loc_id; bool low_prio = false; @@ -112,14 +112,14 @@ static int mptcp_v4_join_init_req(struct request_sock *req, const struct sock *s */ mtreq->hash_entry.pprev = NULL; - tcp_request_sock_ipv4_ops.init_req(req, sk, skb, want_cookie); + tcp_request_sock_ipv4_ops.init_req(req, meta_sk, skb, want_cookie); mtreq->mptcp_loc_nonce = mptcp_v4_get_nonce(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, tcp_hdr(skb)->source, tcp_hdr(skb)->dest); addr.ip = inet_rsk(req)->ir_loc_addr; - loc_id = mpcb->pm_ops->get_local_id(AF_INET, &addr, sock_net(sk), &low_prio); + loc_id = mpcb->pm_ops->get_local_id(AF_INET, &addr, sock_net(meta_sk), &low_prio); if (loc_id == -1) return -1; mtreq->loc_id = loc_id; @@ -149,24 +149,6 @@ static int mptcp_v4_join_request(struct sock *meta_sk, struct sk_buff *skb) meta_sk, skb); } -int mptcp_finish_handshake(struct sock *child, struct sk_buff *skb) - __releases(&child->sk_lock.slock) -{ - int ret; - - /* We don't call tcp_child_process here, because we hold - * already the meta-sk-lock and are sure that it is not owned - * by the user. - */ - tcp_sk(child)->segs_in += max_t(u16, 1, skb_shinfo(skb)->gso_segs); - ret = tcp_rcv_state_process(child, skb); - bh_unlock_sock(child); - sock_put(child); - - return ret; -} - - /* Similar to: tcp_v4_do_rcv * We only process join requests here. (either the SYN or the final ACK) */ diff --git a/net/mptcp/mptcp_ipv6.c b/net/mptcp/mptcp_ipv6.c index 7ef56440046d..04b69220baef 100644 --- a/net/mptcp/mptcp_ipv6.c +++ b/net/mptcp/mptcp_ipv6.c @@ -125,11 +125,11 @@ static u32 mptcp_v6_cookie_init_seq(struct request_sock *req, const struct sock } #endif -static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *sk, +static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *meta_sk, struct sk_buff *skb, bool want_cookie) { struct mptcp_request_sock *mtreq = mptcp_rsk(req); - const struct mptcp_cb *mpcb = tcp_sk(sk)->mpcb; + const struct mptcp_cb *mpcb = tcp_sk(meta_sk)->mpcb; union inet_addr addr; int loc_id; bool low_prio = false; @@ -141,14 +141,14 @@ static int mptcp_v6_join_init_req(struct request_sock *req, const struct sock *s */ mtreq->hash_entry.pprev = NULL; - tcp_request_sock_ipv6_ops.init_req(req, sk, skb, want_cookie); + tcp_request_sock_ipv6_ops.init_req(req, meta_sk, skb, want_cookie); mtreq->mptcp_loc_nonce = mptcp_v6_get_nonce(ipv6_hdr(skb)->saddr.s6_addr32, ipv6_hdr(skb)->daddr.s6_addr32, tcp_hdr(skb)->source, tcp_hdr(skb)->dest); addr.in6 = inet_rsk(req)->ir_v6_loc_addr; - loc_id = mpcb->pm_ops->get_local_id(AF_INET6, &addr, sock_net(sk), &low_prio); + loc_id = mpcb->pm_ops->get_local_id(AF_INET6, &addr, sock_net(meta_sk), &low_prio); if (loc_id == -1) return -1; mtreq->loc_id = loc_id;