Browse Source

Fix compilation on MacOS

pull/678/head
Alfredo Cardigliano 4 years ago
parent
commit
53e930db10
  1. 10
      include/n2n.h
  2. 4
      src/edge_utils.c
  3. 4
      src/sn_utils.c

10
include/n2n.h

@ -155,11 +155,17 @@
#include "sn_selection.h" #include "sn_selection.h"
#include "network_traffic_filter.h" #include "network_traffic_filter.h"
/* ************************************** */
#include "header_encryption.h" #include "header_encryption.h"
#include "tf.h" #include "tf.h"
/* ************************************** */
#if !defined(SOL_TCP) && defined(IPPROTO_TCP)
#define SOL_TCP IPPROTO_TCP
#endif
/* ************************************** */
#ifndef TRACE_ERROR #ifndef TRACE_ERROR
#define TRACE_ERROR 0, __FILE__, __LINE__ #define TRACE_ERROR 0, __FILE__, __LINE__
#define TRACE_WARNING 1, __FILE__, __LINE__ #define TRACE_WARNING 1, __FILE__, __LINE__

4
src/edge_utils.c

@ -890,7 +890,7 @@ static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf,
setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
value = 1; value = 1;
#ifndef WIN32 #if !defined(WIN32) && !defined(__APPLE__)
setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value)); setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value));
#endif #endif
@ -908,7 +908,7 @@ static ssize_t sendto_sock (n2n_edge_t *eee, const void * buf,
if(eee->conf.connect_tcp) { if(eee->conf.connect_tcp) {
value = 1; /* value should still be set to 1 */ value = 1; /* value should still be set to 1 */
setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); setsockopt(eee->sock, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
#ifndef WIN32 #if !defined(WIN32) && !defined(__APPLE__)
value = 0; value = 0;
setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value)); setsockopt(eee->sock, SOL_TCP, TCP_CORK, &value, sizeof(value));
#endif #endif

4
src/sn_utils.c

@ -151,7 +151,7 @@ static ssize_t sendto_sock(n2n_sn_t *sss,
setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
value = 1; value = 1;
#ifndef WIN32 #if !defined(WIN32) && !defined(__APPLE__)
setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value)); setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value));
#endif #endif
@ -170,7 +170,7 @@ static ssize_t sendto_sock(n2n_sn_t *sss,
if((socket_fd >= 0) && (socket_fd != sss->sock)) { if((socket_fd >= 0) && (socket_fd != sss->sock)) {
value = 1; /* value should still be set to 1 */ value = 1; /* value should still be set to 1 */
setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value)); setsockopt(socket_fd, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
#ifndef WIN32 #if !defined(WIN32) && !defined(__APPLE__)
value = 0; value = 0;
setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value)); setsockopt(socket_fd, SOL_TCP, TCP_CORK, &value, sizeof(value));
#endif #endif

Loading…
Cancel
Save