commit 9766426b59d950ca43e617f370849a2c089dcede
parent 6f925c4daea69bfe362e1f0b5b0daec11567bd0e
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 1 Oct 2021 09:29:04 -0500
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
Diffstat:
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
@@ -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");
diff --git a/src/wiphy.c b/src/wiphy.c
@@ -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;
diff --git a/src/wiphy.h b/src/wiphy.h
@@ -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);