Fix probable segfaults and dual stack improvements

This commit is contained in:
Suvendhu Hansa 2023-06-14 08:56:03 +00:00 committed by Vivek Kumar Dutta
parent 1282569ce4
commit 6293f933dc
4 changed files with 35 additions and 15 deletions

View file

@ -574,8 +574,10 @@ void icwmp_free(void *m)
return;
struct cwmp_mem *rm;
rm = container_of(m, struct cwmp_mem, mem);
list_del(&rm->list);
free(rm);
if (rm != NULL) {
list_del(&rm->list);
free(rm);
}
}
void icwmp_cleanmem()
@ -583,8 +585,10 @@ void icwmp_cleanmem()
struct cwmp_mem *mem;
while (cwmp_memory_list.next != &cwmp_memory_list) {
mem = list_entry(cwmp_memory_list.next, struct cwmp_mem, list);
list_del(&mem->list);
free(mem);
if (mem != NULL) {
list_del(&mem->list);
free(mem);
}
}
}

View file

@ -22,6 +22,7 @@
#include "ssl_utils.h"
#include "datamodel_interface.h"
#include "heartbeat.h"
#include "cwmp_http.h"
pthread_mutex_t mutex_config_load = PTHREAD_MUTEX_INITIALIZER;
@ -628,14 +629,33 @@ end:
void cwmp_config_load()
{
int ret;
int ret = CWMP_GEN_ERR;
int error = CWMP_GEN_ERR;
ret = global_conf_init();
while (ret != CWMP_OK && cwmp_stop != true) {
CWMP_LOG(DEBUG, "Error reading uci ret = %d", ret);
if (cwmp_stop == true)
return;
if (ret == CWMP_OK) {
cwmp_main->net.ipv6_status = is_ipv6_enabled();
error = icwmp_check_http_connection();
}
while (error != CWMP_OK && cwmp_stop != true) {
if (ret != CWMP_OK) {
CWMP_LOG(DEBUG, "Error reading uci ret = %d", ret);
} else {
CWMP_LOG(DEBUG, "Init: failed to check http connection");
}
sleep(UCI_OPTION_READ_INTERVAL);
cwmp_uci_reinit();
ret = global_conf_init();
if (ret == CWMP_OK) {
cwmp_main->net.ipv6_status = is_ipv6_enabled();
error = icwmp_check_http_connection();
}
}
}

View file

@ -283,13 +283,6 @@ static int cwmp_init(void)
INIT_LIST_HEAD(&du_uuid_list);
cwmp_main->start_time = time(NULL);
cwmp_main->net.ipv6_status = is_ipv6_enabled();
error = icwmp_check_http_connection();
if (error != CWMP_OK) {
CWMP_LOG(DEBUG, "Init: failed to check http connection");
return error;
}
cwmp_uci_exit();
return CWMP_OK;

View file

@ -334,8 +334,11 @@ void start_cwmp_session()
return;
}
if (cwmp_main->session->session_status.last_status == SESSION_FAILURE)
if (cwmp_main->session->session_status.last_status == SESSION_FAILURE) {
cwmp_uci_reinit();
cwmp_config_load();
cwmp_uci_exit();
}
if (is_ipv6_status_changed()) {
if (icwmp_check_http_connection() != CWMP_OK || cwmp_stop) {