mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 19:53:46 +00:00
Fix --mptcp on kernels with mainlined MPTCP.
Mainlined MPTCP on Linux 5.6+ is enabled with IPPROTO_MPTCP rather than setsockopt.
This commit is contained in:
committed by
Max Lv
parent
e21f8248b6
commit
1630764b02
+9
-1
@@ -594,7 +594,13 @@ create_and_bind(const char *host, const char *port, int mptcp)
|
||||
}
|
||||
|
||||
for (/*rp = result*/; rp != NULL; rp = rp->ai_next) {
|
||||
listen_sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
|
||||
int protocol = rp->ai_protocol;
|
||||
#ifdef IPPROTO_MPTCP
|
||||
if (mptcp == 1) {
|
||||
protocol = IPPROTO_MPTCP;
|
||||
}
|
||||
#endif
|
||||
listen_sock = socket(rp->ai_family, rp->ai_socktype, protocol);
|
||||
if (listen_sock == -1) {
|
||||
continue;
|
||||
}
|
||||
@@ -616,6 +622,7 @@ create_and_bind(const char *host, const char *port, int mptcp)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef IPPROTO_MPTCP
|
||||
if (mptcp == 1) {
|
||||
int i = 0;
|
||||
while ((mptcp = mptcp_enabled_values[i]) > 0) {
|
||||
@@ -629,6 +636,7 @@ create_and_bind(const char *host, const char *port, int mptcp)
|
||||
ERROR("failed to enable multipath TCP");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
s = bind(listen_sock, rp->ai_addr, rp->ai_addrlen);
|
||||
if (s == 0) {
|
||||
|
||||
Reference in New Issue
Block a user