Since compression can either grow or shrink a packet, the size of an MTU probe
after decompression might not reflect the real path MTU. Now we use the size
before decompression, which is independent of the compression algorithm, and
substract a safety margin such that the calculated path MTU will be safe even
for packets which grow as much as possible after compression.
event_add(n->mtuevent);
}
event_add(n->mtuevent);
}
-void mtu_probe_h(node_t *n, vpn_packet_t *packet) {
+void mtu_probe_h(node_t *n, vpn_packet_t *packet, length_t len) {
ifdebug(TRAFFIC) logger(LOG_INFO, _("Got MTU probe length %d from %s (%s)"), packet->len, n->name, n->hostname);
if(!packet->data[0]) {
packet->data[0] = 1;
send_packet(n, packet);
} else {
ifdebug(TRAFFIC) logger(LOG_INFO, _("Got MTU probe length %d from %s (%s)"), packet->len, n->name, n->hostname);
if(!packet->data[0]) {
packet->data[0] = 1;
send_packet(n, packet);
} else {
- if(n->minmtu < packet->len)
- n->minmtu = packet->len;
+ if(n->minmtu < len)
+ n->minmtu = len;
/* Decompress the packet */
/* Decompress the packet */
+ length_t origlen = inpkt->len;
+
if(n->incompression) {
outpkt = pkt[nextpkt++];
if(n->incompression) {
outpkt = pkt[nextpkt++];
+
+ origlen -= MTU/64 + 20;
n->connection->last_ping_time = now;
if(!inpkt->data[12] && !inpkt->data[13])
n->connection->last_ping_time = now;
if(!inpkt->data[12] && !inpkt->data[13])
+ mtu_probe_h(n, inpkt, origlen);
else
receive_packet(n, inpkt);
}
else
receive_packet(n, inpkt);
}