if(n->mtuprobes > 32) {
if(!n->minmtu) {
n->mtuprobes = 31;
- timeout = mesh->pinginterval;
+ timeout = mesh->dev_class_traits[n->devclass].pinginterval;
goto end;
}
n->mtuprobes = 1;
n->minmtu = 0;
n->maxmtu = MTU;
+
+ update_node_pmtu(mesh, n);
}
if(n->mtuprobes >= 10 && n->mtuprobes < 32 && !n->minmtu) {
if(n->mtuprobes == 30 || (n->mtuprobes < 30 && n->minmtu >= n->maxmtu)) {
if(n->minmtu > n->maxmtu) {
n->minmtu = n->maxmtu;
+ update_node_pmtu(mesh, n);
} else {
n->maxmtu = n->minmtu;
}
}
if(n->mtuprobes == 31) {
- timeout = mesh->pinginterval;
+ timeout = mesh->dev_class_traits[n->devclass].pinginterval;
goto end;
} else if(n->mtuprobes == 32) {
- timeout = mesh->pingtimeout;
+ timeout = mesh->dev_class_traits[n->devclass].pingtimeout;
}
for(int i = 0; i < 5; i++) {
if(n->minmtu < len) {
n->minmtu = len;
+ update_node_pmtu(mesh, n);
}
}
}
to the node's reflexive UDP address discovered during key
exchange. */
- static int x = 0;
-
- if(++x >= 3) {
- x = 0;
+ if(++mesh->udp_choice >= 3) {
+ mesh->udp_choice = 0;
return;
}
static node_t *try_harder(meshlink_handle_t *mesh, const sockaddr_t *from, const vpn_packet_t *pkt) {
node_t *n = NULL;
bool hard = false;
- static time_t last_hard_try = 0;
for splay_each(edge_t, e, mesh->edges) {
if(!e->to->status.reachable || e->to == mesh->self) {
}
if(sockaddrcmp_noport(from, &e->address)) {
- if(last_hard_try == mesh->loop.now.tv_sec) {
+ if(mesh->last_hard_try == mesh->loop.now.tv_sec) {
continue;
}
}
if(hard) {
- last_hard_try = mesh->loop.now.tv_sec;
+ mesh->last_hard_try = mesh->loop.now.tv_sec;
}
- last_hard_try = mesh->loop.now.tv_sec;
return n;
}