From c389040e534b5db022b4daf7219f5a749a31aa84 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 10 Aug 2020 14:19:07 -0700 Subject: Blocklist the BSSID if disassociation imminent bit is set If the received BTM frame with disassociation imminent bit set doesn't have MBO assoc retry delay attribute, block list the BSSID for a fixed duration of 5mins. This is to avoid re-connection attempt to same BSSID, which may result in either a connection failure or receiving another BTM frame with disassoc-imminent bit set soon after connection. Also renamed the blocklist duration variable to make code more inclusive. Bug: 162671127 Test: atest com.android.server.wifi.ClientModeImplTest Change-Id: I6f61b406081b9022070aea7fd2a2b20c04017702 Merged-In: I6f61b406081b9022070aea7fd2a2b20c04017702 (cherry picked from commit 705209e2c997f4315155f538048fe7e3d89c1a6d) --- .../android/server/wifi/ClientModeImplTest.java | 35 ++++++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 42a465ecc..a9d7f0ce2 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -4330,12 +4330,12 @@ public class ClientModeImplTest extends WifiBaseTest { } /** - * Test that handleBssTransitionRequest() blacklist the BSS upon + * Test that handleBssTransitionRequest() blocklist the BSS upon * receiving BTM request frame that contains MBO-OCE IE with an * association retry delay attribute. */ @Test - public void testBtmFrameWithMboAssocretryDelayBlackListTheBssid() throws Exception { + public void testBtmFrameWithMboAssocretryDelayBlockListTheBssid() throws Exception { // Connect to network with |sBSSID|, |sFreq|. connect(); @@ -4344,14 +4344,37 @@ public class ClientModeImplTest extends WifiBaseTest { btmFrmData.mStatus = MboOceConstants.BTM_RESPONSE_STATUS_REJECT_UNSPECIFIED; btmFrmData.mBssTmDataFlagsMask = MboOceConstants.BTM_DATA_FLAG_DISASSOCIATION_IMMINENT | MboOceConstants.BTM_DATA_FLAG_MBO_ASSOC_RETRY_DELAY_INCLUDED; - btmFrmData.mBlackListDurationMs = 60000; + btmFrmData.mBlockListDurationMs = 60000; mCmi.sendMessage(WifiMonitor.MBO_OCE_BSS_TM_HANDLING_DONE, btmFrmData); mLooper.dispatchAll(); verify(mWifiMetrics, times(1)).incrementSteeringRequestCountIncludingMboAssocRetryDelay(); verify(mBssidBlocklistMonitor).blockBssidForDurationMs(eq(sBSSID), eq(sSSID), - eq(btmFrmData.mBlackListDurationMs), anyInt(), anyInt()); + eq(btmFrmData.mBlockListDurationMs), anyInt(), anyInt()); + } + + /** + * Test that handleBssTransitionRequest() blocklist the BSS upon + * receiving BTM request frame that contains disassociation imminent bit + * set to 1. + */ + @Test + public void testBtmFrameWithDisassocImminentBitBlockListTheBssid() throws Exception { + // Connect to network with |sBSSID|, |sFreq|. + connect(); + + MboOceController.BtmFrameData btmFrmData = new MboOceController.BtmFrameData(); + + btmFrmData.mStatus = MboOceConstants.BTM_RESPONSE_STATUS_ACCEPT; + btmFrmData.mBssTmDataFlagsMask = MboOceConstants.BTM_DATA_FLAG_DISASSOCIATION_IMMINENT; + + mCmi.sendMessage(WifiMonitor.MBO_OCE_BSS_TM_HANDLING_DONE, btmFrmData); + mLooper.dispatchAll(); + + verify(mWifiMetrics, never()).incrementSteeringRequestCountIncludingMboAssocRetryDelay(); + verify(mBssidBlocklistMonitor).blockBssidForDurationMs(eq(sBSSID), eq(sSSID), + eq(MboOceConstants.DEFAULT_BLOCKLIST_DURATION_MS), anyInt(), anyInt()); } /** @@ -4369,13 +4392,13 @@ public class ClientModeImplTest extends WifiBaseTest { btmFrmData.mBssTmDataFlagsMask = MboOceConstants.BTM_DATA_FLAG_DISASSOCIATION_IMMINENT | MboOceConstants.BTM_DATA_FLAG_BSS_TERMINATION_INCLUDED | MboOceConstants.BTM_DATA_FLAG_MBO_CELL_DATA_CONNECTION_PREFERENCE_INCLUDED; - btmFrmData.mBlackListDurationMs = 60000; + btmFrmData.mBlockListDurationMs = 60000; mCmi.sendMessage(WifiMonitor.MBO_OCE_BSS_TM_HANDLING_DONE, btmFrmData); mLooper.dispatchAll(); verify(mBssidBlocklistMonitor, never()).blockBssidForDurationMs(eq(sBSSID), eq(sSSID), - eq(btmFrmData.mBlackListDurationMs), anyInt(), anyInt()); + eq(btmFrmData.mBlockListDurationMs), anyInt(), anyInt()); verify(mWifiConnectivityManager).forceConnectivityScan(ClientModeImpl.WIFI_WORK_SOURCE); verify(mWifiMetrics, times(1)).incrementMboCellularSwitchRequestCount(); verify(mWifiMetrics, times(1)) -- cgit v1.2.3