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) --- .../java/com/android/server/wifi/ClientModeImpl.java | 20 ++++++++++++-------- .../com/android/server/wifi/MboOceConstants.java | 4 ++-- .../com/android/server/wifi/MboOceController.java | 4 ++-- .../wifi/SupplicantStaIfaceCallbackV1_3Impl.java | 2 +- 4 files changed, 17 insertions(+), 13 deletions(-) (limited to 'service') 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); -- cgit v1.2.3