mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-11-05 06:24:10 +00:00
Detect kernel support for MPTCP at runtime
This commit is contained in:
+17
@@ -578,3 +578,20 @@ load16_be(const void *s)
|
||||
return ((uint16_t)in[0] << 8)
|
||||
| ((uint16_t)in[1]);
|
||||
}
|
||||
|
||||
int
|
||||
get_mptcp(int enable)
|
||||
{
|
||||
const char oldpath[] = "/proc/sys/net/mptcp/mptcp_enabled";
|
||||
|
||||
if (enable) {
|
||||
// Check if kernel has out-of-tree MPTCP support.
|
||||
if (access(oldpath, F_OK) != -1)
|
||||
return 1;
|
||||
|
||||
// Otherwise, just use IPPROTO_MPTCP.
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user