Clamp the advertised IPv6 MTU to 1280-1400

RaParams is populated with the upstream IPv4 MTU, rather than the IPv6
or route MTU. This change clamps that value between 1280 and 1400. 1280
as it is the minimum IPv6 MTU and 1400 to keep QUIC working. A follow up
change could improve on this by either adding the IPv6 MTU to
LinkProperties, or (possibly better) binding and connecting a UDP socket
to determine the MTU. Note that at that point the MTU in the Tether6Key
should also be fixed.

Test: TH
Flag: EXEMPT low risk
Bug: 432676104
Change-Id: I1d900039caf84c58cd04fdb52bdeaf2d1b846268
This commit is contained in:
Patrick Rohr 2025-08-01 12:40:50 -07:00
commit bd3d103436

View file

@ -856,7 +856,8 @@ public class IpServer extends StateMachineShim {
upstreamIfIndex = upstreamIfaceParams.index;
}
params = new RaParams();
params.mtu = v6only.getMtu();
// Clamp v6 MTU to 1280-1400 range.
params.mtu = Math.max(1280, Math.min(1400, v6only.getMtu()));
params.hasDefaultRoute = v6only.hasIpv6DefaultRoute();
if (params.hasDefaultRoute) params.hopLimit = getHopLimit(upstreamIface, ttlAdjustment);