From: Guus Sliepen Date: Tue, 15 Sep 2009 21:22:13 +0000 (+0200) Subject: Send large packets we cannot handle properly via TCP. X-Git-Tag: release-1.0.10~22 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b5ccce296848aab72d574ca3de14af5fdf3efa4d;p=oweals%2Ftinc.git Send large packets we cannot handle properly via TCP. During the path MTU discovery phase, we might not know the maximum MTU yet, but we do know a safe minimum. If we encounter a packet that is larger than that the minimum, we now send it via TCP instead to ensure it arrives. We also allow large packets that we cannot fragment or create ICMP replies for to be sent via TCP. --- diff --git a/src/net_packet.c b/src/net_packet.c index 2be599e..aca8468 100644 --- a/src/net_packet.c +++ b/src/net_packet.c @@ -355,9 +355,9 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) 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, - _("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); diff --git a/src/route.c b/src/route.c index d748db1..9b68903 100644 --- a/src/route.c +++ b/src/route.c @@ -769,13 +769,12 @@ static void route_mac(node_t *source, vpn_packet_t *packet) } else { fragment_ipv4_packet(via, packet); } + return; } else if(type == ETH_P_IPV6) { packet->len = via->mtu; route_ipv6_unreachable(source, packet, ICMP6_PACKET_TOO_BIG, 0); - } else - ifdebug(TRAFFIC) logger(LOG_INFO, _("Large packet of unhandled type %hx dropped"), type); - - return; + return; + } } send_packet(subnet->owner, packet);