diff options
-rw-r--r-- | wl_cfg80211.c | 35 |
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 */ |