diff --git a/edge_utils.c b/edge_utils.c index 6acaf0c..70f503d 100644 --- a/edge_utils.c +++ b/edge_utils.c @@ -1266,9 +1266,13 @@ static void send_packet2net(n2n_edge_t * eee, traceEvent(TRACE_DEBUG, "Encode %u B PACKET [%u B data, %u B overhead] transform %u", (u_int)idx, (u_int)len, (u_int)(idx-len), tx_transop_idx); -#if 0 - // MTU assertion to avoid fragmentation - assert(idx <= 1500); +#ifdef MTU_ASSERT_VALUE + { + const u_int eth_udp_overhead = 14 + 20 + 8; + + // MTU assertion which avoids fragmentation by N2N + assert(idx + eth_udp_overhead <= MTU_ASSERT_VALUE); + } #endif eee->transop.tx_cnt++; /* stats */ diff --git a/n2n.h b/n2n.h index 21473dd..cb9f4d6 100644 --- a/n2n.h +++ b/n2n.h @@ -164,7 +164,10 @@ typedef struct tuntap_dev { * same value if they are to understand each other. */ #define N2N_COMPRESSION_ENABLED 1 -#define DEFAULT_MTU 1400 +#define DEFAULT_MTU 1390 + +/** Uncomment this to enable the MTU check */ +//#define MTU_ASSERT_VALUE 1500 /** Common type used to hold stringified IP addresses. */ typedef char ipstr_t[32];