Skip to content

Commit 724b00c

Browse files
edumazetkuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Reviewed-by: Simon Horman <[email protected]> Acked-by: Paolo Abeni <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Fixes: 74c7dfb ("mptcp: consolidate in_opt sub-options fields in a bitmask") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 66ff70d commit 724b00c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/mptcp/subflow.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ static int subflow_check_req(struct request_sock *req,
157157

158158
mptcp_get_options(skb, &mp_opt);
159159

160-
opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC);
160+
opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYN);
161161
opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_SYN);
162162
if (opt_mp_capable) {
163163
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_MPCAPABLEPASSIVE);
@@ -254,7 +254,7 @@ int mptcp_subflow_init_cookie_req(struct request_sock *req,
254254
subflow_init_req(req, sk_listener);
255255
mptcp_get_options(skb, &mp_opt);
256256

257-
opt_mp_capable = !!(mp_opt.suboptions & OPTIONS_MPTCP_MPC);
257+
opt_mp_capable = !!(mp_opt.suboptions & OPTION_MPTCP_MPC_ACK);
258258
opt_mp_join = !!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK);
259259
if (opt_mp_capable && opt_mp_join)
260260
return -EINVAL;
@@ -486,7 +486,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
486486

487487
mptcp_get_options(skb, &mp_opt);
488488
if (subflow->request_mptcp) {
489-
if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC)) {
489+
if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_SYNACK)) {
490490
MPTCP_INC_STATS(sock_net(sk),
491491
MPTCP_MIB_MPCAPABLEACTIVEFALLBACK);
492492
mptcp_do_fallback(sk);
@@ -783,7 +783,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
783783
* options.
784784
*/
785785
mptcp_get_options(skb, &mp_opt);
786-
if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPC))
786+
if (!(mp_opt.suboptions & OPTION_MPTCP_MPC_ACK))
787787
fallback = true;
788788

789789
} else if (subflow_req->mp_join) {

0 commit comments

Comments
 (0)