Recalculate and resend MTU probes if they are too large for the system.

Currently, if a MTU probe is sent and gets rejected by the system
because it is too large (i.e. send() returns EMSGSIZE), the MTU
discovery algorithm is not aware of it and still behaves as if the probe
was actually sent.

This patch makes the MTU discovery algorithm recalculate and send a new
probe when this happens, so that the probe "slot" does not go to waste.
This commit is contained in:
Etienne Dechamps 2015-01-01 16:59:45 +00:00
parent f89319f981
commit 06345f89b9

View file

@ -991,6 +991,7 @@ static void try_mtu(node_t *n) {
if(n->mtuprobes == 0)
n->maxmtu = choose_initial_maxmtu(n);
for (;;) {
/* Decreasing the number of probes per cycle might make the algorithm react faster to lost packets,
but it will typically increase convergence time in the no-loss case. */
const length_t probes_per_cycle = 8;
@ -1017,7 +1018,14 @@ static void try_mtu(node_t *n) {
reply per cycle so that we can make progress. */
const length_t offset = powf(interval, multiplier * cycle_position / (probes_per_cycle - 1));
length_t maxmtu = n->maxmtu;
send_udp_probe_packet(n, minmtu + offset);
/* If maxmtu changed, it means the probe was rejected by the system because it was too large.
In that case, we recalculate with the new maxmtu and try again. */
if(n->mtuprobes < 0 || maxmtu == n->maxmtu)
break;
}
if(n->mtuprobes >= 0)
n->mtuprobes++;
}