Skip to content
Merged
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
4 changes: 2 additions & 2 deletions source/core/wifi_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ bool get_notify_wifi_from_psm(char *PsmParamName)
if (rc == bus_error_success) {
strncpy(psm_notify_get, data.raw_data.bytes, (sizeof(psm_notify_get) - 1));
wifi_util_dbg_print(WIFI_CTRL, " PSMDB value=%s\n", psm_notify_get);
if ((psm_notify_get != NULL) && (strcmp(psm_notify_get, "true") == 0)) {
if (strcmp(psm_notify_get, "true") == 0) {
psm_notify_flag = true;
} else {
psm_notify_flag = false;
Expand Down Expand Up @@ -3242,7 +3242,7 @@ CHAR* getVAPName(UINT apIndex)
for (vapArrayIndex = 0; vapArrayIndex < getNumberVAPsPerRadio(radioIndex); vapArrayIndex++) {
if (apIndex == wifi_mgr->radio_config[radioIndex].vaps.vap_map.vap_array[vapArrayIndex].vap_index) {
//wifi_util_dbg_print(WIFI_CTRL, "%s Input apIndex = %d found at radioIndex = %d vapArrayIndex = %d\n ", __FUNCTION__, apIndex, radioIndex, vapArrayIndex);
if((wifi_mgr->radio_config[radioIndex].vaps.rdk_vap_array[vapArrayIndex].vap_name != NULL) && (strlen((CHAR *)wifi_mgr->radio_config[radioIndex].vaps.rdk_vap_array[vapArrayIndex].vap_name) != 0)) {
if (strlen((CHAR *)wifi_mgr->radio_config[radioIndex].vaps.rdk_vap_array[vapArrayIndex].vap_name) != 0) {
return (CHAR *)wifi_mgr->radio_config[radioIndex].vaps.rdk_vap_array[vapArrayIndex].vap_name;
} else {
return unused;
Expand Down
5 changes: 3 additions & 2 deletions source/core/wifi_ctrl_queue_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,8 @@ int dfs_nop_start_timer(void *args)

radarDetected_temp[sizeof(radarDetected_temp) - 1] = '\0';

if( !strcmp(radarDetected_temp, " ") || radarDetected_temp == NULL ) {
if (!strcmp(radarDetected_temp, " ") )
{
wifi_util_error_print(WIFI_CTRL, "%s:%d No radar detected \n", __func__, __LINE__);
return RETURN_ERR;
}
Expand Down Expand Up @@ -3063,7 +3064,7 @@ int dfs_nop_start_timer(void *args)
radio_channel_param.channelWidth = dfs_radar_ch_bw;
radio_channel_param.op_class = radio_params->operatingClass;

dfs_timer_secs = ((time_now - radar_detected_time)<(radio_params->DFSTimer * 60) && (time_now > radar_detected_time)) ? ( (radio_params->DFSTimer * 60) - (time_now - radar_detected_time)) : 0;
dfs_timer_secs = ((time_now - radar_detected_time) < ((long long)radio_params->DFSTimer * 60) && (time_now > radar_detected_time)) ? (((long long)radio_params->DFSTimer * 60) - (time_now - radar_detected_time)) : 0;
if(dfs_timer_secs == 0) {
update_db_radar_detected(radar_detected_ch_time);
update_wifi_radio_config(RADIO_INDEX_DFS, radio_params, radio_feat);
Expand Down
31 changes: 18 additions & 13 deletions source/db/wifi_db_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,6 @@ void callback_Wifi_Security_Config(ovsdb_update_monitor_t *mon,
}

pthread_mutex_lock(&g_wifidb->data_cache_lock);
l_security_cfg->mode = new_rec->security_mode;
l_security_cfg->mode = new_rec->security_mode_new;
l_security_cfg->encr = new_rec->encryption_method;

Expand Down Expand Up @@ -1713,7 +1712,7 @@ int wifidb_update_interworking_config(char *vap_name, wifi_InterworkingElement_t
}
wifi_util_dbg_print(WIFI_DB,"%s:%d: Found %d records with key: %s in Wifi VAP table\n",
__func__, __LINE__, count, vap_name);
strcpy(cfg.vap_name, vap_name);
snprintf(cfg.vap_name, sizeof(cfg.vap_name), "%s", vap_name);
cfg.enable = interworking->interworkingEnabled;
cfg.access_network_type = interworking->accessNetworkType;
cfg.internet = interworking->internetAvailable;
Expand Down Expand Up @@ -1844,7 +1843,6 @@ void wifidb_print_interworking_config ()
}

free(pcfg);
pcfg = NULL;
}
}
}
Expand Down Expand Up @@ -2348,12 +2346,12 @@ int wifidb_update_wifi_vap_config(int radio_index, wifi_vap_info_map_t *config,
uint8_t vap_index = 0;
char name[BUFFER_LENGTH_WIFIDB];

wifi_util_dbg_print(WIFI_DB,"%s:%d:VAP Config update for radio index=%d No of Vaps=%d\n",__func__, __LINE__,radio_index,config->num_vaps);
if((config == NULL) || (convert_radio_to_name(radio_index,name)!=0))
{
wifidb_print("%s:%d WIFI DB update error !!!. Failed to update Vap Config - Null pointer \n",__func__, __LINE__);
return -1;
}
wifi_util_dbg_print(WIFI_DB,"%s:%d:VAP Config update for radio index=%d No of Vaps=%d\n",__func__, __LINE__,radio_index,config->num_vaps);
for(i=0;i<config->num_vaps;i++)
{
wifidb_print("%s:%d Updated WIFI DB. vap Config updated successful for radio %s and vap_name %s. \n",__func__, __LINE__,name,config->vap_array[i].vap_name);
Expand Down Expand Up @@ -2874,7 +2872,7 @@ int wifidb_update_preassoc_ctrl_config(char *vap_name, wifi_preassoc_control_t *
return -1;
}

strcpy(cfg.vap_name, vap_name);
snprintf(cfg.vap_name, sizeof(cfg.vap_name), "%s", vap_name);
strcpy(cfg.rssi_up_threshold, preassoc->rssi_up_threshold);
strcpy(cfg.snr_threshold, preassoc->snr_threshold);
strcpy(cfg.cu_threshold, preassoc->cu_threshold);
Expand Down Expand Up @@ -2960,7 +2958,7 @@ int wifidb_update_postassoc_ctrl_config(char *vap_name, wifi_postassoc_control_t
return -1;
}

strcpy(cfg.vap_name, vap_name);
snprintf(cfg.vap_name, sizeof(cfg.vap_name), "%s", vap_name);
strcpy(cfg.rssi_up_threshold, postassoc->rssi_up_threshold);
strcpy(cfg.sampling_interval, postassoc->sampling_interval);
strcpy(cfg.snr_threshold, postassoc->snr_threshold);
Expand Down Expand Up @@ -3357,7 +3355,7 @@ int wifidb_get_wifi_global_config(wifi_global_param_t *config)
config->force_disable_radio_status = pcfg->force_disable_radio_status;
config->fixed_wmm_params = pcfg->fixed_wmm_params;
if (strlen(pcfg->wifi_region_code) != 0) {
strncpy(config->wifi_region_code,pcfg->wifi_region_code,sizeof(config->wifi_region_code)-1);
snprintf(config->wifi_region_code, sizeof(config->wifi_region_code), "%s", pcfg->wifi_region_code);
}
config->diagnostic_enable = pcfg->diagnostic_enable;
config->validate_ssid = pcfg->validate_ssid;
Expand Down Expand Up @@ -4716,7 +4714,7 @@ static void wifidb_radio_config_upgrade(unsigned int index, wifi_radio_operation
wifi_mgr_t *g_wifidb = get_wifimgr_obj();
unsigned int total_radios = getNumberRadios();

if (index < 0 || index >= total_radios)
if (index >= total_radios)
{
wifi_util_error_print(WIFI_DB,"%s:%d Invalid radio index\n", __func__, __LINE__);
return;
Expand Down Expand Up @@ -6383,6 +6381,7 @@ int wifidb_update_wifi_macfilter_config(char *macfilter_key, acl_entry_t *config
char *vap_name = NULL;
json_t *where;
int ret = 0;
int vap_index = -1;
rdk_wifi_vap_info_t *l_rdk_vap_array = NULL;
wifi_mac_entry_param_t l_mac_entry;
memset(&l_mac_entry, 0, sizeof(l_mac_entry));
Expand All @@ -6394,7 +6393,12 @@ int wifidb_update_wifi_macfilter_config(char *macfilter_key, acl_entry_t *config
if (!add) {
where = onewifi_ovsdb_tran_cond(OCLM_STR, "macfilter_key", OFUNC_EQ, macfilter_key);
ret = onewifi_ovsdb_table_delete_where(g_wifidb->wifidb_sock_path, &table_Wifi_MacFilter_Config, where);
l_mac_entry.vap_index = convert_vap_name_to_index(&((wifi_mgr_t*) get_wifimgr_obj())->hal_cap.wifi_prop, vap_name);
vap_index = convert_vap_name_to_index(&((wifi_mgr_t*) get_wifimgr_obj())->hal_cap.wifi_prop, vap_name);
if (vap_index == -1) {
wifi_util_dbg_print(WIFI_DB,"%s:%d: Unable to get vap index for vap_name %s\n", __func__, __LINE__, vap_name);
return -1;
}
l_mac_entry.vap_index = (unsigned char) vap_index;
wifidb_print("%s:%d vap_name:%s key:%s\n",__func__, __LINE__, vap_name, macfilter_key);
memset(tmp_mac_str, 0, sizeof(tmp_mac_str));
to_mac_str(config->mac, tmp_mac_str);
Expand Down Expand Up @@ -6434,11 +6438,12 @@ int wifidb_update_wifi_macfilter_config(char *macfilter_key, acl_entry_t *config
snprintf(cfg_mac.macfilter_key, sizeof(cfg_mac.macfilter_key), "%s", macfilter_key);
wifi_util_dbg_print(WIFI_DB,"%s:%d: updating table wifi_macfilter_config table entry is device_mac %s, device_name %s,macfilter_key %s reason %d and expiry_time %d\n", __func__, __LINE__, cfg_mac.device_mac, cfg_mac.device_name, cfg_mac.macfilter_key,cfg_mac.reason,cfg_mac.expiry_time);

l_mac_entry.vap_index = convert_vap_name_to_index(&((wifi_mgr_t*) get_wifimgr_obj())->hal_cap.wifi_prop, vap_name);
if (l_mac_entry.vap_index == -1) {
vap_index = convert_vap_name_to_index(&((wifi_mgr_t*) get_wifimgr_obj())->hal_cap.wifi_prop, vap_name);
if (vap_index == -1) {
wifi_util_dbg_print(WIFI_DB,"%s:%d: Unable to get vap index for vap_name %s\n", __func__, __LINE__, vap_name);
return -1;
}
l_mac_entry.vap_index = (unsigned char) vap_index;
l_rdk_vap_array = get_wifidb_rdk_vap_info(l_mac_entry.vap_index);
if (l_rdk_vap_array == NULL) {
wifi_util_dbg_print(WIFI_DB,"%s:%d: Unable to find vap_array for vap_index %d\n", __func__, __LINE__, l_mac_entry.vap_index);
Expand Down Expand Up @@ -8759,7 +8764,7 @@ void get_psm_mac_list_entry(unsigned int instance_number, char *l_vap_name, unsi
snprintf(recName, sizeof(recName), MacFilterDevice, instance_number, index);
str = p_ccsp_desc->psm_get_value_fn(recName, strValue, sizeof(strValue));
if (str != NULL) {
strcpy(temp_psm_mac_param->device_name, str);
snprintf(temp_psm_mac_param->device_name, sizeof(temp_psm_mac_param->device_name), "%s", str);
wifi_util_dbg_print(WIFI_MGR,"psm get device_name is %s\r\n", str);
} else {
wifi_util_dbg_print(WIFI_MGR,"[Failure] psm record_name: %s\n", recName);
Expand Down Expand Up @@ -8981,7 +8986,7 @@ int get_vap_params_from_psm(unsigned int vap_index, wifi_vap_info_t *vap_config,
snprintf(recName, sizeof(recName), BeaconRateCtl, instance_number);
str = p_ccsp_desc->psm_get_value_fn(recName, strValue, sizeof(strValue));
if (str != NULL) {
strcpy(bss_cfg->beaconRateCtl,str);
snprintf(bss_cfg->beaconRateCtl, sizeof(bss_cfg->beaconRateCtl), "%s", str);
wifi_util_dbg_print(WIFI_MGR,"bss_cfg->beaconRateCtl is %s and str is %s \r\n", bss_cfg->beaconRateCtl, str);
} else {
wifi_util_dbg_print(WIFI_MGR,"%s:%d str value for beaconRateCtl:%s \r\n", __func__, __LINE__, str);
Expand Down
6 changes: 3 additions & 3 deletions source/dml/tr_181/ml/cosa_apis_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ CosaUtilGetIfAddr
struct ifreq ifr;
int fd = 0;

strcpy(ifr.ifr_name, netdev);
snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), "%s", netdev);

if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0)
{
Expand Down Expand Up @@ -264,7 +264,7 @@ CosaUtilGetLowerLayers

while ((pTableStringToken = AnscTcUnlinkToken(pTableListTokenChain)))
{
if ( pTableStringToken->Name )
if ( pTableStringToken->Name[0] != '\0' )
{
if ( AnscEqualString(pTableStringToken->Name, "Device.Ethernet.Interface.", TRUE ) )
{
Expand Down Expand Up @@ -527,7 +527,7 @@ CosaUtilGetFullPathNameByKeyword

while ((pTableStringToken = AnscTcUnlinkToken(pTableListTokenChain)))
{
if ( pTableStringToken->Name )
if ( pTableStringToken->Name[0] != '\0' )
{
/* Get the string XXXNumberOfEntries */
pString2 = (PUCHAR)&pTableStringToken->Name[0];
Expand Down
6 changes: 3 additions & 3 deletions source/dml/tr_181/ml/cosa_harvester_dml.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ ActiveMeasurements_Plan_SetParamStringValue
}
else {
AnscTraceWarning(("%s : Plan ID is not same\n", __func__));
strncpy((char*)pcfg->PlanId, pValue, strlen(pValue));
snprintf((char*)pcfg->PlanId, sizeof(pcfg->PlanId), "%s", pValue);
/* Reset all the step information when plan id changes */
if (ANSC_STATUS_SUCCESS != CosaDmlWiFiClient_ResetActiveMsmtStep(pcfg)) {
AnscTraceWarning(("%s : resetting Active measurement Step Information failed\n", __FUNCTION__));
Expand Down Expand Up @@ -982,13 +982,13 @@ ActiveMeasurement_Step_SetParamStringValue
}

if (AnscEqualString(ParamName, "SourceMac", TRUE)) {
strcpy( (char*)pcfg->Step[StepIns].SrcMac,pValue);
snprintf((char*)pcfg->Step[StepIns].SrcMac, sizeof(pcfg->Step[StepIns].SrcMac), "%s", pValue);
wifi_util_dbg_print(WIFI_DMCLI,"%s:%d \n",(char*)pcfg->Step[StepIns].SrcMac ,StepIns);
return TRUE;
}

if (AnscEqualString(ParamName, "DestMac", TRUE)) {
strcpy((char*) pcfg->Step[StepIns].DestMac,pValue);
snprintf((char*)pcfg->Step[StepIns].DestMac, sizeof(pcfg->Step[StepIns].DestMac), "%s", pValue);
wifi_util_dbg_print(WIFI_DMCLI,"%s:%d \n",(char*)pcfg->Step[StepIns].DestMac ,StepIns);
return TRUE;
}
Expand Down
Loading
Loading