diff options
| author | Rajasekaran Kalidoss <rkalidos@codeaurora.org> | 2017-06-08 20:45:53 +0530 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-06-21 04:20:13 -0700 |
| commit | e143ce0ddee2cd7bc1a3cf29357280fd9685b4b2 (patch) | |
| tree | 2a0de73db646c452e1794606fc3f7df5b86deced | |
| parent | 777c4b2ae08696d4fdc265d0e7b608567014e160 (diff) | |
qcacld-2.0: Add changes to parse fils indication
Add changes to parse fils indication element and add the
info to bss descriptor for further use.
CRs-Fixed: 2033938
Change-Id: Ida543aa54c7087d4ec562ada64dd6b2378adf39c
| -rw-r--r-- | CORE/MAC/inc/sirApi.h | 28 | ||||
| -rw-r--r-- | CORE/MAC/src/include/parserApi.h | 90 | ||||
| -rw-r--r-- | CORE/MAC/src/pe/lim/limScanResultUtils.c | 43 | ||||
| -rw-r--r-- | CORE/SYS/legacy/src/utils/src/parserApi.c | 133 |
4 files changed, 291 insertions, 3 deletions
diff --git a/CORE/MAC/inc/sirApi.h b/CORE/MAC/inc/sirApi.h index 5a4c2405da8d..3a6ac13a4303 100644 --- a/CORE/MAC/inc/sirApi.h +++ b/CORE/MAC/inc/sirApi.h @@ -93,6 +93,13 @@ typedef tANI_U8 tSirVersionString[SIR_VERSION_STRING_LEN]; #define MAX_LEN_UDP_RESP_OFFLOAD 128 +/* Maximum number of realms present in fils indication element */ +#define SIR_MAX_REALM_COUNT 7 +/* Realm length */ +#define SIR_REALM_LEN 2 +/* Cache ID length */ +#define CACHE_ID_LEN 2 + #ifdef FEATURE_WLAN_EXTSCAN #define WLAN_EXTSCAN_MAX_CHANNELS 36 @@ -710,6 +717,24 @@ typedef struct sSirSmeStartBssReq #define WSCIE_PROBE_RSP_LEN (317 + 2) +#ifdef WLAN_FEATURE_FILS_SK +/* struct fils_ind_elements: elements parsed from fils indication present + * in beacon/probe resp + * @realm_cnt: number of realm present + * @realm: realms + * @is_fils_sk_supported: if FILS SK supported + * @is_cache_id_present: if cache id present + * @cache_id: cache id + */ +struct fils_ind_elements { + uint16_t realm_cnt; + uint8_t realm[SIR_MAX_REALM_COUNT][SIR_REALM_LEN]; + bool is_fils_sk_supported; + bool is_cache_id_present; + uint8_t cache_id[CACHE_ID_LEN]; +}; +#endif + typedef struct sSirBssDescription { //offset of the ieFields from bssId. @@ -754,6 +779,9 @@ typedef struct sSirBssDescription tANI_U8 reservedPadding4; tANI_U32 tsf_delta; +#ifdef WLAN_FEATURE_FILS_SK + struct fils_ind_elements fils_info_element; +#endif tANI_U32 ieFields[1]; } tSirBssDescription, *tpSirBssDescription; diff --git a/CORE/MAC/src/include/parserApi.h b/CORE/MAC/src/include/parserApi.h index 390d01a353ce..8e8992213fe5 100644 --- a/CORE/MAC/src/include/parserApi.h +++ b/CORE/MAC/src/include/parserApi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -105,6 +105,91 @@ typedef struct sSirCountryInformation } channelTransmitPower[COUNTRY_INFO_MAX_CHANNEL]; } tSirCountryInformation,*tpSirCountryInformation; +#ifdef WLAN_FEATURE_FILS_SK + +#define SIR_MAX_IDENTIFIER_CNT 7 +#define SIR_CACHE_IDENTIFIER_LEN 2 +#define SIR_HESSID_LEN 6 +#define SIR_MAX_KEY_CNT 7 +#define SIR_MAX_KEY_LEN 48 + +/* + * struct public_key_identifier: structure for public key identifier + * present in fils indication element + * @is_present: if Key info is present + * @key_cnt: number of keys present + * @key_type: type of key used + * @length: length of key + * @key: key data + */ + +struct public_key_identifier { + bool is_present; + uint8_t key_cnt; + uint8_t key_type; + uint8_t length; + uint8_t key[SIR_MAX_KEY_CNT][SIR_MAX_KEY_LEN]; +}; + +/* + * struct fils_cache_identifier: structure for fils cache identifier + * present in fils indication element + * @is_present: if cache identifier is present + * @identifier: cache identifier + */ +struct fils_cache_identifier { + bool is_present; + uint8_t identifier[SIR_CACHE_IDENTIFIER_LEN]; +}; + +/* + * struct fils_hessid: structure for fils hessid + * present in fils indication element + * @is_present: if hessid info is present + * @hessid: hessid data + */ +struct fils_hessid { + bool is_present; + uint8_t hessid[SIR_HESSID_LEN]; +}; + +/* + * struct fils_realm_identifier: structure for fils_realm_identifier + * present in fils indication element + * @is_present: if realm info is present + * @realm_cnt: realm count + * @realm: realm data + */ +struct fils_realm_identifier { + bool is_present; + uint8_t realm_cnt; + uint8_t realm[SIR_MAX_REALM_COUNT][SIR_REALM_LEN]; +}; + +/* + * struct sir_fils_indication: structure for fils indication element + * @is_present: if indication element is present + * @is_ip_config_supported: if IP config is supported + * @is_fils_sk_auth_supported: if fils sk suppprted + * @is_fils_sk_auth_pfs_supported: if fils sk with pfs supported + * @is_pk_auth_supported: if fils public key supported + * @cache_identifier: fils cache idenfier info + * @hessid: fils hessid info + * @realm_identifier: fils realm info + * @key_identifier: fils key identifier info + */ +struct sir_fils_indication { + bool is_present; + uint8_t is_ip_config_supported; + uint8_t is_fils_sk_auth_supported; + uint8_t is_fils_sk_auth_pfs_supported; + uint8_t is_pk_auth_supported; + struct fils_cache_identifier cache_identifier; + struct fils_hessid hessid; + struct fils_realm_identifier realm_identifier; + struct public_key_identifier key_identifier; +}; +#endif /* Structure common to Beacons & Probe Responses */ typedef struct sSirProbeRespBeacon @@ -197,6 +282,9 @@ typedef struct sSirProbeRespBeacon uint8_t is_ese_ver_ie_present; #endif uint8_t vendor_sub20_capability; +#ifdef WLAN_FEATURE_FILS_SK + struct sir_fils_indication fils_ind; +#endif } tSirProbeRespBeacon, *tpSirProbeRespBeacon; // probe Request structure diff --git a/CORE/MAC/src/pe/lim/limScanResultUtils.c b/CORE/MAC/src/pe/lim/limScanResultUtils.c index 195463e76bf4..f767718a224c 100644 --- a/CORE/MAC/src/pe/lim/limScanResultUtils.c +++ b/CORE/MAC/src/pe/lim/limScanResultUtils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -48,6 +48,44 @@ #endif #include "vos_utils.h" +#ifdef WLAN_FEATURE_FILS_SK +/** + * lim_update_bss_with_fils_data: update fils data to bss descriptor + * if available in probe/beacon. + * @pr: probe response/beacon + * @bss_descr: pointer to bss descriptor + * + * @Return: None + */ +static void lim_update_bss_with_fils_data(tpSirProbeRespBeacon pr, + tSirBssDescription *bss_descr) +{ + if (!pr->fils_ind.is_present) + return; + + if (pr->fils_ind.realm_identifier.realm_cnt > SIR_MAX_REALM_COUNT) + pr->fils_ind.realm_identifier.realm_cnt = SIR_MAX_REALM_COUNT; + + bss_descr->fils_info_element.realm_cnt = + pr->fils_ind.realm_identifier.realm_cnt; + vos_mem_copy(bss_descr->fils_info_element.realm, + pr->fils_ind.realm_identifier.realm, + bss_descr->fils_info_element.realm_cnt * SIR_REALM_LEN); + if (pr->fils_ind.cache_identifier.is_present) { + bss_descr->fils_info_element.is_cache_id_present = true; + vos_mem_copy(bss_descr->fils_info_element.cache_id, + pr->fils_ind.cache_identifier.identifier, CACHE_ID_LEN); + } + if (pr->fils_ind.is_fils_sk_auth_supported) + bss_descr->fils_info_element.is_fils_sk_supported = true; +} +#else +static inline void lim_update_bss_with_fils_data(tpSirProbeRespBeacon pr, + tSirBssDescription *bss_descr) +{ +} +#endif + /** * limDeactiveMinChannelTimerDuringScan() * @@ -283,6 +321,9 @@ limCollectBssDescription(tpAniSirGlobal pMac, pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail; } #endif +#ifdef WLAN_FEATURE_FILS_SK + lim_update_bss_with_fils_data(pBPR, pBssDescr); +#endif // Copy IE fields vos_mem_copy((tANI_U8 *) &pBssDescr->ieFields, pBody + SIR_MAC_B_PR_SSID_OFFSET, diff --git a/CORE/SYS/legacy/src/utils/src/parserApi.c b/CORE/SYS/legacy/src/utils/src/parserApi.c index 0da9a22ae37e..cb20a37ddf70 100644 --- a/CORE/SYS/legacy/src/utils/src/parserApi.c +++ b/CORE/SYS/legacy/src/utils/src/parserApi.c @@ -2314,6 +2314,79 @@ tSirRetStatus sirvalidateandrectifyies(tpAniSirGlobal pMac, return eHAL_STATUS_SUCCESS; } +#ifdef WLAN_FEATURE_FILS_SK +/** + * update_fils_data: update fils params from beacon/probe response + * @fils_ind: pointer to sir_fils_indication + * @fils_indication: pointer to tDot11fIEfils_indication + * + * Return: None + */ +static void update_fils_data(struct sir_fils_indication *fils_ind, + tDot11fIEfils_indication *fils_indication) +{ + uint8_t *data; + + data = fils_indication->variable_data; + fils_ind->is_present = true; + fils_ind->is_ip_config_supported = + fils_indication->is_ip_config_supported; + fils_ind->is_fils_sk_auth_supported = + fils_indication->is_fils_sk_auth_supported; + fils_ind->is_fils_sk_auth_pfs_supported = + fils_indication->is_fils_sk_auth_pfs_supported; + fils_ind->is_pk_auth_supported = + fils_indication->is_pk_auth_supported; + if (fils_indication->is_cache_id_present) { + fils_ind->cache_identifier.is_present = true; + vos_mem_copy(fils_ind->cache_identifier.identifier, + data, SIR_CACHE_IDENTIFIER_LEN); + data = data + SIR_CACHE_IDENTIFIER_LEN; + } + if (fils_indication->is_hessid_present) { + fils_ind->hessid.is_present = true; + vos_mem_copy(fils_ind->hessid.hessid, + data, SIR_HESSID_LEN); + data = data + SIR_HESSID_LEN; + } + if (fils_indication->realm_identifiers_cnt) { + fils_ind->realm_identifier.is_present = true; + fils_ind->realm_identifier.realm_cnt = + fils_indication->realm_identifiers_cnt; + vos_mem_copy(fils_ind->realm_identifier.realm, + data, fils_ind->realm_identifier.realm_cnt * + SIR_REALM_LEN); + } +} + +/** + * sir_convert_fils_data_to_probersp_struct: update fils params from probe resp + * @probe_resp: pointer to tpSirProbeRespBeacon + * @pr: pointer to tDot11fProbeResponse + * + * Return: None + */ +static void +sir_convert_fils_data_to_probersp_struct(tpSirProbeRespBeacon probe_resp, + tDot11fProbeResponse *pr) +{ + if (!pr->fils_indication.present) + return; + + update_fils_data(&probe_resp->fils_ind, &pr->fils_indication); +} +#else +static inline void +sir_convert_fils_data_to_probersp_struct(tpSirProbeRespBeacon probe_resp, + tDot11fProbeResponse *pr) +{ +} +static inline void populate_dot11f_fils_params(tpAniSirGlobal mac_ctx, + tDot11fAssocRequest *frm, + tpPESession pe_session) +{ +} +#endif tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac, tANI_U8 *pFrame, tANI_U32 nFrame, @@ -2602,7 +2675,9 @@ tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac, pProbeResp->vendor_sub20_capability = pr->QComVendorIE.Sub20Info.capability; } - +#ifdef WLAN_FEATURE_FILS_SK + sir_convert_fils_data_to_probersp_struct(pProbeResp, pr); +#endif vos_mem_free(pr); return eSIR_SUCCESS; @@ -3588,6 +3663,30 @@ err_bcnrep: #endif /* FEATURE_WLAN_ESE_UPLOAD */ +#ifdef WLAN_FEATURE_FILS_SK +/** + * sir_parse_fils_beacon_ie: update fils params from beacon IEs + * @beacon_struct: pointer to tpSirProbeRespBeacon + * @beacon_ie: pointer to tDot11fBeaconIEs + * + * Return: None + */ +static void sir_parse_fils_beacon_ie(tpSirProbeRespBeacon beacon_struct, + tDot11fBeaconIEs *beacon_ie) +{ + if (!beacon_ie->fils_indication.present) + return; + + update_fils_data(&beacon_struct->fils_ind, + &beacon_ie->fils_indication); +} +#else +static inline void sir_parse_fils_beacon_ie(tpSirProbeRespBeacon beacon_struct, + tDot11fBeaconIEs *beacon_ie) +{ +} +#endif + tSirRetStatus sirParseBeaconIE(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeaconStruct, @@ -3873,10 +3972,39 @@ sirParseBeaconIE(tpAniSirGlobal pMac, pBeaconStruct->vendor_sub20_capability = pBies->QComVendorIE.Sub20Info.capability; +#ifdef WLAN_FEATURE_FILS_SK + sir_parse_fils_beacon_ie(pBeaconStruct, pBies); +#endif vos_mem_free(pBies); return eSIR_SUCCESS; } // End sirParseBeaconIE. +#ifdef WLAN_FEATURE_FILS_SK +/** + * sir_convert_fils_data_to_beacon_struct: update fils params from beacon + * @beacon_struct: pointer to tpSirProbeRespBeacon + * @beacon: pointer to tDot11fBeacon + * + * Return: None + */ +static void +sir_convert_fils_data_to_beacon_struct(tpSirProbeRespBeacon beacon_struct, + tDot11fBeacon *beacon) +{ + if (!beacon->fils_indication.present) + return; + + update_fils_data(&beacon_struct->fils_ind, + &beacon->fils_indication); +} +#else +static inline void +sir_convert_fils_data_to_beacon_struct(tpSirProbeRespBeacon beacon_struct, + tDot11fBeacon *beacon) +{ +} +#endif + tSirRetStatus sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac, tANI_U8 *pFrame, @@ -4243,6 +4371,9 @@ sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac, pBeacon->QComVendorIE.Sub20Info.capability; } +#ifdef WLAN_FEATURE_FILS_SK + sir_convert_fils_data_to_beacon_struct(pBeaconStruct, pBeacon); +#endif vos_mem_free(pBeacon); return eSIR_SUCCESS; |
