From e361afb7f918afcfaae978cc589345bba62115a8 Mon Sep 17 00:00:00 2001 From: Muhammad Nuzaihan Bin Kamal Luddin Date: Sat, 17 May 2025 01:23:11 +0800 Subject: [PATCH] Enable the use of MPTCP on Linux (when available) IPPROTO_MPTCP v1 (not the old v0) has been improved to go about the limitations of middleboxes. MPTCP protocol is an extension of standard TCP which enables multiple IP to aggregate bandwidth at layer 4 of the OSI stack across as said IP(s). Similar to link aggregation which works at layer 2. MPTCP works on top of IP layer. Other than aggregating bandwidth, MPTCP also allows seamless failover when one network path is down between the client and server. This patch enables IPPROTO_MPTCP if IPPROTO_MPTCP is available and uses plain TCP if the Linux system does not support it. Signed-off-by: Muhammad Nuzaihan Bin Kamal Luddin --- connect.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/connect.c b/connect.c index 3280435331038e..8473f0b02e39ea 100644 --- a/connect.c +++ b/connect.c @@ -827,8 +827,11 @@ static int git_tcp_connect_sock(char *host, int flags) else if (flags & CONNECT_IPV6) hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - +#ifdef IPPROTO_MPTCP + hints.ai_protocol = IPPROTO_MPTCP; +#else + hints.ai_protocol = IPPROTO_TCP; +#endif if (flags & CONNECT_VERBOSE) fprintf(stderr, _("Looking up %s ... "), host);