X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fnet_packet.c;h=8aca6aa59adda1ef8f78d9eecec914625a9a367a;hp=7dae0fe0a558c3ac5eed8920de4f00ef290e2f14;hb=963c5055505f2fc117cd5efa06eaa02c9b2bf85d;hpb=4c57e6902219ecca1872e18e34365d8e54a0f407 diff --git a/src/net_packet.c b/src/net_packet.c index 7dae0fe0..8aca6aa5 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -370,7 +370,7 @@ bool send_sptps_data(void *handle, uint8_t type, const void *data, size_t len) { /* Send it via TCP if it is a handshake packet, TCPOnly is in use, or this packet is larger than the MTU. */ - if(type >= SPTPS_HANDSHAKE || (type != PKT_PROBE && len > to->minmtu)) { + if(type >= SPTPS_HANDSHAKE || (type != PKT_PROBE && (len - 21) > to->minmtu)) { char buf[len * 4 / 3 + 5]; b64encode(data, buf, len); @@ -433,8 +433,8 @@ bool receive_sptps_record(void *handle, uint8_t type, const void *data, uint16_t return true; } - if(len > MTU) { - logger(mesh, MESHLINK_ERROR, "Packet from %s larger than maximum supported size (%d > %d)", from->name, len, MTU); + if(len > MAXSIZE) { + logger(mesh, MESHLINK_ERROR, "Packet from %s larger than maximum supported size (%d > %d)", from->name, len, MAXSIZE); return false; }