Fix mtu with AES

This avoids fragmentation when possible
This commit is contained in:
emanuele-f 2019-07-15 20:14:14 +02:00
parent 6328962752
commit 035b66b1a9
2 changed files with 11 additions and 4 deletions

View File

@ -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", 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); (u_int)idx, (u_int)len, (u_int)(idx-len), tx_transop_idx);
#if 0 #ifdef MTU_ASSERT_VALUE
// MTU assertion to avoid fragmentation {
assert(idx <= 1500); 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 #endif
eee->transop.tx_cnt++; /* stats */ eee->transop.tx_cnt++; /* stats */

5
n2n.h
View File

@ -164,7 +164,10 @@ typedef struct tuntap_dev {
* same value if they are to understand each other. */ * same value if they are to understand each other. */
#define N2N_COMPRESSION_ENABLED 1 #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. */ /** Common type used to hold stringified IP addresses. */
typedef char ipstr_t[32]; typedef char ipstr_t[32];