3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

wiphy: add wiphy_country_is_unknown

A helper to check whether the country code corresponds to a
real country, or some special code indicating the country isn't
yet set. For now, the special codes are OO (world roaming) and
XX (unknown entity).
This commit is contained in:
James Prestwood 2022-08-03 14:36:40 -07:00 committed by Denis Kenzior
parent aa0d8f1283
commit 544aafb675
2 changed files with 17 additions and 0 deletions

View File

@ -790,6 +790,22 @@ void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out)
out[1] = country[1];
}
bool wiphy_country_is_unknown(struct wiphy *wiphy)
{
char cc[2];
wiphy_get_reg_domain_country(wiphy, cc);
/*
* Treat OO and XX as an unknown country. Additional codes could be
* added here if needed. The purpose of this is to know if we can
* expect the disabled frequency list to be updated once a country is
* known.
*/
return ((cc[0] == 'O' && cc[1] == 'O') ||
(cc[0] == 'X' && cc[1] == 'X'));
}
int wiphy_estimate_data_rate(struct wiphy *wiphy,
const void *ies, uint16_t ies_len,
const struct scan_bss *bss,

View File

@ -124,6 +124,7 @@ const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy,
const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy);
bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len);
void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out);
bool wiphy_country_is_unknown(struct wiphy *wiphy);
void wiphy_generate_random_address(struct wiphy *wiphy, uint8_t addr[static 6]);
void wiphy_generate_address_from_ssid(struct wiphy *wiphy, const char *ssid,