projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Send large packets we cannot handle properly via TCP.
[tinc]
/
src
/
net_packet.c
diff --git
a/src/net_packet.c
b/src/net_packet.c
index
40d9451
..
aca8468
100644
(file)
--- 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;
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;
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;
}
return;
}
- len = n->minmtu + 1 + rand
om
() % (n->maxmtu - n->minmtu);
+ len = n->minmtu + 1 + rand() % (n->maxmtu - n->minmtu);
if(len < 64)
len = 64;
if(len < 64)
len = 64;
@@
-328,6
+333,11
@@
static void send_udppacket(node_t *n, vpn_packet_t *origpkt)
cp();
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) {
/* Make sure we have a valid key */
if(!n->status.validkey) {
@@
-345,9
+355,9
@@
static void send_udppacket(node_t *n, vpn_packet_t *origpkt)
return;
}
return;
}
- if(n->options & OPTION_PMTU_DISCOVERY &&
!
n->minmtu && (inpkt->data[12] | inpkt->data[13])) {
+ if(n->options & OPTION_PMTU_DISCOVERY &&
inpkt->len >
n->minmtu && (inpkt->data[12] | inpkt->data[13])) {
ifdebug(TRAFFIC) logger(LOG_INFO,
ifdebug(TRAFFIC) logger(LOG_INFO,
- _("
No minimum MTU established yet for %s (%s)
, forwarding via TCP"),
+ _("
Packet for %s (%s) larger than minimum MTU
, forwarding via TCP"),
n->name, n->hostname);
send_tcppacket(n->nexthop->connection, origpkt);
n->name, n->hostname);
send_tcppacket(n->nexthop->connection, origpkt);
@@
-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) {
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;
}
return;
}