From e891b6f40008af4957b5fa178394cf6979cf4558 Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Tue, 10 Dec 2024 22:51:56 +0000 Subject: [PATCH] Do not release prefix too early The hotspotPrefix was previously released on line 192, so when a new prefix was allocated on line 206, it was allowed to "conflict" with the now-released hotspotPrefix. This change moves the call to releaseDownstream() to the end, so the test can properly check for conflicts. Test: TH Bug: 375858174 Change-Id: Iac786237340fc14098701d86fa80946a7fb8e0b6 --- .../networkstack/tethering/PrivateAddressCoordinatorTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java index 1608e1ac78..c32914277c 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java @@ -189,7 +189,6 @@ public final class PrivateAddressCoordinatorTest { final LinkAddress hotspotAddress = requestDownstreamAddress(mHotspotIpServer); final IpPrefix hotspotPrefix = asIpPrefix(hotspotAddress); assertNotEquals(asIpPrefix(mBluetoothAddress), hotspotPrefix); - releaseDownstream(mHotspotIpServer); // - Test previous enabled hotspot prefix(cached prefix) is reserved. when(mPrivateAddressCoordinator.getRandomInt()).thenReturn( @@ -208,6 +207,7 @@ public final class PrivateAddressCoordinatorTest { assertNotEquals(asIpPrefix(mLegacyWifiP2pAddress), etherPrefix); assertNotEquals(asIpPrefix(mBluetoothAddress), etherPrefix); assertNotEquals(hotspotPrefix, etherPrefix); + releaseDownstream(mHotspotIpServer); releaseDownstream(mEthernetIpServer); }