3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2025-01-03 10:32:33 +01:00

wiphy: change wiphy_control_port_capable -> enabled

Move the reading of ControlPortOverNL80211 into wiphy itself and
renamed wiphy_control_port_capable to wiphy_control_port_enabled.
This makes things easier for any modules interested in control
port support since they will only have to check this one API rather
than read the settings and check capability.
This commit is contained in:
James Prestwood 2021-10-07 13:49:45 -07:00 committed by Denis Kenzior
parent f9edb5e605
commit 898c7e636e
3 changed files with 15 additions and 10 deletions

View File

@ -203,7 +203,6 @@ static struct l_netlink *rtnl = NULL;
static struct l_genl_family *nl80211; static struct l_genl_family *nl80211;
static struct l_queue *netdev_list; static struct l_queue *netdev_list;
static struct watchlist netdev_watches; static struct watchlist netdev_watches;
static bool pae_over_nl80211;
static bool mac_per_ssid; static bool mac_per_ssid;
static unsigned int iov_ie_append(struct iovec *iov, static unsigned int iov_ie_append(struct iovec *iov,
@ -6096,7 +6095,7 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg,
return NULL; return NULL;
} }
if (!pae_over_nl80211 || !wiphy_control_port_capable(wiphy)) { if (!wiphy_control_port_enabled(wiphy)) {
pae_io = pae_open(ifindex); pae_io = pae_open(ifindex);
if (!pae_io) { if (!pae_io) {
l_error("Unable to open PAE interface"); l_error("Unable to open PAE interface");
@ -6233,10 +6232,6 @@ static int netdev_init(void)
&LOW_SIGNAL_THRESHOLD_5GHZ)) &LOW_SIGNAL_THRESHOLD_5GHZ))
LOW_SIGNAL_THRESHOLD_5GHZ = -76; LOW_SIGNAL_THRESHOLD_5GHZ = -76;
if (!l_settings_get_bool(settings, "General", "ControlPortOverNL80211",
&pae_over_nl80211))
pae_over_nl80211 = true;
rand_addr_str = l_settings_get_value(settings, "General", rand_addr_str = l_settings_get_value(settings, "General",
"AddressRandomization"); "AddressRandomization");
if (rand_addr_str && !strcmp(rand_addr_str, "network")) if (rand_addr_str && !strcmp(rand_addr_str, "network"))

View File

@ -555,8 +555,11 @@ bool wiphy_uses_default_if(struct wiphy *wiphy)
return false; return false;
} }
bool wiphy_control_port_capable(struct wiphy *wiphy) bool wiphy_control_port_enabled(struct wiphy *wiphy)
{ {
const struct l_settings *settings = iwd_get_config();
bool enabled;
if (wiphy->driver_info && if (wiphy->driver_info &&
wiphy->driver_info->flags & FORCE_PAE) { wiphy->driver_info->flags & FORCE_PAE) {
l_info("Not using Control Port due to driver quirks: %s", l_info("Not using Control Port due to driver quirks: %s",
@ -564,8 +567,15 @@ bool wiphy_control_port_capable(struct wiphy *wiphy)
return false; return false;
} }
return wiphy_has_ext_feature(wiphy, if (!wiphy_has_ext_feature(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211); NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211))
return false;
if (!l_settings_get_bool(settings, "General",
"ControlPortOverNL80211", &enabled))
enabled = true;
return enabled;
} }
const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy) const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy)

View File

@ -102,7 +102,7 @@ bool wiphy_supports_firmware_roam(struct wiphy *wiphy);
const char *wiphy_get_driver(struct wiphy *wiphy); const char *wiphy_get_driver(struct wiphy *wiphy);
const char *wiphy_get_name(struct wiphy *wiphy); const char *wiphy_get_name(struct wiphy *wiphy);
bool wiphy_uses_default_if(struct wiphy *wiphy); bool wiphy_uses_default_if(struct wiphy *wiphy);
bool wiphy_control_port_capable(struct wiphy *wiphy); bool wiphy_control_port_enabled(struct wiphy *wiphy);
const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy); const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy);
const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy, const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy,
uint32_t iftype); uint32_t iftype);