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: 0 additions & 1 deletion include/wifi_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ typedef struct {
client_stats_enable_t flag;
instant_msmt_t imsmt;
active_msmt_t amsmt;
associated_devs_t devs;
csi_mon_t csi_mon;
wifi_mon_stats_config_t mon_stats_config;
frame_data_t msg;
Expand Down
8 changes: 7 additions & 1 deletion source/apps/linkquality/wifi_linkquality.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void publish_qmgr_subdoc(const report_batch_t* report)
if (webconfig_encode(&ctrl->webconfig, data, subdoc_type) != webconfig_error_none) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d Error in encoding link report\n", __func__,
__LINE__);
webconfig_data_free(data);
free(data);
return;
}
Expand All @@ -80,17 +81,22 @@ void publish_qmgr_subdoc(const report_batch_t* report)
wifi_app = get_app_by_inst(&ctrl->apps_mgr, wifi_app_inst_link_quality);
if (wifi_app == NULL) {
wifi_util_error_print(WIFI_APPS, "%s:%d NULL Pointer \n", __func__, __LINE__);
webconfig_data_free(data);
free(data);
return;
}
status = get_bus_descriptor()->bus_event_publish_fn(&wifi_app->ctrl->handle, WIFI_QUALITY_LINKREPORT, &rdata);
if (status != bus_error_success) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: bus: bus_event_publish_fn Event failed %d\n",
__func__, __LINE__, status);
webconfig_data_free(data);
free(data);
return ;
}
if(data)
if (data) {
webconfig_data_free(data);
free(data);
}
return;
}

Expand Down
87 changes: 46 additions & 41 deletions source/core/wifi_multidoc_webconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,10 @@ static int update_vap_info_managed_xfinity(void *data, wifi_vap_info_t *vap_info
bool connected_building_enabled = false;
char *blob = cJSON_Print((cJSON *)data);

root = cJSON_Parse(blob);
if (blob) {
root = cJSON_Parse(blob);
cJSON_free(blob);
}

if (root == NULL) {
wifi_util_error_print(WIFI_CTRL, "%s:Managed xfinity json parse failure\n", __func__);
Expand Down Expand Up @@ -1743,6 +1746,7 @@ pErr wifi_vap_cfg_subdoc_handler(void *data)
cJSON_Delete(root);
goto finished;
}
cJSON_Delete(root);
free(execRetVal);
execRetVal = xfinity_exec_common_handler(vap_blob, webconfig_subdoc_type_xfinity);

Expand Down Expand Up @@ -2003,86 +2007,87 @@ pErr webconf_process_managed_subdoc(void* data)
wifi_util_error_print(WIFI_CTRL, "%s: json parse failure\n", __func__);
return execRetVal;
}

/*
* From this point on, resources that may be individually detached/allocated
* are tracked and released through a single cleanup block to avoid leaks on
* any error path.
*/
cJSON *amenities_blob = NULL;
cJSON *vap_blob = NULL;
cJSON *xfinity_blob = NULL;

cJSON *managed_wifi_enabled = cJSON_GetObjectItem(root, "ManagedWifiEnabled");
if (managed_wifi_enabled == NULL) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
strncpy(execRetVal->ErrorMsg, "Failed to Get ManagedWifiEnabled", sizeof(execRetVal->ErrorMsg)-1);
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to Get ManagedWifiEnabled\n", __func__);
return execRetVal;
goto cleanup;
}
connected_wifi_enabled = cJSON_IsTrue(managed_wifi_enabled)? true : false;
wifi_util_dbg_print(WIFI_CTRL,"managed_wifi_enabled is %d\n",connected_wifi_enabled);

cJSON *amenities_blob = cJSON_DetachItemFromObject(root, "AmenitiesNetworkConfig");
amenities_blob = cJSON_DetachItemFromObject(root, "AmenitiesNetworkConfig");
if (amenities_blob == NULL) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
strncpy(execRetVal->ErrorMsg, "Failed to detach AmenitiesNetworkConfig", sizeof(execRetVal->ErrorMsg)-1);
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to detach AmenitiesNetworkConfig\n", __func__);
return execRetVal;
goto cleanup;
}

cJSON *vap_blob = cJSON_DetachItemFromObject(root, "WifiVapConfig");
vap_blob = cJSON_DetachItemFromObject(root, "WifiVapConfig");
if(vap_blob == NULL) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
strncpy(execRetVal->ErrorMsg, "Failed to detach WifiVapConfig", sizeof(execRetVal->ErrorMsg)-1);
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to detach WifiVapConfig\n", __func__);
return execRetVal;
goto cleanup;
}
ret = connected_subdoc_handler(vap_blob, amenities_blob, VAP_PREFIX_LNF_PSK, webconfig_subdoc_type_lnf, connected_wifi_enabled, execRetVal);
ret = connected_subdoc_handler(vap_blob, amenities_blob, VAP_PREFIX_LNF_PSK, webconfig_subdoc_type_lnf, connected_wifi_enabled, execRetVal);
if (ret != RETURN_OK) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to detach xfinity_blob\n", __func__);
return execRetVal;
wifi_util_error_print(WIFI_CTRL, "%s: connected_subdoc_handler failed for lnf vaps\n", __func__);
goto cleanup;
}
cJSON *xfinity_blob = cJSON_DetachItemFromObject(root, "xfinityWifiVapConfig");

