diff options
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_cfg80211.h | 73 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 64 |
2 files changed, 137 insertions, 0 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h index 270fc1314afb..de71b974dd2e 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg80211.h +++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h @@ -1563,6 +1563,25 @@ enum qca_wlan_vendor_acs_hw_mode { #define CFG_AGG_RETRY_MIN (5) /** + * enum qca_access_policy - access control policy + * + * Access control policy is applied on the configured IE + * (QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE). + * To be set with QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY. + * + * @QCA_ACCESS_POLICY_ACCEPT_UNLESS_LISTED: Deny Wi-Fi Connections which match + * with the specific configuration (IE) set, i.e. allow all the + * connections which do not match the configuration. + * @QCA_ACCESS_POLICY_DENY_UNLESS_LISTED: Accept Wi-Fi Connections which match + * with the specific configuration (IE) set, i.e. deny all the + * connections which do not match the configuration. + */ +enum qca_access_policy { + QCA_ACCESS_POLICY_ACCEPT_UNLESS_LISTED, + QCA_ACCESS_POLICY_DENY_UNLESS_LISTED, +}; + +/** * enum qca_wlan_vendor_config: wifi config attr * * @QCA_WLAN_VENDOR_ATTR_CONFIG_INVALID: invalid config @@ -1584,6 +1603,23 @@ enum qca_wlan_vendor_acs_hw_mode { * @QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT: Unsigned 32-bit value to * configure the number of unicast TX fail packet count. * The peer is disconnected once this threshold is reached. + * @QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES: Update the default scan IEs + * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND: + * Unsigned 32-bit value attribute for generic commands + * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_VALUE: + * Unsigned 32-bit data attribute for generic command response + * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA: + * Unsigned 32-bit data attribute for generic command response + * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_LENGTH: + * Unsigned 32-bit length attribute for + * QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA + * @QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_FLAGS: + * Unsigned 32-bit flags attribute for QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA + * @QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY: Vendor IE access policy + * @QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST: Vendor IE to be used + * with access policy + * @QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX: interface index for vdev specific + * parameters * @QCA_WLAN_VENDOR_ATTR_CONFIG_LAST: last config * @QCA_WLAN_VENDOR_ATTR_CONFIG_MAX: max config */ @@ -1604,6 +1640,43 @@ enum qca_wlan_vendor_config { QCA_WLAN_VENDOR_ATTR_CONFIG_CTRL_RETRY, QCA_WLAN_VENDOR_ATTR_CONFIG_PROPAGATION_DELAY, QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT, + /* Attribute used to set scan default IEs to the driver. + * + * These IEs can be used by scan operations that will be initiated by + * the driver/firmware. + * + * For further scan requests coming to the driver, these IEs should be + * merged with the IEs received along with scan request coming to the + * driver. If a particular IE is present in the scan default IEs but not + * present in the scan request, then that IE should be added to the IEs + * sent in the Probe Request frames for that scan request. */ + QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES, + /* Unsigned 32-bit attribute for generic commands */ + QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_COMMAND, + /* Unsigned 32-bit value attribute for generic commands */ + QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_VALUE, + /* Unsigned 32-bit data attribute for generic command response */ + QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA, + /* Unsigned 32-bit length attribute for + * QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA */ + QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_LENGTH, + /* Unsigned 32-bit flags attribute for + * QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_DATA */ + QCA_WLAN_VENDOR_ATTR_CONFIG_GENERIC_FLAGS, + /* Unsigned 32-bit, defining the access policy. + * See enum qca_access_policy. Used with + * QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST. */ + QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY, + /* Sets the list of full set of IEs for which a specific access policy + * has to be applied. Used along with + * QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY to control the access. + * Zero length payload can be used to clear this access constraint. */ + QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST, + /* Unsigned 32-bit, specifies the interface index (netdev) for which the + * corresponding configurations are applied. If the interface index is + * not specified, the configurations are attributed to the respective + * wiphy. */ + QCA_WLAN_VENDOR_ATTR_CONFIG_IFINDEX, /* keep last */ QCA_WLAN_VENDOR_ATTR_CONFIG_LAST, diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index b04705b5936a..2437ba8da878 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -784,6 +784,11 @@ enum wlan_hdd_tm_cmd #define WLAN_HDD_TM_DATA_MAX_LEN 5000 +enum wlan_hdd_vendor_ie_access_policy { + WLAN_HDD_VENDOR_IE_ACCESS_NONE = 0, + WLAN_HDD_VENDOR_IE_ACCESS_ALLOW_IF_LISTED, +}; + static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = { [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, @@ -8467,6 +8472,10 @@ static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, struct sir_set_tx_rx_aggregation_size request; VOS_STATUS vos_status; uint32_t tx_fail_count; + int attr_len; + int access_policy = 0; + char vendor_ie[SIR_MAC_MAX_IE_LENGTH + 2]; + bool vendor_ie_present = false, access_policy_present = false; if (VOS_FTM_MODE == hdd_get_conparam()) { hddLog(LOGE, FL("Command not allowed in FTM mode")); @@ -8661,6 +8670,61 @@ static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, } } } + + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST]) { + vos_mem_zero(&vendor_ie[0], SIR_MAC_MAX_IE_LENGTH + 2); + attr_len = nla_len( + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST]); + if (attr_len < 0 || attr_len > SIR_MAC_MAX_IE_LENGTH + 2) { + hddLog(LOGE, FL("Invalid value. attr_len %d"), + attr_len); + return -EINVAL; + } + + nla_memcpy(&vendor_ie, + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST], + attr_len); + vendor_ie_present = true; + hddLog(LOG1, FL("Access policy vendor ie present.attr_len %d"), + attr_len); + vos_trace_hex_dump(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, + &vendor_ie[0], attr_len); + } + + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY]) { + access_policy = (int) nla_get_u32( + tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY]); + if ((access_policy < QCA_ACCESS_POLICY_ACCEPT_UNLESS_LISTED) || + (access_policy > QCA_ACCESS_POLICY_DENY_UNLESS_LISTED)){ + hddLog(LOGE, FL("Invalid value. access_policy %d"), + access_policy); + return -EINVAL; + } + access_policy_present = true; + hddLog(LOG1, FL("Access policy present. access_policy %d"), + access_policy); + } + + if (vendor_ie_present && access_policy_present) { + if (access_policy == QCA_ACCESS_POLICY_DENY_UNLESS_LISTED) { + access_policy = + WLAN_HDD_VENDOR_IE_ACCESS_ALLOW_IF_LISTED; + } + else { + access_policy = WLAN_HDD_VENDOR_IE_ACCESS_NONE; + } + + hddLog(LOG1, FL("calling sme_update_access_policy_vendor_ie")); + status = sme_update_access_policy_vendor_ie(pHddCtx->hHal, + pAdapter->sessionId, &vendor_ie[0], + access_policy); + if (status == eHAL_STATUS_FAILURE) { + hddLog(LOGE, FL( + "Failed to set vendor ie and access policy.")); + return -EINVAL; + } + } + return ret_val; } |
