From 897600d37b3bf21215240b6483ec3e1ecad15f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 12 Aug 2025 19:29:04 -0700 Subject: [PATCH 1/2] Tethering: pass pmtu into Ipv6UpstreamRule() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 432676104 Test: TreeHugger, mm in p/m/C Flag: EXEMPT mainline/noop Signed-off-by: Maciej Żenczykowski Change-Id: I04e912604110f7b80ae31468b4f0a8938d127290 --- .../networkstack/tethering/BpfCoordinator.java | 11 +++++++---- .../networkstack/tethering/BpfCoordinatorTest.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java index 412da9bc61..bcb580eafa 100644 --- a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java +++ b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java @@ -816,7 +816,7 @@ public class BpfCoordinator { for (final IpPrefix ipPrefix : newUpstreamPrefixes) { addIpv6UpstreamRule(ipServer, new Ipv6UpstreamRule( newUpstreamIfindex, interfaceParams.index, ipPrefix, - interfaceParams.macAddr, NULL_MAC_ADDRESS, NULL_MAC_ADDRESS)); + interfaceParams.macAddr, NULL_MAC_ADDRESS, NULL_MAC_ADDRESS, 1400)); } } @@ -1692,7 +1692,7 @@ public class BpfCoordinator { // |field |oif |ethDst|ethSrc|ethPro|pmtu | // | | |mac |mac |to | | // +------+------+------+------+------+------+ - // |value |upstre|-- |-- |ETH_P_|1500 | + // |value |upstre|-- |-- |ETH_P_|pmtu | // | |am | | |IP | | // +------+------+------+------+------+------+ // @@ -1706,16 +1706,19 @@ public class BpfCoordinator { public final MacAddress outSrcMac; @NonNull public final MacAddress outDstMac; + public final int pmtu; public Ipv6UpstreamRule(int upstreamIfindex, int downstreamIfindex, @NonNull IpPrefix sourcePrefix, @NonNull MacAddress inDstMac, - @NonNull MacAddress outSrcMac, @NonNull MacAddress outDstMac) { + @NonNull MacAddress outSrcMac, @NonNull MacAddress outDstMac, + int pmtu) { this.upstreamIfindex = upstreamIfindex; this.downstreamIfindex = downstreamIfindex; this.sourcePrefix = sourcePrefix; this.inDstMac = inDstMac; this.outSrcMac = outSrcMac; this.outDstMac = outDstMac; + this.pmtu = pmtu; } /** @@ -1732,7 +1735,7 @@ public class BpfCoordinator { */ @NonNull public Tether6Value makeTether6Value() { - return new Tether6Value(upstreamIfindex, outDstMac, outSrcMac, ETH_P_IPV6, 1400); + return new Tether6Value(upstreamIfindex, outDstMac, outSrcMac, ETH_P_IPV6, pmtu); } @Override diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java index 1205f7bbed..7e5ded9277 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/BpfCoordinatorTest.java @@ -1229,7 +1229,7 @@ public class BpfCoordinatorTest { private static Ipv6UpstreamRule buildTestUpstreamRule(int upstreamIfindex, int downstreamIfindex, @NonNull IpPrefix sourcePrefix, @NonNull MacAddress inDstMac) { return new Ipv6UpstreamRule(upstreamIfindex, downstreamIfindex, sourcePrefix, inDstMac, - MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS); + MacAddress.ALL_ZEROS_ADDRESS, MacAddress.ALL_ZEROS_ADDRESS, 1400); } @NonNull From 4451a61097b038489c828cc4074caf511066225a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Tue, 12 Aug 2025 19:31:41 -0700 Subject: [PATCH 2/2] Tethering: pass pmtu into updateAllIpv6Rules() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 432676104 Test: TreeHugger, mm in p/m/C Flag: EXEMPT mainline/noop Signed-off-by: Maciej Żenczykowski Change-Id: I7cc9c612434c269cf2d13462f784d1f7e92d5219 --- .../com/android/networkstack/tethering/BpfCoordinator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java index bcb580eafa..058f394294 100644 --- a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java +++ b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java @@ -790,7 +790,7 @@ public class BpfCoordinator { */ private void updateAllIpv6Rules(@NonNull final IpServer ipServer, final InterfaceParams interfaceParams, int newUpstreamIfindex, - @NonNull final Set newUpstreamPrefixes) { + @NonNull final Set newUpstreamPrefixes, int pmtu) { if (!isUsingBpf()) return; // Remove IPv6 downstream rules. Remove the old ones before adding the new rules, otherwise @@ -816,7 +816,7 @@ public class BpfCoordinator { for (final IpPrefix ipPrefix : newUpstreamPrefixes) { addIpv6UpstreamRule(ipServer, new Ipv6UpstreamRule( newUpstreamIfindex, interfaceParams.index, ipPrefix, - interfaceParams.macAddr, NULL_MAC_ADDRESS, NULL_MAC_ADDRESS, 1400)); + interfaceParams.macAddr, NULL_MAC_ADDRESS, NULL_MAC_ADDRESS, pmtu)); } } @@ -971,7 +971,7 @@ public class BpfCoordinator { final boolean upstreamSupportsBpf = checkUpstreamSupportsBpf(upstreamIfindex); updateAllIpv6Rules(ipServer, interfaceParams, getInterfaceIndexForRule(upstreamIfindex, upstreamSupportsBpf), - upstreamPrefixes); + upstreamPrefixes, 1400); } }