From 499f9824ab4e7cbd5bb9d5abfad2c452956a7bef Mon Sep 17 00:00:00 2001 From: bol-van Date: Sat, 14 Dec 2024 20:36:56 +0300 Subject: [PATCH] tpws: more compats --- tpws/helpers.c | 3 +++ tpws/linux_compat.h | 10 +++++++++- tpws/redirect.c | 4 +--- tpws/tpws_conn.c | 1 + 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tpws/helpers.c b/tpws/helpers.c index c1b17bf..8d71403 100644 --- a/tpws/helpers.c +++ b/tpws/helpers.c @@ -19,6 +19,9 @@ #endif #include "helpers.h" +#ifdef __linux__ +#include +#endif #include "linux_compat.h" int unique_size_t(size_t *pu, int ct) diff --git a/tpws/linux_compat.h b/tpws/linux_compat.h index 8936c49..5695292 100644 --- a/tpws/linux_compat.h +++ b/tpws/linux_compat.h @@ -1,6 +1,14 @@ #ifdef __linux__ -#include +#include + +#ifndef TCP_USER_TIMEOUT +#define TCP_USER_TIMEOUT 18 +#endif + +#ifndef IP6T_SO_ORIGINAL_DST + #define IP6T_SO_ORIGINAL_DST 80 +#endif // workaround for old headers diff --git a/tpws/redirect.c b/tpws/redirect.c index ecfc8b2..58491ec 100644 --- a/tpws/redirect.c +++ b/tpws/redirect.c @@ -9,12 +9,10 @@ #include "params.h" #include "helpers.h" +#include "linux_compat.h" #ifdef __linux__ #include - #ifndef IP6T_SO_ORIGINAL_DST - #define IP6T_SO_ORIGINAL_DST 80 - #endif #endif diff --git a/tpws/tpws_conn.c b/tpws/tpws_conn.c index 5c54ebd..b4056ee 100644 --- a/tpws/tpws_conn.c +++ b/tpws/tpws_conn.c @@ -23,6 +23,7 @@ #include "socks.h" #include "helpers.h" #include "hostlist.h" +#include "linux_compat.h" // keep separate legs counter. counting every time thousands of legs can consume cpu static int legs_local, legs_remote;