Commit c863225b authored by Geliang Tang's avatar Geliang Tang Committed by David S. Miller

mptcp: add sk parameter for mptcp_get_options

This patch added a new parameter name sk in mptcp_get_options().
Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarGeliang Tang <geliangtang@gmail.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5b39e26
...@@ -323,7 +323,8 @@ static void mptcp_parse_option(const struct sk_buff *skb, ...@@ -323,7 +323,8 @@ static void mptcp_parse_option(const struct sk_buff *skb,
} }
} }
void mptcp_get_options(const struct sk_buff *skb, void mptcp_get_options(const struct sock *sk,
const struct sk_buff *skb,
struct mptcp_options_received *mp_opt) struct mptcp_options_received *mp_opt)
{ {
const struct tcphdr *th = tcp_hdr(skb); const struct tcphdr *th = tcp_hdr(skb);
...@@ -1024,7 +1025,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) ...@@ -1024,7 +1025,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
return; return;
} }
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk, skb, &mp_opt);
if (!check_fully_established(msk, sk, subflow, skb, &mp_opt)) if (!check_fully_established(msk, sk, subflow, skb, &mp_opt))
return; return;
......
...@@ -586,7 +586,8 @@ int __init mptcp_proto_v6_init(void); ...@@ -586,7 +586,8 @@ int __init mptcp_proto_v6_init(void);
struct sock *mptcp_sk_clone(const struct sock *sk, struct sock *mptcp_sk_clone(const struct sock *sk,
const struct mptcp_options_received *mp_opt, const struct mptcp_options_received *mp_opt,
struct request_sock *req); struct request_sock *req);
void mptcp_get_options(const struct sk_buff *skb, void mptcp_get_options(const struct sock *sk,
const struct sk_buff *skb,
struct mptcp_options_received *mp_opt); struct mptcp_options_received *mp_opt);
void mptcp_finish_connect(struct sock *sk); void mptcp_finish_connect(struct sock *sk);
......
...@@ -151,7 +151,7 @@ static int subflow_check_req(struct request_sock *req, ...@@ -151,7 +151,7 @@ static int subflow_check_req(struct request_sock *req,
return -EINVAL; return -EINVAL;
#endif #endif
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk_listener, skb, &mp_opt);
if (mp_opt.mp_capable) { if (mp_opt.mp_capable) {
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE); SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE);
...@@ -248,7 +248,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req, ...@@ -248,7 +248,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req,
int err; int err;
subflow_init_req(req, sk_listener); subflow_init_req(req, sk_listener);
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk_listener, skb, &mp_opt);
if (mp_opt.mp_capable && mp_opt.mp_join) if (mp_opt.mp_capable && mp_opt.mp_join)
return -EINVAL; return -EINVAL;
...@@ -395,7 +395,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) ...@@ -395,7 +395,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
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", subflow, subflow->ssn_offset);
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk, skb, &mp_opt);
if (subflow->request_mptcp) { if (subflow->request_mptcp) {
if (!mp_opt.mp_capable) { if (!mp_opt.mp_capable) {
MPTCP_INC_STATS(sock_net(sk), MPTCP_INC_STATS(sock_net(sk),
...@@ -639,7 +639,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, ...@@ -639,7 +639,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
* reordered MPC will cause fallback, but we don't have other * reordered MPC will cause fallback, but we don't have other
* options. * options.
*/ */
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk, skb, &mp_opt);
if (!mp_opt.mp_capable) { if (!mp_opt.mp_capable) {
fallback = true; fallback = true;
goto create_child; goto create_child;
...@@ -649,7 +649,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, ...@@ -649,7 +649,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
if (!new_msk) if (!new_msk)
fallback = true; fallback = true;
} else if (subflow_req->mp_join) { } else if (subflow_req->mp_join) {
mptcp_get_options(skb, &mp_opt); mptcp_get_options(sk, skb, &mp_opt);
if (!mp_opt.mp_join || !subflow_hmac_valid(req, &mp_opt) || if (!mp_opt.mp_join || !subflow_hmac_valid(req, &mp_opt) ||
!mptcp_can_accept_new_subflow(subflow_req->msk)) { !mptcp_can_accept_new_subflow(subflow_req->msk)) {
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC); SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
......
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