]> git.meshlink.io Git - meshlink/commitdiff
Forward packets to not directly reachable hosts via UDP if possible.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 24 Oct 2009 19:53:01 +0000 (21:53 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 24 Oct 2009 19:53:01 +0000 (21:53 +0200)
If MTU probing discovered a node was not reachable via UDP, packets for it were
forwarded to the next hop, but always via TCP, even if the next hop was
reachable via UDP. This is now fixed by retrying to send the packet using
send_packet() if the destination is not the same as the nexthop.

src/net_packet.c

index 3466f87ee975a3aaf5a6d249542577b671038887..054a66feb2f5a4a12420227b329364aa08655f14 100644 (file)
@@ -369,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,
-                               "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;
        }