wiphy/netdev: Add & use wiphy_control_port_capable

Some drivers might not actually support control port properly even if
advertised by mac80211.  Introduce a new method to wiphy that will take
care of looking up any driver quirks that override the presence of
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211
This commit is contained in:
Denis Kenzior 2021-10-01 09:29:04 -05:00
parent 6f925c4dae
commit 9766426b59
3 changed files with 16 additions and 3 deletions

View File

@ -6096,9 +6096,7 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg,
return NULL;
}
if (!wiphy_has_ext_feature(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211) ||
!pae_over_nl80211) {
if (!pae_over_nl80211 || !wiphy_control_port_capable(wiphy)) {
pae_io = pae_open(ifindex);
if (!pae_io) {
l_error("Unable to open PAE interface");

View File

@ -69,6 +69,7 @@ static uint32_t work_ids;
enum driver_flag {
DEFAULT_IF = 0x1,
FORCE_PAE = 0x2,
};
struct driver_info {
@ -549,6 +550,19 @@ bool wiphy_uses_default_if(struct wiphy *wiphy)
return false;
}
bool wiphy_control_port_capable(struct wiphy *wiphy)
{
if (wiphy->driver_info &&
wiphy->driver_info->flags & FORCE_PAE) {
l_info("Not using Control Port due to driver quirks: %s",
wiphy_get_driver(wiphy));
return false;
}
return wiphy_has_ext_feature(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
}
const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy)
{
return wiphy->permanent_addr;

View File

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