summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Ravi <sunilravi@google.com>2020-08-10 14:19:07 -0700
committerSunil Ravi <sunilravi@google.com>2020-08-20 22:55:58 +0000
commitc389040e534b5db022b4daf7219f5a749a31aa84 (patch)
treeb66f2107a99ff834d6c91b67981be9e915da3e08
parent07e285b8909fffee1f2fa6e6a608fa18835ebc00 (diff)
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)
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java20
-rw-r--r--service/java/com/android/server/wifi/MboOceConstants.java4
-rw-r--r--service/java/com/android/server/wifi/MboOceController.java4
-rw-r--r--service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java2
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java35
5 files changed, 46 insertions, 19 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index e88eefc6d..95983096a 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -6285,18 +6285,22 @@ public class ClientModeImpl extends StateMachine {
if ((frameData.mBssTmDataFlagsMask
- & MboOceConstants.BTM_DATA_FLAG_MBO_ASSOC_RETRY_DELAY_INCLUDED)
- != 0) {
- long duration = frameData.mBlackListDurationMs;
- mWifiMetrics.incrementSteeringRequestCountIncludingMboAssocRetryDelay();
+ & MboOceConstants.BTM_DATA_FLAG_DISASSOCIATION_IMMINENT) != 0) {
+ long duration = 0;
+ if ((frameData.mBssTmDataFlagsMask
+ & MboOceConstants.BTM_DATA_FLAG_MBO_ASSOC_RETRY_DELAY_INCLUDED) != 0) {
+ mWifiMetrics.incrementSteeringRequestCountIncludingMboAssocRetryDelay();
+ duration = frameData.mBlockListDurationMs;
+ }
if (duration == 0) {
/*
- * When MBO assoc retry delay is set to zero(reserved as per spec),
- * blacklist the BSS for sometime to avoid AP rejecting the re-connect request.
+ * When disassoc imminent bit alone is set or MBO assoc retry delay is
+ * set to zero(reserved as per spec), blocklist the BSS for sometime to
+ * avoid AP rejecting the re-connect request.
*/
- duration = MboOceConstants.DEFAULT_BLACKLIST_DURATION_MS;
+ duration = MboOceConstants.DEFAULT_BLOCKLIST_DURATION_MS;
}
- // Blacklist the current BSS
+ // Blocklist the current BSS
mBssidBlocklistMonitor.blockBssidForDurationMs(bssid, ssid, duration,
BssidBlocklistMonitor.REASON_FRAMEWORK_DISCONNECT_MBO_OCE, 0);
}
diff --git a/service/java/com/android/server/wifi/MboOceConstants.java b/service/java/com/android/server/wifi/MboOceConstants.java
index 4ef3cab0c..66948b030 100644
--- a/service/java/com/android/server/wifi/MboOceConstants.java
+++ b/service/java/com/android/server/wifi/MboOceConstants.java
@@ -176,7 +176,7 @@ public class MboOceConstants {
@Retention(RetentionPolicy.SOURCE)
@interface MboCellularDataConnectionPreference{}
- /** default Blacklist duration when AP doesn't advertise it */
- public static final long DEFAULT_BLACKLIST_DURATION_MS = 300_000; // 5 minutes
+ /** default Blocklist duration when AP doesn't advertise non zero MBO assoc retry delay */
+ public static final long DEFAULT_BLOCKLIST_DURATION_MS = 300_000; // 5 minutes
}
diff --git a/service/java/com/android/server/wifi/MboOceController.java b/service/java/com/android/server/wifi/MboOceController.java
index 41006371e..d71034d81 100644
--- a/service/java/com/android/server/wifi/MboOceController.java
+++ b/service/java/com/android/server/wifi/MboOceController.java
@@ -130,7 +130,7 @@ public class MboOceController {
public @MboOceConstants.BtmResponseStatus int mStatus =
MboOceConstants.BTM_RESPONSE_STATUS_INVALID;
public int mBssTmDataFlagsMask = 0;
- public long mBlackListDurationMs = 0;
+ public long mBlockListDurationMs = 0;
public @MboOceConstants.MboTransitionReason int mTransitionReason =
MboOceConstants.MBO_TRANSITION_REASON_INVALID;
public @MboOceConstants.MboCellularDataConnectionPreference int mCellPreference =
@@ -140,7 +140,7 @@ public class MboOceController {
public String toString() {
return new StringBuilder("BtmFrameData status=").append(mStatus).append(
", flags=").append(mBssTmDataFlagsMask).append(
- ", assocRetryDelay=").append(mBlackListDurationMs).append(
+ ", assocRetryDelay=").append(mBlockListDurationMs).append(
", transitionReason=").append(mTransitionReason).append(
", cellPref=").append(mCellPreference).toString();
}
diff --git a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java
index 596b56d57..f293b9d7c 100644
--- a/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java
+++ b/service/java/com/android/server/wifi/SupplicantStaIfaceCallbackV1_3Impl.java
@@ -252,7 +252,7 @@ abstract class SupplicantStaIfaceCallbackV1_3Impl extends
btmFrmData.mStatus = halToFrameworkBtmResponseStatus(tmData.status);
btmFrmData.mBssTmDataFlagsMask = halToFrameworkBssTmDataFlagsMask(tmData.flags);
- btmFrmData.mBlackListDurationMs = tmData.assocRetryDelayMs;
+ btmFrmData.mBlockListDurationMs = tmData.assocRetryDelayMs;
if ((tmData.flags & BssTmDataFlagsMask.MBO_TRANSITION_REASON_CODE_INCLUDED) != 0) {
btmFrmData.mTransitionReason = halToFrameworkMboTransitionReason(
tmData.mboTransitionReason);
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))