diff options
| author | Service qcabuildsw <qcabuildsw@localhost> | 2016-09-20 17:45:11 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-20 17:45:11 -0700 |
| commit | ec902e2adf6e3a53112e791a58e7673ebced8eb4 (patch) | |
| tree | 6bcf26b65abae69187640854540f0353af7f6702 | |
| parent | 26b45de1b13acef91054746af792cd7b012316e9 (diff) | |
| parent | 44f6a214961ebf340f1604db70c2a5ca8cb20788 (diff) | |
Merge "qcacld-3.0: Parse attributes for vendor IE and access policy" into wlan-cld3.driver.lnx.1.1-dev
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 63 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.h | 73 |
2 files changed, 135 insertions, 1 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 7b646d43cbd5..fe99cb75ad26 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -589,6 +589,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}, [WLAN_HDD_TM_ATTR_DATA] = {.type = NLA_BINARY, @@ -3883,7 +3888,10 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, u32 guard_time; u32 ftm_capab; QDF_STATUS status; - + 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; ENTER_DEV(dev); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { @@ -3949,6 +3957,59 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, ret_val = -EPERM; } + if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ACCESS_POLICY_IE_LIST]) { + qdf_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) { + hdd_info("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; + hdd_info("Access policy vendor ie present.attr_len %d", + attr_len); + qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_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)) { + hdd_info("Invalid value. access_policy %d", + access_policy); + return -EINVAL; + } + access_policy_present = true; + hdd_info("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; + } + + hdd_info("calling sme_update_access_policy_vendor_ie"); + status = sme_update_access_policy_vendor_ie(hdd_ctx->hHal, + adapter->sessionId, &vendor_ie[0], + access_policy); + if (QDF_STATUS_SUCCESS != status) { + hdd_info("Failed to set vendor ie and access policy."); + return -EINVAL; + } + } + return ret_val; } diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h index 479d9d40293b..ecc0cffe1854 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.h +++ b/core/hdd/src/wlan_hdd_cfg80211.h @@ -2282,6 +2282,25 @@ enum qca_wlan_vendor_acs_hw_mode { }; /** + * 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 @@ -2289,6 +2308,23 @@ enum qca_wlan_vendor_acs_hw_mode { * @QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR: stats avg. factor * @QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME: guard time * @QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT: fine time measurement + * @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 */ @@ -2298,6 +2334,43 @@ enum qca_wlan_vendor_config { QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR, QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME, QCA_WLAN_VENDOR_ATTR_CONFIG_FINE_TIME_MEASUREMENT, + /* 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, QCA_WLAN_VENDOR_ATTR_CONFIG_MAX = |
