Commit 71b077e4 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

mptcp: clean-up MPJ option writing

Check for all MPJ variant at once, this reduces the number
of conditionals traversed on average and will simplify the
next patch.

No functional change intended.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7d6a237
...@@ -1385,27 +1385,29 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, ...@@ -1385,27 +1385,29 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,
/* MPC is additionally mutually exclusive with MP_PRIO */ /* MPC is additionally mutually exclusive with MP_PRIO */
goto mp_capable_done; goto mp_capable_done;
} else if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) { } else if (OPTIONS_MPTCP_MPJ & opts->suboptions) {
*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, if (OPTION_MPTCP_MPJ_SYN & opts->suboptions) {
TCPOLEN_MPTCP_MPJ_SYN, *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
opts->backup, opts->join_id); TCPOLEN_MPTCP_MPJ_SYN,
put_unaligned_be32(opts->token, ptr); opts->backup, opts->join_id);
ptr += 1; put_unaligned_be32(opts->token, ptr);
put_unaligned_be32(opts->nonce, ptr); ptr += 1;
ptr += 1; put_unaligned_be32(opts->nonce, ptr);
} else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) { ptr += 1;
*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, } else if (OPTION_MPTCP_MPJ_SYNACK & opts->suboptions) {
TCPOLEN_MPTCP_MPJ_SYNACK, *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
opts->backup, opts->join_id); TCPOLEN_MPTCP_MPJ_SYNACK,
put_unaligned_be64(opts->thmac, ptr); opts->backup, opts->join_id);
ptr += 2; put_unaligned_be64(opts->thmac, ptr);
put_unaligned_be32(opts->nonce, ptr); ptr += 2;
ptr += 1; put_unaligned_be32(opts->nonce, ptr);
} else if (OPTION_MPTCP_MPJ_ACK & opts->suboptions) { ptr += 1;
*ptr++ = mptcp_option(MPTCPOPT_MP_JOIN, } else {
TCPOLEN_MPTCP_MPJ_ACK, 0, 0); *ptr++ = mptcp_option(MPTCPOPT_MP_JOIN,
memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN); TCPOLEN_MPTCP_MPJ_ACK, 0, 0);
ptr += 5; memcpy(ptr, opts->hmac, MPTCPOPT_HMAC_LEN);
ptr += 5;
}
} else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { } else if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) {
u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE; u8 len = TCPOLEN_MPTCP_ADD_ADDR_BASE;
u8 echo = MPTCP_ADDR_ECHO; u8 echo = MPTCP_ADDR_ECHO;
......
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