Content-Type: multipart/mixed; boundary="===============3609395998361261997==" MIME-Version: 1.0 From: Davide Caratti To: mptcp at lists.01.org Subject: [MPTCP] Re: [PATCH 1/2] mptcp: parse and emit MP_CAPABLE option according to v1 spec. Date: Fri, 29 Nov 2019 13:54:02 +0100 Message-ID: <965954023c7a67bfd8e7f42bba7c19b512b8241c.camel@redhat.com> In-Reply-To: 20191107152827.54549-2-cpaasch@apple.com X-Status: X-Keywords: X-UID: 2706 --===============3609395998361261997== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, 2019-11-07 at 07:28 -0800, Christoph Paasch wrote: > -#define TCPOLEN_MPTCP_MPC_SYNACK 20 > +#define TCPOLEN_MPTCP_MPC_SYN 4 > +#define TCPOLEN_MPTCP_MPC_SYNACK 12 > #define TCPOLEN_MPTCP_MPC_ACK 20 hello Christoph and Paolo, the length of the 'mp_capable' option in the SYN/ACK doesn't really change when moving from v0 to v1 version of the MPTCP protocol. Current mptcp net-next echoes the client's key in the SYN/ACK but I think this is not intentional (at least, it does not seem to adhere to section 3.1 of RFC https://tools.ietf.org/html/rfc6824). For the record, this is why tcpdump refuses to dissect captures of selftests: # ./mptcp_connect.sh -4 -c -e IP 10.0.1.1.49752 > 10.0.1.1.10000: Flags [S], seq 2594718977, win 65535, = options [mss 65495,sackOK,TS val 3944347269 ecr 0,nop,wscale 8,mptcp capabl= e {0xf931b304deb39a42}], length 0 IP 10.0.1.1.10000 > 10.0.1.1.49752: Flags [S.], seq 3996234497, ack 259471= 8978, win 65535, options [mss 65495,sackOK,TS val 3944347270 ecr 3944347269= ,nop,wscale 8,mptcp capable[bad opt]> ^^^ bad option IP 10.0.1.1.49752 > 10.0.1.1.10000: Flags [.], ack 1, win 256, options [no= p,nop,TS val 3944347270 ecr 3944347270,mptcp capable {0xf931b304deb39a42,0x= 96614f185e633ce}], length 0 and also, it's the reason why packetdrill never stores the server key in its variables, see: https://github.com/dcaratti/packetdrill/issues/1#issuecomment-559569544 is it possible to fix size of the syn/ack generated by v0 version of the protocol as a separate patch? Otherwise I will need to add a special handling for SYN/ACK packets generated by v0 net-next kernels packets. (the code I tried is quite trivial, and it passes the smoke-test in tools/testing/selftests) --- >8 --- --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -57,16 +57,8 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize, mp_opt->sndr_key =3D get_unaligned_be64(ptr); ptr +=3D 8; = - if (opsize =3D=3D TCPOLEN_MPTCP_MPC_SYNACK) { - mp_opt->rcvr_key =3D get_unaligned_be64(ptr); - ptr +=3D 8; - pr_debug("MP_CAPABLE flags=3D%x, sndr=3D%llu, rcvr=3D%llu", - mp_opt->flags, mp_opt->sndr_key, - mp_opt->rcvr_key); - } else { - pr_debug("MP_CAPABLE flags=3D%x, sndr=3D%llu", - mp_opt->flags, mp_opt->sndr_key); - } + pr_debug("MP_CAPABLE flags=3D%x, sndr=3D%llu", + mp_opt->flags, mp_opt->sndr_key); break; = /* MPTCPOPT_MP_JOIN @@ -650,8 +642,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts) MPTCP_CAP_HMAC_SHA1); put_unaligned_be64(opts->sndr_key, ptr); ptr +=3D 2; - if ((OPTION_MPTCP_MPC_SYNACK | - OPTION_MPTCP_MPC_ACK) & opts->suboptions) { + if (OPTION_MPTCP_MPC_ACK & opts->suboptions) { put_unaligned_be64(opts->rcvr_key, ptr); ptr +=3D 2; } diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index acad61c70de9..10347c9b4dff 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -34,7 +34,7 @@ = /* MPTCP suboption lengths */ #define TCPOLEN_MPTCP_MPC_SYN 12 -#define TCPOLEN_MPTCP_MPC_SYNACK 20 +#define TCPOLEN_MPTCP_MPC_SYNACK 12 #define TCPOLEN_MPTCP_MPC_ACK 20 #define TCPOLEN_MPTCP_MPJ_SYN 12 #define TCPOLEN_MPTCP_MPJ_SYNACK 16 --- >8 --- any feedback appreciated, thank you in advance! -- = davide --===============3609395998361261997==--