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
22 changes: 15 additions & 7 deletions source/db/wifi_db_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ extern const char* get_passpoint_json_by_vap_name(const char* vap_name);
extern const char* get_anqp_json_by_vap_name(const char* vap_name);
extern void reset_passpoint_json(const char* vap_name);
extern void reset_anqp_json(const char* vap_name);
extern int get_wifi_last_reboot_reason_psm_value(char *last_reboot_reason);
extern int get_wifi_last_reboot_reason_psm_value(char *last_reboot_reason, size_t len);

void wifidb_reset_macfilter_hashmap()
{
Expand Down Expand Up @@ -5520,10 +5520,12 @@ void *start_wifidb_func(void *arg)
get_bus_descriptor()->bus_data_free_fn(&data);
return NULL;
}
strncpy(last_reboot_reason, (char *)data.raw_data.bytes, data.raw_data_len);
strncpy(last_reboot_reason, (char *)data.raw_data.bytes,
sizeof(last_reboot_reason) - 1);
last_reboot_reason[sizeof(last_reboot_reason) - 1] = '\0';
get_bus_descriptor()->bus_data_free_fn(&data);
} else {
get_wifi_last_reboot_reason_psm_value(last_reboot_reason);
get_wifi_last_reboot_reason_psm_value(last_reboot_reason, sizeof(last_reboot_reason));
}
wifi_util_info_print(WIFI_DB, "%s:%d last_reboot_reason:%s \n", __func__, __LINE__,
last_reboot_reason);
Expand Down Expand Up @@ -9741,19 +9743,25 @@ int get_wifi_db_psm_enable_status(bool *wifi_psm_db_enabled)
return RETURN_OK;
}

int get_wifi_last_reboot_reason_psm_value(char *last_reboot_reason)
int get_wifi_last_reboot_reason_psm_value(char *last_reboot_reason, size_t len)
{
char *str = NULL;
char strValue[256] = {0};
wifi_ccsp_desc_t *p_ccsp_desc = &get_wificcsp_obj()->desc;

if (last_reboot_reason == NULL || len == 0)
{
wifi_util_error_print(WIFI_MGR, "%s:%d Invalid parameters\n", __func__, __LINE__);
return RETURN_ERR;
}

memset(strValue, 0, sizeof(strValue));
str = p_ccsp_desc->psm_get_value_fn(LAST_REBOOT_REASON_NAMESPACE, strValue, sizeof(strValue));
if (str != NULL) {
strcpy(last_reboot_reason, str);
snprintf(last_reboot_reason, len, "%s", str);
wifi_util_dbg_print(WIFI_MGR,"str is %s and last_reboot_reason is %s\n", str, last_reboot_reason);
} else {
wifi_util_error_print(WIFI_MGR,"%s:%d last_reboot_reason:%s \r\n", __func__, __LINE__, last_reboot_reason);
wifi_util_error_print(WIFI_MGR,"%s:%d PSM get value returned NULL\n", __func__, __LINE__);
return RETURN_ERR;
}

Expand Down Expand Up @@ -9811,7 +9819,7 @@ int get_all_param_from_psm_and_set_into_db(void)
}
} else {
get_wifi_db_psm_enable_status(&wifi_psm_db_enabled);
get_wifi_last_reboot_reason_psm_value(last_reboot_reason);
get_wifi_last_reboot_reason_psm_value(last_reboot_reason, sizeof(last_reboot_reason));
}

wifi_util_info_print(WIFI_MGR, "%s psm:%d last_reboot_reason:%s \n", __func__,
Expand Down
2 changes: 1 addition & 1 deletion source/dml/tr_181/ml/cosa_wifi_dml.c
Original file line number Diff line number Diff line change
Expand Up @@ -8667,7 +8667,7 @@ Security_GetParamStringValue
/* collect value */
char buf[32] = {0};
if ( AnscSizeOfString(buf) < *pUlSize) {
getSecurityStringFromInt(pcfg->mode, buf);
getSecurityStringFromInt(pcfg->mode, buf, sizeof(buf));
AnscCopyString(pValue, buf);
} else {
*pUlSize = AnscSizeOfString(buf) + 1;
Comment thread
bharathivelp marked this conversation as resolved.
Expand Down
23 changes: 18 additions & 5 deletions source/dml/tr_181/sbapi/cosa_wifi_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,21 +432,34 @@ INT getTxDataRateFromInt(wifi_bitrate_t DataTxRate, char *DataTxRateStr)
return 0;
}

INT getSecurityStringFromInt(wifi_security_modes_t securityType, char *securityName)
INT getSecurityStringFromInt(wifi_security_modes_t securityType, char *securityName, size_t bufSize)
{
Comment thread
bharathivelp marked this conversation as resolved.
Comment thread
bharathivelp marked this conversation as resolved.
unsigned int i;
size_t currentLen;

if (securityName == NULL || bufSize == 0)
{
CcspWifiTrace(("RDK_LOG_ERROR, %s Invalid argument\n", __func__));
return 0;
}

for (i = 0 ; i < ARRAY_SZ(wifiSecMap) ; ++i)
{
if(securityType == wifiSecMap[i].halSecCfgMethod)
{
if (AnscSizeOfString(securityName) != 0)
currentLen = AnscSizeOfString(securityName);
if (currentLen != 0)
{
strcat(securityName, ",");
strcat(securityName, wifiSecMap[i].wifiSecType);
if (currentLen >= bufSize)
{
CcspWifiTrace(("RDK_LOG_ERROR, %s buffer full, cannot append security type\n", __func__));
break;
}
snprintf(securityName + currentLen, bufSize - currentLen, ",%s", wifiSecMap[i].wifiSecType);
}
Comment thread
bharathivelp marked this conversation as resolved.
else
{
strcpy(securityName, wifiSecMap[i].wifiSecType);
snprintf(securityName, bufSize, "%s", wifiSecMap[i].wifiSecType);
}
}
}
Expand Down
Loading