diff --git a/include/n2n.h b/include/n2n.h index 8f850e2..c725360 100644 --- a/include/n2n.h +++ b/include/n2n.h @@ -137,7 +137,6 @@ #ifdef WIN32 #include /* for tcp */ #define SHUT_RDWR SD_BOTH /* for tcp */ -#define SOL_TCP IPPROTO_TCP /* for tcp */ #include "win32/wintap.h" #include #else @@ -155,17 +154,11 @@ #include "sn_selection.h" #include "network_traffic_filter.h" +/* ************************************** */ + #include "header_encryption.h" #include "tf.h" -/* ************************************** */ - -#if !defined(SOL_TCP) && defined(IPPROTO_TCP) -#define SOL_TCP IPPROTO_TCP -#endif - -/* ************************************** */ - #ifndef TRACE_ERROR #define TRACE_ERROR 0, __FILE__, __LINE__ #define TRACE_WARNING 1, __FILE__, __LINE__ diff --git a/src/edge_utils.c b/src/edge_utils.c index 46f04fb..4941f90 100644 --- a/src/edge_utils.c +++ b/src/edge_utils.c @@ -888,10 +888,10 @@ static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf, // if the connection is tcp, i.e. not the regular sock... if(eee->conf.connect_tcp) { - setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); + setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); value = 1; -#if !defined(WIN32) && !defined(__APPLE__) - setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value)); +#ifdef LINUX + setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); #endif // prepend packet length... @@ -907,10 +907,10 @@ static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf, // if the connection is tcp, i.e. not the regular sock... if(eee->conf.connect_tcp) { value = 1; /* value should still be set to 1 */ - setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); -#if !defined(WIN32) && !defined(__APPLE__) + setsockopt(eee->sock, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); +#ifdef LINUX value = 0; - setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value)); + setsockopt(eee->sock, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); #endif } diff --git a/src/sn_utils.c b/src/sn_utils.c index 7ee8746..2aab48e 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -149,10 +149,10 @@ static ssize_t sendto_sock(n2n_sn_t *sss, // if the connection is tcp, i.e. not the regular sock... if((socket_fd >= 0) && (socket_fd != sss->sock)) { - setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); + setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); value = 1; -#if !defined(WIN32) && !defined(__APPLE__) - setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value)); +#ifdef LINUX + setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); #endif // prepend packet length... @@ -169,10 +169,10 @@ static ssize_t sendto_sock(n2n_sn_t *sss, // if the connection is tcp, i.e. not the regular sock... if((socket_fd >= 0) && (socket_fd != sss->sock)) { value = 1; /* value should still be set to 1 */ - setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); -#if !defined(WIN32) && !defined(__APPLE__) + setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); +#ifdef LINUX value = 0; - setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value)); + setsockopt(socket_fd, IPPROTO_TCP, TCP_CORK, &value, sizeof(value)); #endif }