IPv4: Overall MTU is 65535 (0xFFFF).

If the route supports a greater MTU, we need to
clamp it.

The loopback reports an MTU greater by one byte
(65536), and if we don't clamp it here, TCP will
try to send packets actually that large (and fail.)
This commit is contained in:
Augustin Cavalier 2024-01-29 16:05:11 -05:00
parent 3c51bab74e
commit 0382176581

View File

@ -1698,6 +1698,10 @@ ipv4_get_mtu(net_protocol* protocol, const struct sockaddr* address)
mtu = route->interface_address->interface->device->mtu;
sDatalinkModule->put_route(sDomain, route);
if (mtu > 0xffff)
mtu = 0xffff;
return mtu - sizeof(ipv4_header);
}