xfinity_blob = cJSON_DetachItemFromObject(root, "xfinityWifiVapConfig");
if(xfinity_blob == NULL) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
strncpy(execRetVal->ErrorMsg, "Failed to detach xfinity_blob", sizeof(execRetVal->ErrorMsg)-1);
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to detach xfinity_blob\n", __func__);
return execRetVal;
wifi_util_error_print(WIFI_CTRL, "%s: Failed to detach xfinityWifiVapConfig\n", __func__);
goto cleanup;
}

ret = connected_subdoc_handler(xfinity_blob, NULL, VAP_PREFIX_HOTSPOT, webconfig_subdoc_type_xfinity, connected_wifi_enabled, execRetVal);
if (ret != RETURN_OK) {
msgpack_zone_destroy(&msg_z);
execRetVal->ErrorCode = VALIDATION_FALIED;
free(blob_buf);
free(msg);
cJSON_Delete(root);
wifi_util_error_print(WIFI_CTRL, "%s: Failed to update connectedbuilding AVPs in Xfinity vaps \n", __func__);
return execRetVal;
wifi_util_error_print(WIFI_CTRL, "%s: Failed to update connectedbuilding AVPs in Xfinity vaps\n", __func__);
goto cleanup;
}

if (connected_wifi_enabled) {
wifi_util_info_print(WIFI_CTRL,"lnf_psk vaps are repurposed to managed_guest\n");
} else {
wifi_util_info_print(WIFI_CTRL,"managed_guest vaps are reverted back to lnf_psk\n");
}

wifi_util_info_print(WIFI_CTRL,"Managed guest blob is applied successfully \n");
execRetVal->ErrorCode = BLOB_EXEC_SUCCESS;

wifi_util_info_print(WIFI_CTRL,"Managed guest blob is applied successfuly \n");
cJSON_Delete(root); // don't need this anymore
cleanup:
cJSON_Delete(root);
if (amenities_blob != NULL) {
cJSON_Delete(amenities_blob);
}
if (vap_blob != NULL) {
cJSON_Delete(vap_blob);
}
if (xfinity_blob != NULL) {
cJSON_Delete(xfinity_blob);
}
free(blob_buf);
free(msg);
msgpack_zone_destroy(&msg_z);

execRetVal->ErrorCode = BLOB_EXEC_SUCCESS;
return execRetVal;
}

Expand Down
2 changes: 0 additions & 2 deletions source/db/wifi_db_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -3291,7 +3291,6 @@ int wifidb_update_ignite_config(ignite_config_t *ignite_cfg)
pcfg = onewifi_ovsdb_table_select_where(g_wifidb->wifidb_sock_path,
&table_Wifi_Ignite_Config,
where, &count);
if (where) { json_decref(where); where = NULL; }
if (pcfg && count > 0) {
memcpy(&cfg, pcfg, sizeof(cfg));
update = true;
Expand Down Expand Up @@ -3331,7 +3330,6 @@ int wifidb_update_ignite_config(ignite_config_t *ignite_cfg)
ret = onewifi_ovsdb_table_update_where(g_wifidb->wifidb_sock_path,
&table_Wifi_Ignite_Config,
where, &cfg);
if (where) { json_decref(where); where = NULL; }

if (ret <= 0) {
wifi_util_error_print(WIFI_CTRL, "%s:%d Update failed\n",
Expand Down
7 changes: 0 additions & 7 deletions source/webconfig/wifi_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2749,17 +2749,10 @@ webconfig_error_t encode_radio_channel_radio_params(wifi_provider_response_t *ch

radio_chan_data_t *chan_data = chan_stats->stat_pointer;

radio_stats_obj = cJSON_CreateObject();
if (radio_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d json object creation failed\n", __func__, __LINE__);
return webconfig_error_encode;
}

for (unsigned int count = 0; count < chan_stats->stat_array_size; count++) {
radio_stats_obj = cJSON_CreateObject();
if (radio_stats_obj == NULL) {
wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: json create object failed\n", __func__, __LINE__);
cJSON_Delete(radio_stats_obj);
return webconfig_error_encode;
}
cJSON_AddItemToArray(radio_stats, radio_stats_obj);
Expand Down
Loading