eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 544aafb675dabb95a76999bc817b631c1b3a8127
parent aa0d8f1283c2dd81b619b2693495c62dbbfe1c0f
Author: James Prestwood <prestwoj@gmail.com>
Date:   Wed,  3 Aug 2022 14:36:40 -0700

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).

Diffstat:
Msrc/wiphy.c | 16++++++++++++++++
Msrc/wiphy.h | 1+
2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/wiphy.c b/src/wiphy.c @@ -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, diff --git a/src/wiphy.h b/src/wiphy.h @@ -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,