diff options
| author | Kapil Gupta <kapgupta@codeaurora.org> | 2017-03-28 16:32:37 +0530 |
|---|---|---|
| committer | spuligil <spuligil@codeaurora.org> | 2017-04-15 12:50:44 -0700 |
| commit | 8e43fd0fc8215839bf1f4d0323b6f63749088924 (patch) | |
| tree | 0de70558b5ce02d791c7983c4da3c1b7978168c7 | |
| parent | f96ad7c71f3ae22ca7cc838e66699d8ed09ee9f9 (diff) | |
qcacld-3.0: Add changes to parse fils indication element
Add changes to parse fils indication element and add the info
to bss descriptor for further use.
CRs-Fixed: 2028113
Change-Id: Ida543aa54c7087d4ec562ada64dd6b2378adf39c
| -rw-r--r-- | core/mac/inc/sir_api.h | 32 | ||||
| -rw-r--r-- | core/mac/src/include/parser_api.h | 87 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_scan_result_utils.c | 38 | ||||
| -rw-r--r-- | core/mac/src/sys/legacy/src/utils/src/parser_api.c | 122 |
4 files changed, 276 insertions, 3 deletions
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index bca38e5be28b..1083234ceba4 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -119,6 +119,13 @@ typedef uint8_t 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 + /** * enum sir_conn_update_reason: Reason for conc connection update * @SIR_UPDATE_REASON_SET_OPER_CHAN: Set probable operating channel @@ -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. */ uint16_t length; @@ -740,8 +765,6 @@ typedef struct sSirBssDescription { uint16_t QBSSLoad_avail; /* To achieve 8-byte alignment with ESE enabled */ uint32_t reservedPadding5; - /* Please keep the structure 4 bytes aligned above the ieFields */ - /* whether it is from a probe rsp */ uint8_t fProbeRsp; /* Actual channel the beacon/probe response was received on */ @@ -751,11 +774,14 @@ typedef struct sSirBssDescription { uint8_t WscIeProbeRsp[WSCIE_PROBE_RSP_LEN]; uint8_t reservedPadding4; uint32_t tsf_delta; - uint8_t ht_caps_present; uint8_t vht_caps_present; uint8_t beacomforming_capable; uint8_t chan_width; +#ifdef WLAN_FEATURE_FILS_SK + struct fils_ind_elements fils_info_element; +#endif + /* Please keep the structure 4 bytes aligned above the ieFields */ uint32_t ieFields[1]; } tSirBssDescription, *tpSirBssDescription; diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index e055c7eec197..5aefe4a1123f 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -109,6 +109,90 @@ typedef struct sSirQCNIE { uint8_t sub_version; } tSirQCNIE, *tpSirQCNIE; +#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 { tSirMacTimeStamp timeStamp; @@ -198,6 +282,9 @@ typedef struct sSirProbeRespBeacon { bool assoc_disallowed; uint8_t assoc_disallowed_reason; tSirQCNIE QCN_IE; +#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/lim_scan_result_utils.c b/core/mac/src/pe/lim/lim_scan_result_utils.c index 36fde037fab0..72a03d166171 100644 --- a/core/mac/src/pe/lim/lim_scan_result_utils.c +++ b/core/mac/src/pe/lim/lim_scan_result_utils.c @@ -44,7 +44,43 @@ #include "rrm_api.h" #include "cds_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; + qdf_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; + qdf_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 /** * lim_collect_bss_description() * @@ -223,6 +259,8 @@ lim_collect_bss_description(tpAniSirGlobal pMac, pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail; pBssDescr->qbss_chan_load = pBPR->QBSSLoad.chautil; } + + lim_update_bss_with_fils_data(pBPR, pBssDescr); /* Copy IE fields */ qdf_mem_copy((uint8_t *) &pBssDescr->ieFields, pBody + SIR_MAC_B_PR_SSID_OFFSET, ieLen); diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index df39db11e109..ca493c28d05e 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -2269,6 +2269,75 @@ sir_validate_and_rectify_ies(tpAniSirGlobal mac_ctx, return eSIR_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; + qdf_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; + qdf_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; + qdf_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) +{ +} +#endif + tSirRetStatus sir_convert_probe_frame2_struct(tpAniSirGlobal pMac, uint8_t *pFrame, uint32_t nFrame, @@ -2558,6 +2627,7 @@ tSirRetStatus sir_convert_probe_frame2_struct(tpAniSirGlobal pMac, } } + sir_convert_fils_data_to_probersp_struct(pProbeResp, pr); qdf_mem_free(pr); return eSIR_SUCCESS; @@ -3427,6 +3497,30 @@ err_bcnrep: #endif /* FEATURE_WLAN_ESE */ +#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 sir_parse_beacon_ie(tpAniSirGlobal pMac, tpSirProbeRespBeacon pBeaconStruct, @@ -3709,10 +3803,37 @@ sir_parse_beacon_ie(tpAniSirGlobal pMac, } } + sir_parse_fils_beacon_ie(pBeaconStruct, pBies); qdf_mem_free(pBies); return eSIR_SUCCESS; } /* End sir_parse_beacon_ie. */ +#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 sir_convert_beacon_frame2_struct(tpAniSirGlobal pMac, uint8_t *pFrame, @@ -4072,6 +4193,7 @@ sir_convert_beacon_frame2_struct(tpAniSirGlobal pMac, } } + sir_convert_fils_data_to_beacon_struct(pBeaconStruct, pBeacon); qdf_mem_free(pBeacon); return eSIR_SUCCESS; |
