mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 20:48:49 +08:00
mptcp: refine opt_mp_capable determination
OPTIONS_MPTCP_MPC is a combination of three flags.
It would be better to be strict about testing what
flag is expected, at least for code readability.
mptcp_parse_option() already makes the distinction.
- subflow_check_req() should use OPTION_MPTCP_MPC_SYN.
- mptcp_subflow_init_cookie_req() should use OPTION_MPTCP_MPC_ACK.
- subflow_finish_connect() should use OPTION_MPTCP_MPC_SYNACK
- subflow_syn_recv_sock should use OPTION_MPTCP_MPC_ACK
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Fixes: 74c7dfbee3
("mptcp: consolidate in_opt sub-options fields in a bitmask")
Link: https://lore.kernel.org/r/20240111194917.4044654-6-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
66ff70df1a
commit
724b00c129
@ -157,7 +157,7 @@ static int subflow_check_req(struct request_sock *req,
|
||||
|
||||
mptcp_get_options(skb, &mp_opt);
|
||||
|
||||
opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC);
|
||||
opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN);
|
||||
opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN);
|
||||
if (opt_mp_capable) {
|
||||
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE);
|
||||
@ -254,7 +254,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req,
|
||||
subflow_init_req(req, sk_listener);
|
||||
mptcp_get_options(skb, &mp_opt);
|
||||
|
||||
opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC);
|
||||
opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_ACK);
|
||||
opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK);
|
||||
if (opt_mp_capable && opt_mp_join)
|
||||
return -EINVAL;
|
||||
@ -486,7 +486,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
|
||||
|
||||
mptcp_get_options(skb, &mp_opt);
|
||||
if (subflow->request_mptcp) {
|
||||
if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) {
|
||||
if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYNACK)) {
|
||||
MPTCP_INC_STATS(sock_net(sk),
|
||||
MPTCP_MIB_MPCAPABLEACTIVEFALLBACK);
|
||||
mptcp_do_fallback(sk);
|
||||
@ -783,7 +783,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
|
||||
* options.
|
||||
*/
|
||||
mptcp_get_options(skb, &mp_opt);
|
||||
if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC))
|
||||
if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_ACK))
|
||||
fallback = true;
|
||||
|
||||
} else if (subflow_req->mp_join) {
|
||||
|
Loading…
Reference in New Issue
Block a user