projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Forward packets to not directly reachable hosts via UDP if possible.
[tinc]
/
src
/
net_packet.c
diff --git
a/src/net_packet.c
b/src/net_packet.c
index
9b0e468
..
054a66f
100644
(file)
--- a/
src/net_packet.c
+++ b/
src/net_packet.c
@@
-91,6
+91,10
@@
void send_mtu_probe(node_t *n) {
}
if(n->mtuprobes == 30 || (n->mtuprobes < 30 && n->minmtu >= n->maxmtu)) {
}
if(n->mtuprobes == 30 || (n->mtuprobes < 30 && n->minmtu >= n->maxmtu)) {
+ if(n->minmtu > n->maxmtu)
+ n->minmtu = n->maxmtu;
+ else
+ n->maxmtu = n->minmtu;
n->mtu = n->minmtu;
ifdebug(TRAFFIC) logger(LOG_INFO, "Fixing MTU of %s (%s) to %d after %d probes", n->name, n->hostname, n->mtu, n->mtuprobes);
n->mtuprobes = 31;
n->mtu = n->minmtu;
ifdebug(TRAFFIC) logger(LOG_INFO, "Fixing MTU of %s (%s) to %d after %d probes", n->name, n->hostname, n->mtu, n->mtuprobes);
n->mtuprobes = 31;
@@
-135,7
+139,7
@@
void mtu_probe_h(node_t *n, vpn_packet_t *packet, length_t len) {
if(!packet->data[0]) {
packet->data[0] = 1;
if(!packet->data[0]) {
packet->data[0] = 1;
- send_packet(n, packet);
+ send_
udp
packet(n, packet);
} else {
if(len > n->maxmtu)
len = n->maxmtu;
} else {
if(len > n->maxmtu)
len = n->maxmtu;
@@
-365,10
+369,13
@@
static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
if(n->options & OPTION_PMTU_DISCOVERY && inpkt->len > n->minmtu && (inpkt->data[12] | inpkt->data[13])) {
ifdebug(TRAFFIC) logger(LOG_INFO,
if(n->options & OPTION_PMTU_DISCOVERY && inpkt->len > n->minmtu && (inpkt->data[12] | inpkt->data[13])) {
ifdebug(TRAFFIC) logger(LOG_INFO,
- "Packet for %s (%s) larger than minimum MTU, forwarding via
TCP
",
- n->name, n->hostname);
+ "Packet for %s (%s) larger than minimum MTU, forwarding via
%s
",
+ n->name, n->hostname
, n != n->nexthop ? n->nexthop->name : "TCP"
);
- send_tcppacket(n->nexthop->connection, origpkt);
+ if(n != n->nexthop)
+ send_packet(n->nexthop, origpkt);
+ else
+ send_tcppacket(n->nexthop->connection, origpkt);
return;
}
return;
}
@@
-521,12
+528,16
@@
static node_t *try_harder(const sockaddr_t *from, const vpn_packet_t *pkt) {
avl_node_t *node;
edge_t *e;
node_t *n = NULL;
avl_node_t *node;
edge_t *e;
node_t *n = NULL;
+ static time_t last_hard_try = 0;
for(node = edge_weight_tree->head; node; node = node->next) {
e = node->data;
for(node = edge_weight_tree->head; node; node = node->next) {
e = node->data;
- if(sockaddrcmp_noport(from, &e->address))
- continue;
+ if(sockaddrcmp_noport(from, &e->address)) {
+ if(last_hard_try == now)
+ continue;
+ last_hard_try = now;
+ }
if(!n)
n = e->to;
if(!n)
n = e->to;