mptcp: Add explicit check for protocol version
Subsystems (2)
Peter Krystad
PATCH 1/1 mptcp: Add explicit check for protocol version
Currently only MPTCP v0 is supported so ignore v1 MP_CAPABLE option.
Also, make sure zeros are shifted to the correct position...
Squash to "Handle MPTCP TCP options".
--- net/mptcp/options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/mptcp/options.c +6 -3
@@ -30,8 +30,11 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,break ;pr_debug ("MP_CAPABLE" ); - opt_rx->mptcp.mp_capable =1 ; opt_rx->mptcp.version = *ptr++ &MPTCPOPT_VERSION_MASK ; +if (opt_rx->mptcp.version !=0 ) +break ; + + opt_rx->mptcp.mp_capable =1 ;pr_debug ("flags=%02x" , *ptr); opt_rx->mptcp.flags = *ptr++; opt_rx->mptcp.sndr_key =get_unaligned_be64 (ptr);
@@ -399,8 +402,8 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) len =TCPOLEN_MPTCP_MPC_ACK ; *ptr++ =htonl ((TCPOPT_MPTCP <<24 ) | (len <<16 ) | - (MPTCPOPT_MP_CAPABLE <<20 ) | - ((MPTCPOPT_VERSION_MASK &0 ) <<16 ) | + (MPTCPOPT_MP_CAPABLE <<12 ) | + ((MPTCPOPT_VERSION_MASK &0 ) <<8 ) |MPTCP_CAP_HMAC_SHA1 );put_unaligned_be64 (opts->sndr_key, ptr); ptr +=2 ;
Signature · 1 line
2.17.2
Mat Martineau
Quoted 6 lines · Peter Krystad
Currently only MPTCP v0 is supported so ignore v1
MP_CAPABLEoption.Also, make sure zeros are shifted to the correct position...
Squash to "Handle MPTCP TCP options".
Thanks Peter, patch looks ready to merge.
Mat
Quoted 35 lines
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>---
net/mptcp/options.c| 9 ++++++---1 file changed, 6 insertions(+), 3 deletions(-)net/mptcp/options.c +6
-3@@ -30,8 +30,11 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,break ;pr_debug ("MP_CAPABLE" ); - opt_rx->mptcp.mp_capable =1 ; opt_rx->mptcp.version = *ptr++ &MPTCPOPT_VERSION_MASK ; +if (opt_rx->mptcp.version !=0 ) +break ; + + opt_rx->mptcp.mp_capable =1 ;pr_debug ("flags=%02x" , *ptr); opt_rx->mptcp.flags = *ptr++; opt_rx->mptcp.sndr_key =get_unaligned_be64 (ptr);@@ -399,8 +402,8 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) len =TCPOLEN_MPTCP_MPC_ACK ; *ptr++ =htonl ((TCPOPT_MPTCP <<24 ) | (len <<16 ) | - (MPTCPOPT_MP_CAPABLE <<20 ) | - ((MPTCPOPT_VERSION_MASK &0 ) <<16 ) | + (MPTCPOPT_MP_CAPABLE <<12 ) | + ((MPTCPOPT_VERSION_MASK &0 ) <<8 ) |MPTCP_CAP_HMAC_SHA1 );put_unaligned_be64 (opts->sndr_key, ptr); ptr +=2 ;Signature · 1 line
2.17.2
--
Mat Martineau
Intel
Matthieu Baerts
Hi Peter, Mat,
Quoted 11 lines · Mat Martineau
Quoted 6 lines · Peter Krystad
Currently only MPTCP v0 is supported so ignore v1
MP_CAPABLEoption.Also, make sure zeros are shifted to the correct position...
Squash to "Handle MPTCP TCP options".
Thanks Peter, patch looks ready to merge.
Thank you for the fix and the review!
Just squashed as asked.
- squash: 06eaaf5cd641 (with a small conflict)
- update of the commit message: b14c889ea79c (mention which version is supported)
- conflict: 6ffdacc999da (opposite as before)
- result: 182f21f25f6a..bcf4fe51494f (from TopGit)
- exported commit: 09df85bafe0f
Cheers,
Matt
Quoted 50 lines
Mat
Quoted 37 lines
Signed-off-by Peter Krystad <peter.krystad(a)linux.intel.com>---
net/mptcp/options.c| 9 ++++++---1 file changed, 6 insertions(+), 3 deletions(-)net/mptcp/options.c +4
-1@@ -30,8 +30,11 @@ void mptcp_parse_option(const unsigned char *ptr,int opsize, break; pr_debug("MP_CAPABLE"); - opt_rx->mptcp.mp_capable = 1; opt_rx->mptcp.version = *ptr++ & MPTCPOPT_VERSION_MASK; + if (opt_rx->mptcp.version != 0) + break; + + opt_rx->mptcp.mp_capable = 1; pr_debug("flags=%02x", *ptr); opt_rx->mptcp.flags = *ptr++;
opt_rx->mptcp.sndr_key=get_unaligned_be64(ptr);net/mptcp/options.c +2
-2@@ -399,8 +402,8 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) len = TCPOLEN_MPTCP_MPC_ACK; *ptr++ = htonl((TCPOPT_MPTCP << 24) | (len << 16) | - (MPTCPOPT_MP_CAPABLE << 20) | - ((MPTCPOPT_VERSION_MASK & 0) << 16) | + (MPTCPOPT_MP_CAPABLE << 12) | + ((MPTCPOPT_VERSION_MASK & 0) << 8) | MPTCP_CAP_HMAC_SHA1); put_unaligned_be64(opts->sndr_key, ptr);ptr += 2;
--
2.17.2Signature · 6 lines
Mat Martineau Intel _______________________________________________ mptcp mailing list mptcp(a)lists.01.org https://lists.01.org/mailman/listinfo/mptcp
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium