X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_packet.c;h=2be599ebc6d3aa7a969a45d881ad858d22f68b6c;hp=40d945181d72c2a8b728e27e77c1fb8b7cff1fa6;hb=35e87b903e08fc51975a8cc97f06251d5153a424;hpb=4e9e3ca89dba68cbacaaa15ddfb298b181a969da diff --git a/src/net_packet.c b/src/net_packet.c index 40d94518..2be599eb 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -70,6 +70,11 @@ void send_mtu_probe(node_t *n) n->mtuprobes++; n->mtuevent = NULL; + if(!n->status.reachable) { + logger(LOG_DEBUG, _("Trying to send MTU probe to unreachable node %s (%s)"), n->name, n->hostname); + return; + } + if(n->mtuprobes >= 10 && !n->minmtu) { ifdebug(TRAFFIC) logger(LOG_INFO, _("No response to MTU probes from %s (%s)"), n->name, n->hostname); return; @@ -82,7 +87,7 @@ void send_mtu_probe(node_t *n) return; } - len = n->minmtu + 1 + random() % (n->maxmtu - n->minmtu); + len = n->minmtu + 1 + rand() % (n->maxmtu - n->minmtu); if(len < 64) len = 64; @@ -328,6 +333,11 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) cp(); + if(!n->status.reachable) { + ifdebug(TRAFFIC) logger(LOG_INFO, _("Trying to send UDP packet to unreachable node %s (%s)"), n->name, n->hostname); + return; + } + /* Make sure we have a valid key */ if(!n->status.validkey) { @@ -542,7 +552,8 @@ void handle_incoming_vpn_data(int sock) pkt.len = recvfrom(sock, (char *) &pkt.seqno, MAXSIZE, 0, &from.sa, &fromlen); if(pkt.len < 0) { - logger(LOG_ERR, _("Receiving packet failed: %s"), strerror(errno)); + if(errno != EAGAIN && errno != EINTR) + logger(LOG_ERR, _("Receiving packet failed: %s"), strerror(errno)); return; }