Skip to content

Commit 2c58723

Browse files
committed
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 is optional and detects if IPPROTO_MPTCP is available and uses it when the Linux system supports it. Signed-off-by: Muhammad Nuzaihan Bin Kamal Luddin <zaihan@unrealasia.net>
1 parent 1a8a497 commit 2c58723

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

connect.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,11 @@ static int git_tcp_connect_sock(char *host, int flags)
827827
else if (flags & CONNECT_IPV6)
828828
hints.ai_family = AF_INET6;
829829
hints.ai_socktype = SOCK_STREAM;
830-
hints.ai_protocol = IPPROTO_TCP;
831-
830+
#ifdef IPPROTO_MPTCP
831+
hints.ai_protocol = IPPROTO_MPTCP;
832+
#else
833+
hints.ai_protocol = IPPROTO_TCP;
834+
#endif
832835
if (flags & CONNECT_VERBOSE)
833836
fprintf(stderr, _("Looking up %s ... "), host);
834837

0 commit comments

Comments
 (0)