Add Multipath TCP (MPTCP) support Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension that enables a TCP connection to use different paths.
Multipath TCP has been used for several use cases. On smartphones, MPTCP enables seamless handovers between cellular and Wi-Fi networks while preserving Established connections. This use-case is what pushed Apple to use MPTCP since 2013 in multiple applications [2]. On dual-stack hosts, Multipath TCP enables the TCP connection to automatically use the best performing path, either IPv4 or IPv6. If one path fails, MPTCP automatically uses the other path. The benefit from MPTCP, both the client and the server have to support it. Multipath TCP is a backward-compatible TCP extension that is enabled by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...). Multipath TCP is included in the Linux kernel since version 5.6 [3]. To use it on Linux, an application must explicitly enable it when creating the socket. No need to change anything else in the application. Even if MPTCP is supported by different OS, only Linux supports the `IPPROTO_MPTCP` protocol, which is why this feature is currently limited to Linux only. This is a new version of the series sent by Maxime Dourov a few months ago. He was no longer able to continue to look at that. I hope I applied all comment sent by Maxim Dounin in [4]. ChangeLog: - v2: - Patch 1: - no seamless fallback to the default protocol - Patch 2: - Rename flag to multipath instead of mptcp as suggested. - Replace the check to include the multipath flag to use #ifdef IPPROTO_MPTCP, instead of #if NGX_LINUX, allowing any platform supporting MPTCP to enable this option - Delete redefinition of IPPROTO_MPTCP if not defined - Patch 3: - Rename flag to multipath instead of mptcp as suggested. - Add missing check #ifdef IPPROTO_MPTCP, to ensure that MPTCP is supported - Delete redefinition of IPPROTO_MPTCP if not defined - Patch 4: - Rename flag to multipath instead of mptcp as suggested. - Replace the check to include the multipath flag to use #ifdef IPPROTO_MPTCP, instead of #if NGX_LINUX, allowing any platform supporting MPTCP to enable this option - Delete redefinition of IPPROTO_MPTCP if not defined Co-developed-by: Maxime Dourov <mu...@live.be> Link: https://www.rfc-editor.org/rfc/rfc8684.html [1] Link: https://www.tessares.net/apples-mptcp-story-so-far/ [2] Link: https://www.mptcp.dev [3] Link: https://freenginx.org/pipermail/nginx-devel/2024-May/000300.html [4]