summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Chu <stephen.chu@synaptics.corp-partner.google.com>2024-01-23 13:24:55 +0800
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2024-03-04 02:12:23 +0000
commitfa99ea8101ce034078627878ec4f0666442115c5 (patch)
tree0b7ea43b4dcfe9ba0eb9595e10de725c87e9e02a
parentcd914ded4bd3f41b3533a345c1e0e6f2b84d0df7 (diff)
downloaddhd43752p-android-gs-pantah-5.10-android14-qpr3-beta.tar.gz
Bug: 317174880 Test: T6pro country code set correctly Change-Id: Ic7eef1d5951c8d27506fd7b7e30af629f90bd45d Signed-off-by: Stephen Chu <stephen.chu@synaptics.corp-partner.google.com>
-rw-r--r--wl_cfg80211.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/wl_cfg80211.c b/wl_cfg80211.c
index c321bba..92940b9 100644
--- a/wl_cfg80211.c
+++ b/wl_cfg80211.c
@@ -10969,6 +10969,35 @@ s32 wl_mode_to_nl80211_iftype(s32 mode)
}
static bool
+wl_is_ccode_change_allowed(struct net_device *net)
+{
+ struct wireless_dev *wdev = ndev_to_wdev(net);
+ struct wiphy *wiphy = wdev->wiphy;
+ struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
+ struct net_info *iter, *next;
+
+ /* Country code isn't allowed change on AP/GO, NDP established */
+ GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST();
+ for_each_ndev(cfg, iter, next) {
+ GCC_DIAGNOSTIC_POP();
+ if (iter->ndev) {
+ if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
+ WL_ERR(("AP active. skip country ccode change"));
+ return false;
+ }
+ }
+ }
+
+#ifdef WL_NAN
+ if (wl_cfgnan_is_enabled(cfg) && wl_cfgnan_is_dp_active(net)) {
+ WL_ERR(("NDP established. skip country ccode change"));
+ return false;
+ }
+#endif /* WL_NAN */
+ return true;
+}
+
+static bool
wl_is_ccode_change_required(struct net_device *net,
char *country_code, int revinfo)
{
@@ -11215,6 +11244,12 @@ wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
goto exit;
}
+ if (wl_is_ccode_change_allowed(net) == false) {
+ WL_ERR(("country code change isn't allowed during AP role/NAN connected\n"));
+ ret = BCME_EPERM;
+ goto exit;
+ }
+
#ifdef WL_AUTO_COUNTRY
ret = wl_config_autocountry(cfg, net, country_code);
#endif /* WL_AUTO_COUNTRY */