Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/wifi_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ typedef struct {
wifi_event_type_t event_type;
wifi_event_subtype_t sub_type;
wifi_event_route_t route;
unsigned int mon_data_len;
union {
wifi_monitor_data_t *mon_data;
wifi_core_data_t core_data;
Expand Down
6 changes: 6 additions & 0 deletions source/apps/wifi_apps_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ int apps_mgr_link_quality_event(wifi_apps_mgr_t *apps_mgr, wifi_event_type_t typ

app = get_app_by_inst(apps_mgr, wifi_app_inst_link_quality);

if (app == NULL) {
wifi_util_error_print(WIFI_APPS, "%s %d assert - NULL Pointer\n", __FUNCTION__, __LINE__);
destroy_wifi_event(event);
return RETURN_ERR;
}

app->desc.event_fn(app, event);

destroy_wifi_event(event);
Expand Down
36 changes: 32 additions & 4 deletions source/core/wifi_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
Expand All @@ -30,6 +31,29 @@

extern bool monitor_initialization_done;

static unsigned int monitor_event_payload_size(wifi_event_subtype_t sub_type)
{
switch (sub_type) {
case wifi_event_monitor_csi_pinger:
return offsetof(wifi_monitor_data_t, u) + sizeof(csi_mon_t);
case wifi_event_monitor_stats_flag_change:
case wifi_event_monitor_radio_stats_flag_change:
case wifi_event_monitor_vap_stats_flag_change:
return offsetof(wifi_monitor_data_t, u) + sizeof(client_stats_enable_t);
Comment thread
bharathivelp marked this conversation as resolved.
case wifi_event_monitor_connect:
case wifi_event_monitor_disconnect:
case wifi_event_monitor_deauthenticate:
return offsetof(wifi_monitor_data_t, u) + sizeof(auth_deauth_dev_t);
case wifi_event_monitor_auth_req:
case wifi_event_monitor_assoc_req:
case wifi_event_monitor_reassoc_req:
case wifi_event_monitor_action_frame:
return offsetof(wifi_monitor_data_t, u) + sizeof(frame_data_t);
default:
return sizeof(wifi_monitor_data_t);
}
}

const char *wifi_event_type_to_string(wifi_event_type_t type)
{
#define DOC2S(x) \
Expand Down Expand Up @@ -262,7 +286,7 @@ int clone_wifi_event(wifi_event_t *event, wifi_event_t **clone)
msg_len = sizeof(wifi_provider_response_t);
} else {
msg = event->u.mon_data;
msg_len = sizeof(wifi_monitor_data_t);
msg_len = event->mon_data_len ? event->mon_data_len : sizeof(wifi_monitor_data_t);
}
break;
case wifi_event_type_analytic:
Expand Down Expand Up @@ -358,6 +382,7 @@ wifi_event_t *create_wifi_event(unsigned int msg_len, wifi_event_type_t type,
event = NULL;
return NULL;
}
event->mon_data_len = msg_len;
}
break;
case wifi_event_type_csi:
Expand Down Expand Up @@ -705,7 +730,8 @@ int copy_msg_to_event(const void *data, unsigned int msg_len, wifi_event_type_t
sizeof(wifi_mon_stats_args_t));
event->u.provider_response->stat_array_size = response->stat_array_size;
} else {
memcpy(event->u.mon_data, data, sizeof(wifi_monitor_data_t));
memcpy(event->u.mon_data, data, msg_len);
event->mon_data_len = msg_len;
}
break;
case wifi_event_type_analytic:
Expand Down Expand Up @@ -837,6 +863,7 @@ int push_event_to_monitor_queue(wifi_monitor_data_t *mon_data, wifi_event_subtyp
{
wifi_monitor_t *monitor_param = (wifi_monitor_t *)get_wifi_monitor();
wifi_event_t *event;
unsigned int mon_data_len;
bool is_limit_reached;

/* Check if monitor queue is initialized */
Expand All @@ -851,13 +878,14 @@ int push_event_to_monitor_queue(wifi_monitor_data_t *mon_data, wifi_event_subtyp
return RETURN_ERR;
}

event = create_wifi_event(sizeof(wifi_monitor_data_t), wifi_event_type_monitor, sub_type);
mon_data_len = monitor_event_payload_size(sub_type);
event = create_wifi_event(mon_data_len, wifi_event_type_monitor, sub_type);
if (event == NULL) {
wifi_util_error_print(WIFI_CTRL, "%s %d data malloc null\n", __FUNCTION__, __LINE__);
return RETURN_ERR;
}

if (copy_msg_to_event(mon_data, sizeof(wifi_monitor_data_t), wifi_event_type_monitor, sub_type,
if (copy_msg_to_event(mon_data, mon_data_len, wifi_event_type_monitor, sub_type,
rt, event) != RETURN_OK) {
wifi_util_error_print(WIFI_CTRL, "%s %d unable to copy msg to event for sub_type : %s\n",
__FUNCTION__, __LINE__, wifi_event_subtype_to_string(sub_type));
Expand Down
14 changes: 12 additions & 2 deletions source/dml/wifi_ssp/ssp_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,21 +1201,28 @@ void Psm_Db_Write_MacFilter(wifi_mac_entry_param_t *mcfg)
snprintf(temp_mac_entry->device_name, sizeof(temp_mac_entry->device_name), "%s", mcfg->device_name);
}
wifi_util_dbg_print(WIFI_PSM, "%s:%d mac entry already present\r\n",__func__, __LINE__);
free(mcfg_mac);
return;
}
ret = set_psm_record_by_name((mcfg->vap_index + 1), (mac_psm_data->data_index + 1), MacFilter, mcfg->mac);
if (ret == RETURN_OK) {
temp_mac_entry = malloc(sizeof(wifi_mac_psm_param_t));
if (temp_mac_entry == NULL) {
wifi_util_dbg_print(WIFI_PSM, "%s:%d malloc failure\r\n",__func__, __LINE__);
free(mcfg_mac);
return;
}
temp_mac_entry->data_index = (mac_psm_data->data_index + 1);
snprintf(temp_mac_entry->mac, sizeof(temp_mac_entry->mac), "%s", mcfg->mac);
if (strlen(mcfg->device_name) != 0) {
snprintf(temp_mac_entry->device_name, sizeof(temp_mac_entry->device_name), "%s", mcfg->device_name);
}
hash_map_put(psm_mac_map, mcfg_mac, temp_mac_entry);
if (hash_map_put(psm_mac_map, mcfg_mac, temp_mac_entry) != 0)
{
wifi_util_error_print(WIFI_PSM, "%s:%d hash_map_put failed for mac filter entry\r\n", __func__, __LINE__);
return;
Comment thread
bharathivelp marked this conversation as resolved.
}
mcfg_mac = NULL;
count = hash_map_count(psm_mac_map);
update_macfilter_list((mcfg->vap_index + 1), count, psm_mac_map);
}
Expand Down Expand Up @@ -1250,7 +1257,10 @@ void Psm_Db_Write_MacFilter(wifi_mac_entry_param_t *mcfg)
if (strlen(mcfg->device_name) != 0) {
snprintf(temp_mac_entry->device_name, sizeof(temp_mac_entry->device_name), "%s", mcfg->device_name);
}
hash_map_put(psm_mac_map, strdup(mcfg->mac), temp_mac_entry);
if (hash_map_put(psm_mac_map, strdup(mcfg->mac), temp_mac_entry) != 0) {
wifi_util_error_print(WIFI_PSM, "%s:%d hash_map_put failed for mac filter entry\r\n", __func__, __LINE__);
return;
}
count = hash_map_count(psm_mac_map);
update_macfilter_list( (mcfg->vap_index + 1), count, psm_mac_map);
}
Expand Down
2 changes: 1 addition & 1 deletion source/webconfig/wifi_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -6031,7 +6031,7 @@ webconfig_error_t decode_assocdev_stats_object(wifi_provider_response_t **assoc_
free(*assoc_stats);
*assoc_stats = NULL;
wifi_util_info_print(WIFI_WEBCONFIG, "%s:%d: Associated Device stats array size is %d\n",
__func__, __LINE__, (*assoc_stats)->stat_array_size);
__func__, __LINE__, size);
return webconfig_error_none;
} else {
client_stats_data = (wifi_associated_dev3_t *)malloc(sizeof(wifi_associated_dev3_t) * size);
Expand Down
6 changes: 6 additions & 0 deletions source/webconfig/wifi_easymesh_translator.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,12 @@ webconfig_error_t translate_sta_object_to_easymesh_for_assocdev_stats(webconfig_
return webconfig_error_decode;
}

if (params->collect_stats.stats == NULL) {
wifi_util_info_print(WIFI_WEBCONFIG,
"%s:%d: no associated device stats to translate\n", __func__, __LINE__);
return webconfig_error_translate_to_easymesh;
}

assoc_device_stats = (wifi_provider_response_t **)&params->collect_stats.stats;
sta_size = (*assoc_device_stats)->stat_array_size;

Expand Down
Loading