Detect kernel support for MPTCP at runtime

This commit is contained in:
Maxim Galaganov
2022-06-23 10:38:32 +08:00
committed by Max Lv
parent 01dd7df1da
commit d61d09aa0c
8 changed files with 57 additions and 44 deletions
+7 -2
View File
@@ -60,14 +60,19 @@ typedef struct {
char *port;
} ss_addr_t;
// Be compatible with older libc.
#ifndef IPPROTO_MPTCP
/* MPTCP_ENABLED setsockopt values for kernel 4 & 3, best behaviour to be independant of kernel version is to test from newest to the latest values */
#define IPPROTO_MPTCP 262
#endif
/* MPTCP_ENABLED setsockopt values for out-of-tree kernel 4 & 3, best behaviour
* to be independent of kernel version is to test from newest to latest values.
*/
#ifndef MPTCP_ENABLED
static const char mptcp_enabled_values[] = { 42, 26, 0 };
#else
static const char mptcp_enabled_values[] = { MPTCP_ENABLED, 0 };
#endif
#endif
#ifndef UPDATE_INTERVAL
#define UPDATE_INTERVAL 5