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.
This commit is contained in:
Guus Sliepen 2009-09-15 23:22:13 +02:00
parent d273efb177
commit b5ccce2968
2 changed files with 5 additions and 6 deletions

View file

@ -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);

View file

@ -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);