qcacld-3.0: Send update OWE info event
When receiving assoc request from OWE STA, always send update OWE info event which contains the following information: - MAC address of STA - RSN IE in assoc request - DH IE in assoc request Change-Id: I7017c5d2730e493db2472ae53d5dfa69553cfe45 CRs-Fixed: 2396925
This commit is contained in:
@@ -255,6 +255,8 @@ typedef struct sap_StationAssocIndication_s {
|
||||
eCsrEncryptionType negotiatedMCEncryptionType;
|
||||
bool fAuthRequired;
|
||||
uint8_t ecsa_capable;
|
||||
uint32_t owe_ie_len;
|
||||
uint8_t *owe_ie;
|
||||
} tSap_StationAssocIndication;
|
||||
|
||||
typedef struct sap_StationAssocReassocCompleteEvent_s {
|
||||
|
@@ -1342,6 +1342,101 @@ static void sap_handle_acs_scan_event(struct sap_context *sap_context,
|
||||
}
|
||||
#endif
|
||||
|
||||
#define DH_OUI_TYPE "\x20"
|
||||
#define DH_OUI_TYPE_SIZE (1)
|
||||
/**
|
||||
* sap_fill_owe_ie_in_assoc_ind() - Fill OWE IE in assoc indication
|
||||
* Function to fill OWE IE in assoc indication
|
||||
* @assoc_ind: SAP STA association indication
|
||||
* @sme_assoc_ind: SME association indication
|
||||
*
|
||||
* This function is to get OWE IEs (RSN IE, DH IE etc) from assoc request
|
||||
* and fill them in association indication.
|
||||
*
|
||||
* Return: true for success and false for failure
|
||||
*/
|
||||
static bool sap_fill_owe_ie_in_assoc_ind(tSap_StationAssocIndication *assoc_ind,
|
||||
struct assoc_ind *sme_assoc_ind)
|
||||
{
|
||||
uint32_t owe_ie_len, rsn_ie_len, dh_ie_len;
|
||||
const uint8_t *rsn_ie, *dh_ie;
|
||||
|
||||
rsn_ie = wlan_get_ie_ptr_from_eid(DOT11F_EID_RSN,
|
||||
assoc_ind->assocReqPtr,
|
||||
assoc_ind->assocReqLength);
|
||||
if (!rsn_ie) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "RSN IE is not present");
|
||||
return false;
|
||||
}
|
||||
rsn_ie_len = rsn_ie[1] + 2;
|
||||
if (rsn_ie_len < DOT11F_IE_RSN_MIN_LEN ||
|
||||
rsn_ie_len > DOT11F_IE_RSN_MAX_LEN) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid RSN IE len %d",
|
||||
rsn_ie_len);
|
||||
return false;
|
||||
}
|
||||
|
||||
dh_ie = wlan_get_ext_ie_ptr_from_ext_id(DH_OUI_TYPE, DH_OUI_TYPE_SIZE,
|
||||
assoc_ind->assocReqPtr,
|
||||
(uint16_t)assoc_ind->assocReqLength);
|
||||
if (!dh_ie) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "DH IE is not present");
|
||||
return false;
|
||||
}
|
||||
dh_ie_len = dh_ie[1] + 2;
|
||||
if (dh_ie_len < DOT11F_IE_DH_PARAMETER_ELEMENT_MIN_LEN ||
|
||||
dh_ie_len > DOT11F_IE_DH_PARAMETER_ELEMENT_MAX_LEN) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid DH IE len %d",
|
||||
dh_ie_len);
|
||||
return false;
|
||||
}
|
||||
|
||||
QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO,
|
||||
FL("rsn_ie_len = %d, dh_ie_len = %d"), rsn_ie_len, dh_ie_len);
|
||||
|
||||
owe_ie_len = rsn_ie_len + dh_ie_len;
|
||||
assoc_ind->owe_ie = qdf_mem_malloc(owe_ie_len);
|
||||
if (!assoc_ind->owe_ie)
|
||||
return false;
|
||||
|
||||
qdf_mem_copy(assoc_ind->owe_ie, rsn_ie, rsn_ie_len);
|
||||
qdf_mem_copy(assoc_ind->owe_ie + rsn_ie_len, dh_ie, dh_ie_len);
|
||||
assoc_ind->owe_ie_len = owe_ie_len;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* sap_save_owe_pending_assoc_ind() - Save pending assoc indication
|
||||
* Function to save pending assoc indication in SAP context
|
||||
* @sap_ctx: SAP context
|
||||
* @sme_assoc_ind: SME association indication
|
||||
*
|
||||
* This function is to save pending assoc indication in linked list
|
||||
* in SAP context.
|
||||
*
|
||||
* Return: true for success and false for failure
|
||||
*/
|
||||
static bool sap_save_owe_pending_assoc_ind(struct sap_context *sap_ctx,
|
||||
struct assoc_ind *sme_assoc_ind)
|
||||
{
|
||||
struct owe_assoc_ind *assoc_ind;
|
||||
QDF_STATUS status;
|
||||
|
||||
assoc_ind = qdf_mem_malloc(sizeof(*assoc_ind));
|
||||
if (!assoc_ind)
|
||||
return false;
|
||||
assoc_ind->assoc_ind = sme_assoc_ind;
|
||||
status = qdf_list_insert_back(&sap_ctx->owe_pending_assoc_ind_list,
|
||||
&assoc_ind->node);
|
||||
if (QDF_STATUS_SUCCESS != status) {
|
||||
qdf_mem_free(assoc_ind);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* sap_signal_hdd_event() - send event notification
|
||||
* @sap_ctx: Sap Context
|
||||
@@ -1414,6 +1509,29 @@ QDF_STATUS sap_signal_hdd_event(struct sap_context *sap_ctx,
|
||||
csr_roaminfo->u.pConnectedProfile->mcEncryptionType;
|
||||
assoc_ind->fAuthRequired = csr_roaminfo->fAuthRequired;
|
||||
}
|
||||
if (csr_roaminfo->owe_pending_assoc_ind) {
|
||||
if (!sap_fill_owe_ie_in_assoc_ind(assoc_ind,
|
||||
csr_roaminfo->owe_pending_assoc_ind)) {
|
||||
QDF_TRACE(QDF_MODULE_ID_SAP,
|
||||
QDF_TRACE_LEVEL_ERROR,
|
||||
FL("Failed to fill OWE IE"));
|
||||
qdf_mem_free(csr_roaminfo->
|
||||
owe_pending_assoc_ind);
|
||||
csr_roaminfo->owe_pending_assoc_ind = NULL;
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
if (!sap_save_owe_pending_assoc_ind(sap_ctx,
|
||||
csr_roaminfo->owe_pending_assoc_ind)) {
|
||||
QDF_TRACE(QDF_MODULE_ID_SAP,
|
||||
QDF_TRACE_LEVEL_ERROR,
|
||||
FL("Failed to save assoc ind"));
|
||||
qdf_mem_free(csr_roaminfo->
|
||||
owe_pending_assoc_ind);
|
||||
csr_roaminfo->owe_pending_assoc_ind = NULL;
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
csr_roaminfo->owe_pending_assoc_ind = NULL;
|
||||
}
|
||||
break;
|
||||
case eSAP_START_BSS_EVENT:
|
||||
sap_ap_event.sapHddEventCode = eSAP_START_BSS_EVENT;
|
||||
|
@@ -226,6 +226,7 @@ struct sap_context {
|
||||
uint8_t sap_sta_id;
|
||||
bool dfs_cac_offload;
|
||||
bool is_chan_change_inprogress;
|
||||
qdf_list_t owe_pending_assoc_ind_list;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@@ -242,6 +242,67 @@ struct sap_context *sap_create_ctx(void)
|
||||
return sap_ctx;
|
||||
} /* sap_create_ctx */
|
||||
|
||||
static QDF_STATUS wlansap_owe_init(struct sap_context *sap_ctx)
|
||||
{
|
||||
qdf_list_create(&sap_ctx->owe_pending_assoc_ind_list, 0);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void wlansap_owe_cleanup(struct sap_context *sap_ctx)
|
||||
{
|
||||
struct mac_context *mac;
|
||||
struct owe_assoc_ind *owe_assoc_ind;
|
||||
struct assoc_ind *assoc_ind = NULL;
|
||||
qdf_list_node_t *node = NULL, *next_node = NULL;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!sap_ctx) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid SAP context");
|
||||
return;
|
||||
}
|
||||
|
||||
mac = sap_get_mac_context();
|
||||
if (!mac) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context");
|
||||
return;
|
||||
}
|
||||
|
||||
if (QDF_STATUS_SUCCESS !=
|
||||
qdf_list_peek_front(&sap_ctx->owe_pending_assoc_ind_list,
|
||||
&node)) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP,
|
||||
"Failed to find assoc ind list");
|
||||
return;
|
||||
}
|
||||
|
||||
while (node) {
|
||||
qdf_list_peek_next(&sap_ctx->owe_pending_assoc_ind_list,
|
||||
node, &next_node);
|
||||
owe_assoc_ind = qdf_container_of(node, struct owe_assoc_ind,
|
||||
node);
|
||||
status = qdf_list_remove_node(
|
||||
&sap_ctx->owe_pending_assoc_ind_list,
|
||||
node);
|
||||
if (status == QDF_STATUS_SUCCESS) {
|
||||
assoc_ind = owe_assoc_ind->assoc_ind;
|
||||
qdf_mem_free(owe_assoc_ind);
|
||||
/* TODO: disassoc OWE STA */
|
||||
qdf_mem_free(assoc_ind);
|
||||
} else {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP,
|
||||
"Failed to remove assoc ind");
|
||||
}
|
||||
node = next_node;
|
||||
next_node = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void wlansap_owe_deinit(struct sap_context *sap_ctx)
|
||||
{
|
||||
qdf_list_destroy(&sap_ctx->owe_pending_assoc_ind_list);
|
||||
}
|
||||
|
||||
QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
|
||||
enum QDF_OPMODE mode,
|
||||
uint8_t *addr, uint32_t session_id, bool reinit)
|
||||
@@ -294,6 +355,15 @@ QDF_STATUS sap_init_ctx(struct sap_context *sap_ctx,
|
||||
ucfg_scan_register_requester(mac->psoc, "SAP",
|
||||
sap_scan_event_callback, sap_ctx);
|
||||
|
||||
if (!reinit) {
|
||||
status = wlansap_owe_init(sap_ctx);
|
||||
if (QDF_STATUS_SUCCESS != status) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP,
|
||||
"OWE init failed");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -311,6 +381,9 @@ QDF_STATUS sap_deinit_ctx(struct sap_context *sap_ctx)
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
wlansap_owe_cleanup(sap_ctx);
|
||||
wlansap_owe_deinit(sap_ctx);
|
||||
|
||||
mac = sap_get_mac_context();
|
||||
if (!mac) {
|
||||
QDF_TRACE_ERROR(QDF_MODULE_ID_SAP, "Invalid MAC context");
|
||||
|
Reference in New Issue
Block a user