* [MPTCP] [PATCH] mptcp: Add explicit check for protocol version
@ 2019-05-21 18:15 Peter Krystad
0 siblings, 0 replies; 3+ messages in thread
From: Peter Krystad @ 2019-05-21 18:15 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1386 bytes --]
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".
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
net/mptcp/options.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index c71e40f6f06a..9b9b9c9390c1 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -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;
--
2.17.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [MPTCP] [PATCH] mptcp: Add explicit check for protocol version
@ 2019-05-22 16:28 Matthieu Baerts
0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2019-05-22 16:28 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]
Hi Peter, Mat,
On 22/05/2019 16:54, Mat Martineau wrote:
>
> On Tue, 21 May 2019, Peter Krystad wrote:
>
>> 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".
>>
>
> 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
>
>
> Mat
>
>
>> Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
>> ---
>> net/mptcp/options.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
>> index c71e40f6f06a..9b9b9c9390c1 100644
>> --- a/net/mptcp/options.c
>> +++ b/net/mptcp/options.c
>> @@ -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;
>> --
>> 2.17.2
>
> --
> Mat Martineau
> Intel
> _______________________________________________
> mptcp mailing list
> mptcp(a)lists.01.org
> https://lists.01.org/mailman/listinfo/mptcp
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [MPTCP] [PATCH] mptcp: Add explicit check for protocol version
@ 2019-05-22 14:54 Mat Martineau
0 siblings, 0 replies; 3+ messages in thread
From: Mat Martineau @ 2019-05-22 14:54 UTC (permalink / raw)
To: mptcp
[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]
On Tue, 21 May 2019, Peter Krystad wrote:
> 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".
>
Thanks Peter, patch looks ready to merge.
Mat
> Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
> ---
> net/mptcp/options.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index c71e40f6f06a..9b9b9c9390c1 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c
> @@ -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;
> --
> 2.17.2
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-22 16:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 18:15 [MPTCP] [PATCH] mptcp: Add explicit check for protocol version Peter Krystad
2019-05-22 14:54 Mat Martineau
2019-05-22 16:28 Matthieu Baerts
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.