mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Static code fixes
This commit is contained in:
parent
9bd32215e6
commit
14bfffafc3
20 changed files with 69 additions and 65 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -35,3 +35,5 @@ missing
|
||||||
/ltmain.sh
|
/ltmain.sh
|
||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
|
/icwmpd
|
||||||
|
/Makefile
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ include:
|
||||||
variables:
|
variables:
|
||||||
DEBUG: 'TRUE'
|
DEBUG: 'TRUE'
|
||||||
COMMON_IMAGE: "iopsys/code-analysis:0.25"
|
COMMON_IMAGE: "iopsys/code-analysis:0.25"
|
||||||
|
RUN_CPPCHECK: "cppcheck --enable=all --inline-suppr --include=/usr/include/uci.h --suppress=unusedFunction -i ./test/"
|
||||||
SOURCE_FOLDER: "."
|
SOURCE_FOLDER: "."
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ int get_bkp_attribute_index_type(char *name)
|
||||||
void load_specific_backup_attributes(mxml_node_t *tree, struct backup_attributes *bkp_attrs)
|
void load_specific_backup_attributes(mxml_node_t *tree, struct backup_attributes *bkp_attrs)
|
||||||
{
|
{
|
||||||
mxml_node_t *b = tree, *c;
|
mxml_node_t *b = tree, *c;
|
||||||
int idx = -1;
|
int idx;
|
||||||
void **ptr;
|
void **ptr;
|
||||||
|
|
||||||
b = mxmlWalkNext(b, tree, MXML_DESCEND);
|
b = mxmlWalkNext(b, tree, MXML_DESCEND);
|
||||||
|
|
@ -213,7 +213,7 @@ mxml_node_t *bkp_session_node_found(mxml_node_t *tree, char *name, struct search
|
||||||
if (c->type == MXML_ELEMENT && strcmp(keys[i].name, c->value.element.name) == 0) {
|
if (c->type == MXML_ELEMENT && strcmp(keys[i].name, c->value.element.name) == 0) {
|
||||||
d = c;
|
d = c;
|
||||||
d = mxmlWalkNext(d, c, MXML_DESCEND);
|
d = mxmlWalkNext(d, c, MXML_DESCEND);
|
||||||
if ((keys[i].value == NULL) || (d && d->type == MXML_OPAQUE && keys[i].value != NULL && strcmp(keys[i].value, d->value.opaque) == 0))
|
if ((keys[i].value == NULL) || (d && d->type == MXML_OPAQUE && STRCMP(keys[i].value, d->value.opaque) == 0))
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
c = mxmlWalkNext(c, b, MXML_NO_DESCEND);
|
c = mxmlWalkNext(c, b, MXML_NO_DESCEND);
|
||||||
|
|
@ -521,7 +521,7 @@ void bkp_session_delete_apply_schedule_download(struct apply_schedule_download *
|
||||||
|
|
||||||
void bkp_session_insert_change_du_state(struct change_du_state *pchange_du_state)
|
void bkp_session_insert_change_du_state(struct change_du_state *pchange_du_state)
|
||||||
{
|
{
|
||||||
struct operations *p;
|
struct operations *p = NULL;
|
||||||
char schedule_time[128];
|
char schedule_time[128];
|
||||||
mxml_node_t *b, *n;
|
mxml_node_t *b, *n;
|
||||||
|
|
||||||
|
|
@ -663,7 +663,7 @@ void bkp_session_delete_upload(struct upload *pupload)
|
||||||
void bkp_session_insert_du_state_change_complete(struct du_state_change_complete *pdu_state_change_complete)
|
void bkp_session_insert_du_state_change_complete(struct du_state_change_complete *pdu_state_change_complete)
|
||||||
{
|
{
|
||||||
char schedule_time[128], resolved[8], fault_code[8];
|
char schedule_time[128], resolved[8], fault_code[8];
|
||||||
struct opresult *p;
|
struct opresult *p = NULL;
|
||||||
mxml_node_t *b;
|
mxml_node_t *b;
|
||||||
|
|
||||||
pthread_mutex_lock(&mutex_backup_session);
|
pthread_mutex_lock(&mutex_backup_session);
|
||||||
|
|
@ -800,6 +800,7 @@ void load_queue_event(mxml_node_t *tree, struct cwmp *cwmp)
|
||||||
while (b) {
|
while (b) {
|
||||||
if (b->type == MXML_ELEMENT) {
|
if (b->type == MXML_ELEMENT) {
|
||||||
if (strcmp(b->value.element.name, "command_key") == 0) {
|
if (strcmp(b->value.element.name, "command_key") == 0) {
|
||||||
|
// cppcheck-suppress knownConditionTrueFalse
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
if (EVENT_CONST[idx].RETRY & EVENT_RETRY_AFTER_REBOOT) {
|
if (EVENT_CONST[idx].RETRY & EVENT_RETRY_AFTER_REBOOT) {
|
||||||
event_container_save = cwmp_add_event_container(cwmp, idx, ((command_key != NULL) ? command_key : ""));
|
event_container_save = cwmp_add_event_container(cwmp, idx, ((command_key != NULL) ? command_key : ""));
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
AC_INIT([icwmp], [0.1], [mohamed.kallel@pivasoftware.com])
|
AC_INIT([icwmp], [1.0], [dev@iopsys.eu])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
AC_CONFIG_SRCDIR([cwmp.c])
|
AC_CONFIG_SRCDIR([cwmp.c])
|
||||||
|
|
||||||
|
|
|
||||||
10
cwmp.c
10
cwmp.c
|
|
@ -325,7 +325,7 @@ int run_session_end_func(void)
|
||||||
|
|
||||||
static void cwmp_schedule_session(struct cwmp *cwmp)
|
static void cwmp_schedule_session(struct cwmp *cwmp)
|
||||||
{
|
{
|
||||||
int t, error = CWMP_OK;
|
int t;
|
||||||
struct timespec time_to_wait = { 0, 0 };
|
struct timespec time_to_wait = { 0, 0 };
|
||||||
bool retry = false;
|
bool retry = false;
|
||||||
char *exec_download = NULL;
|
char *exec_download = NULL;
|
||||||
|
|
@ -335,6 +335,7 @@ static void cwmp_schedule_session(struct cwmp *cwmp)
|
||||||
while (1) {
|
while (1) {
|
||||||
struct list_head *ilist;
|
struct list_head *ilist;
|
||||||
struct session *session;
|
struct session *session;
|
||||||
|
int error;
|
||||||
|
|
||||||
pthread_mutex_lock(&(cwmp->mutex_session_send));
|
pthread_mutex_lock(&(cwmp->mutex_session_send));
|
||||||
ilist = (&(cwmp->head_session_queue))->next;
|
ilist = (&(cwmp->head_session_queue))->next;
|
||||||
|
|
@ -460,15 +461,14 @@ void load_forced_inform_json_file(struct cwmp *cwmp)
|
||||||
const struct blobmsg_policy p[1] = { { "forced_inform", BLOBMSG_TYPE_ARRAY } };
|
const struct blobmsg_policy p[1] = { { "forced_inform", BLOBMSG_TYPE_ARRAY } };
|
||||||
struct blob_attr *tb[1] = { NULL };
|
struct blob_attr *tb[1] = { NULL };
|
||||||
blobmsg_parse(p, 1, tb, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head));
|
blobmsg_parse(p, 1, tb, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head));
|
||||||
if (!tb[0])
|
if (tb[0] == NULL) {
|
||||||
return;
|
|
||||||
custom_forced_inform_list = tb[0];
|
|
||||||
if (custom_forced_inform_list == NULL) {
|
|
||||||
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a forced inform parameters list", cwmp->conf.custom_notify_json);
|
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a forced inform parameters list", cwmp->conf.custom_notify_json);
|
||||||
blob_buf_free(&bbuf);
|
blob_buf_free(&bbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
custom_forced_inform_list = tb[0];
|
||||||
|
|
||||||
blobmsg_for_each_attr(cur, custom_forced_inform_list, rem)
|
blobmsg_for_each_attr(cur, custom_forced_inform_list, rem)
|
||||||
{
|
{
|
||||||
char parameter_path[128];
|
char parameter_path[128];
|
||||||
|
|
|
||||||
13
cwmp_uci.c
13
cwmp_uci.c
|
|
@ -323,7 +323,7 @@ int uci_set_value_by_path(char *path, char *value, uci_config_paths uci_type)
|
||||||
CWMP_LOG(ERROR, "UCI delete not succeed %s", path);
|
CWMP_LOG(ERROR, "UCI delete not succeed %s", path);
|
||||||
return UCI_ERR_NOTFOUND;
|
return UCI_ERR_NOTFOUND;
|
||||||
}
|
}
|
||||||
return UCI_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cwmp_uci_set_value_by_path(char *path, char *value)
|
int cwmp_uci_set_value_by_path(char *path, char *value)
|
||||||
|
|
@ -499,7 +499,7 @@ int uci_add_list_value(char *cmd, uci_config_paths uci_type)
|
||||||
CWMP_LOG(ERROR, "UCI delete not succeed %s", cmd);
|
CWMP_LOG(ERROR, "UCI delete not succeed %s", cmd);
|
||||||
return UCI_ERR_NOTFOUND;
|
return UCI_ERR_NOTFOUND;
|
||||||
}
|
}
|
||||||
return UCI_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -587,7 +587,7 @@ int uci_delete_value(char *path, int uci_type)
|
||||||
CWMP_LOG(ERROR, "UCI delete not succeed %s", path);
|
CWMP_LOG(ERROR, "UCI delete not succeed %s", path);
|
||||||
return CWMP_GEN_ERR;
|
return CWMP_GEN_ERR;
|
||||||
}
|
}
|
||||||
return CWMP_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cwmp_uci_get_section_type(char *package, char *section, uci_config_paths uci_type, char **value)
|
int cwmp_uci_get_section_type(char *package, char *section, uci_config_paths uci_type, char **value)
|
||||||
|
|
@ -742,12 +742,15 @@ int cwmp_uci_export(const char *output_path, uci_config_paths uci_type)
|
||||||
char **configs = NULL;
|
char **configs = NULL;
|
||||||
char **p;
|
char **p;
|
||||||
|
|
||||||
if ((uci_list_configs(uci_save_conf_paths[uci_type].uci_ctx, &configs) != UCI_OK) || !configs)
|
if (uci_list_configs(uci_save_conf_paths[uci_type].uci_ctx, &configs) != UCI_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (configs == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
for (p = configs; *p; p++)
|
for (p = configs; *p; p++)
|
||||||
cwmp_uci_export_package(*p, output_path, uci_type);
|
cwmp_uci_export_package(*p, output_path, uci_type);
|
||||||
|
|
||||||
free(configs);
|
FREE(configs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ void *thread_cwmp_rpc_cpe_download(void *v)
|
||||||
struct download *pdownload;
|
struct download *pdownload;
|
||||||
struct timespec download_timeout = { 0, 0 };
|
struct timespec download_timeout = { 0, 0 };
|
||||||
time_t current_time, stime;
|
time_t current_time, stime;
|
||||||
int error = FAULT_CPE_NO_FAULT;
|
int error;
|
||||||
struct transfer_complete *ptransfer_complete;
|
struct transfer_complete *ptransfer_complete;
|
||||||
long int time_of_grace = 3600, timeout;
|
long int time_of_grace = 3600, timeout;
|
||||||
|
|
||||||
|
|
|
||||||
4
event.c
4
event.c
|
|
@ -386,7 +386,7 @@ void *thread_event_periodic(void *v)
|
||||||
|
|
||||||
bool event_exist_in_list(struct cwmp *cwmp, int event)
|
bool event_exist_in_list(struct cwmp *cwmp, int event)
|
||||||
{
|
{
|
||||||
struct event_container *event_container;
|
struct event_container *event_container = NULL;
|
||||||
list_for_each_entry (event_container, cwmp->head_event_container, list) {
|
list_for_each_entry (event_container, cwmp->head_event_container, list) {
|
||||||
if (event_container->code == event)
|
if (event_container->code == event)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -507,7 +507,7 @@ int cwmp_root_cause_events(struct cwmp *cwmp)
|
||||||
return CWMP_OK;
|
return CWMP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cwmp_get_int_event_code(char *code)
|
int cwmp_get_int_event_code(const char *code)
|
||||||
{
|
{
|
||||||
if (code && code[0] == '1')
|
if (code && code[0] == '1')
|
||||||
return EVENT_IDX_1BOOT;
|
return EVENT_IDX_1BOOT;
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@
|
||||||
#define FIREWALL_CWMP "/etc/firewall.cwmp"
|
#define FIREWALL_CWMP "/etc/firewall.cwmp"
|
||||||
#define CWMP_VARSTATE_UCI_PACKAGE "/var/state/cwmp"
|
#define CWMP_VARSTATE_UCI_PACKAGE "/var/state/cwmp"
|
||||||
|
|
||||||
|
#define STRCMP(S1, S2) ((S1 != NULL && S2 != NULL) ? strcmp(S1, S2) : -1)
|
||||||
extern char *commandKey;
|
extern char *commandKey;
|
||||||
extern bool thread_end;
|
extern bool thread_end;
|
||||||
extern bool signal_exit;
|
extern bool signal_exit;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ void cwmp_save_event_container(struct event_container *event_container);
|
||||||
void *thread_event_periodic(void *v);
|
void *thread_event_periodic(void *v);
|
||||||
void connection_request_ip_value_change(struct cwmp *cwmp, int version);
|
void connection_request_ip_value_change(struct cwmp *cwmp, int version);
|
||||||
void connection_request_port_value_change(struct cwmp *cwmp, int port);
|
void connection_request_port_value_change(struct cwmp *cwmp, int port);
|
||||||
int cwmp_get_int_event_code(char *code);
|
int cwmp_get_int_event_code(const char *code);
|
||||||
bool event_exist_in_list(struct cwmp *cwmp, int event);
|
bool event_exist_in_list(struct cwmp *cwmp, int event);
|
||||||
int cwmp_root_cause_events(struct cwmp *cwmp);
|
int cwmp_root_cause_events(struct cwmp *cwmp);
|
||||||
int cwmp_root_cause_transfer_complete(struct cwmp *cwmp, struct transfer_complete *p);
|
int cwmp_root_cause_transfer_complete(struct cwmp *cwmp, struct transfer_complete *p);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#define ARRAY_MAX 8
|
#define ARRAY_MAX 8
|
||||||
|
|
||||||
extern struct ubus_context *ubus_ctx;
|
|
||||||
int cwmp_ubus_init(struct cwmp *cwmp);
|
int cwmp_ubus_init(struct cwmp *cwmp);
|
||||||
void cwmp_ubus_exit(void);
|
void cwmp_ubus_exit(void);
|
||||||
|
|
||||||
|
|
|
||||||
2
log.c
2
log.c
|
|
@ -129,7 +129,7 @@ void puts_log(int severity, const char *fmt, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
i += vsprintf(buf + i, (const char *)fmt, args);
|
vsprintf(buf + i, (const char *)fmt, args);
|
||||||
if (enable_log_file) {
|
if (enable_log_file) {
|
||||||
CWMP_STRNCPY(buf_file, buf, sizeof(buf_file));
|
CWMP_STRNCPY(buf_file, buf, sizeof(buf_file));
|
||||||
buf_file[strlen(buf)] = '\n';
|
buf_file[strlen(buf)] = '\n';
|
||||||
|
|
|
||||||
2
md5.c
2
md5.c
|
|
@ -54,7 +54,7 @@ static void byteReverse(unsigned char *buf, unsigned longs)
|
||||||
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
* reflect the addition of 16 longwords of new data. MD5Update blocks
|
||||||
* the data and converts bytes into longwords for this routine.
|
* the data and converts bytes into longwords for this routine.
|
||||||
*/
|
*/
|
||||||
static void md5_transform(uint32_t buf[4], uint32_t in[16])
|
static void md5_transform(uint32_t buf[4], const uint32_t in[16])
|
||||||
{
|
{
|
||||||
uint32_t a, b, c, d;
|
uint32_t a, b, c, d;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,7 @@ char *cwmp_get_parameter_attributes(char *parameter_name, struct list_head *para
|
||||||
bool parameter_is_other_notif_object_child(char *parent, char *parameter)
|
bool parameter_is_other_notif_object_child(char *parent, char *parameter)
|
||||||
{
|
{
|
||||||
struct list_head list_iter, *list_ptr;
|
struct list_head list_iter, *list_ptr;
|
||||||
|
// cppcheck-suppress unreadVariable
|
||||||
list_iter.next = list_param_obj_notify.next;
|
list_iter.next = list_param_obj_notify.next;
|
||||||
list_iter.prev = list_param_obj_notify.prev;
|
list_iter.prev = list_param_obj_notify.prev;
|
||||||
struct cwmp_dm_parameter *dm_parameter = NULL;
|
struct cwmp_dm_parameter *dm_parameter = NULL;
|
||||||
|
|
@ -318,7 +319,7 @@ char* updated_list_param_leaf_notify_with_sub_parameter_list(struct list_head *l
|
||||||
|
|
||||||
void create_list_param_leaf_notify(struct list_head *list_param_leaf_notify, void (*update_notify_file_line_arg)(FILE *notify_file, char *param_name, char *param_type, char *param_value, int notification), FILE* notify_file_arg)
|
void create_list_param_leaf_notify(struct list_head *list_param_leaf_notify, void (*update_notify_file_line_arg)(FILE *notify_file, char *param_name, char *param_type, char *param_value, int notification), FILE* notify_file_arg)
|
||||||
{
|
{
|
||||||
struct cwmp_dm_parameter *param_iter;
|
struct cwmp_dm_parameter *param_iter = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < (int)ARRAY_SIZE(forced_notifications_parameters); i++)
|
for (i = 0; i < (int)ARRAY_SIZE(forced_notifications_parameters); i++)
|
||||||
|
|
@ -411,18 +412,14 @@ void load_custom_notify_json(struct cwmp *cwmp)
|
||||||
const struct blobmsg_policy p_notif[1] = { { "custom_notification", BLOBMSG_TYPE_ARRAY } };
|
const struct blobmsg_policy p_notif[1] = { { "custom_notification", BLOBMSG_TYPE_ARRAY } };
|
||||||
struct blob_attr *tb_notif[1] = { NULL};
|
struct blob_attr *tb_notif[1] = { NULL};
|
||||||
blobmsg_parse(p_notif, 1, tb_notif, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head));
|
blobmsg_parse(p_notif, 1, tb_notif, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head));
|
||||||
if (!tb_notif[0]) {
|
if (tb_notif[0] == NULL) {
|
||||||
creat(NOTIFY_FILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
custom_notify_list = tb_notif[0];
|
|
||||||
|
|
||||||
if (custom_notify_list == NULL) {
|
|
||||||
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a notify parameters list", cwmp->conf.custom_notify_json);
|
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a notify parameters list", cwmp->conf.custom_notify_json);
|
||||||
blob_buf_free(&bbuf);
|
blob_buf_free(&bbuf);
|
||||||
creat(NOTIFY_FILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
creat(NOTIFY_FILE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
custom_notify_list = tb_notif[0];
|
||||||
|
|
||||||
const struct blobmsg_policy p[2] = { { "parameter", BLOBMSG_TYPE_STRING }, { "notify_type", BLOBMSG_TYPE_STRING } };
|
const struct blobmsg_policy p[2] = { { "parameter", BLOBMSG_TYPE_STRING }, { "notify_type", BLOBMSG_TYPE_STRING } };
|
||||||
blobmsg_for_each_attr(cur, custom_notify_list, rem)
|
blobmsg_for_each_attr(cur, custom_notify_list, rem)
|
||||||
{
|
{
|
||||||
|
|
@ -561,7 +558,7 @@ void *thread_periodic_check_notify(void *v)
|
||||||
bool periodic_enable;
|
bool periodic_enable;
|
||||||
struct timespec periodic_timeout = { 0, 0 };
|
struct timespec periodic_timeout = { 0, 0 };
|
||||||
time_t current_time;
|
time_t current_time;
|
||||||
int is_notify = 0;
|
int is_notify;
|
||||||
|
|
||||||
periodic_interval = cwmp->conf.periodic_notify_interval;
|
periodic_interval = cwmp->conf.periodic_notify_interval;
|
||||||
periodic_enable = cwmp->conf.periodic_notify_enable;
|
periodic_enable = cwmp->conf.periodic_notify_enable;
|
||||||
|
|
|
||||||
16
reboot.c
16
reboot.c
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
static pthread_t delay_reboot_thread;
|
static pthread_t delay_reboot_thread;
|
||||||
static pthread_t delay_schedule_thread;
|
static pthread_t delay_schedule_thread;
|
||||||
|
static int g_curr_delay_reboot = -1;
|
||||||
|
static time_t g_curr_schedule_redoot = 0;
|
||||||
|
|
||||||
static void *thread_delay_reboot(void *arg)
|
static void *thread_delay_reboot(void *arg)
|
||||||
{
|
{
|
||||||
|
|
@ -104,18 +106,16 @@ static void create_schedule_reboot_thread(struct cwmp *cwmp, bool thread_exist)
|
||||||
|
|
||||||
void launch_reboot_methods(struct cwmp *cwmp)
|
void launch_reboot_methods(struct cwmp *cwmp)
|
||||||
{
|
{
|
||||||
int curr_delay_reboot = -1;
|
|
||||||
time_t curr_schedule_redoot = 0;
|
|
||||||
|
|
||||||
if (cwmp->conf.delay_reboot != curr_delay_reboot && cwmp->conf.delay_reboot > 0) {
|
if (cwmp->conf.delay_reboot != g_curr_delay_reboot && cwmp->conf.delay_reboot > 0) {
|
||||||
|
|
||||||
create_delay_reboot_thread(cwmp, (curr_delay_reboot != -1));
|
create_delay_reboot_thread(cwmp, (g_curr_delay_reboot != -1));
|
||||||
curr_delay_reboot = cwmp->conf.delay_reboot;
|
g_curr_delay_reboot = cwmp->conf.delay_reboot;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cwmp->conf.schedule_reboot != curr_schedule_redoot && (cwmp->conf.schedule_reboot - time(NULL)) > 0) {
|
if (cwmp->conf.schedule_reboot != g_curr_schedule_redoot && (cwmp->conf.schedule_reboot - time(NULL)) > 0) {
|
||||||
|
|
||||||
create_schedule_reboot_thread(cwmp, (curr_schedule_redoot != 0));
|
create_schedule_reboot_thread(cwmp, (g_curr_schedule_redoot != 0));
|
||||||
curr_schedule_redoot = cwmp->conf.schedule_reboot;
|
g_curr_schedule_redoot = cwmp->conf.schedule_reboot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2253,7 +2253,6 @@ int cwmp_handle_rpc_cpe_schedule_download(struct session *session, struct rpc *r
|
||||||
if (!t)
|
if (!t)
|
||||||
goto fault;
|
goto fault;
|
||||||
|
|
||||||
if (error == FAULT_CPE_NO_FAULT) {
|
|
||||||
pthread_mutex_lock(&mutex_schedule_download);
|
pthread_mutex_lock(&mutex_schedule_download);
|
||||||
list_add_tail(&(schedule_download->list), &(list_schedule_download));
|
list_add_tail(&(schedule_download->list), &(list_schedule_download));
|
||||||
if (schedule_download_delay[0] != 0) {
|
if (schedule_download_delay[0] != 0) {
|
||||||
|
|
@ -2273,7 +2272,6 @@ int cwmp_handle_rpc_cpe_schedule_download(struct session *session, struct rpc *r
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex_schedule_download);
|
pthread_mutex_unlock(&mutex_schedule_download);
|
||||||
pthread_cond_signal(&threshold_schedule_download);
|
pthread_cond_signal(&threshold_schedule_download);
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,8 @@ struct session *cwmp_add_queue_session(struct cwmp *cwmp)
|
||||||
INIT_LIST_HEAD(&(session->head_event_container));
|
INIT_LIST_HEAD(&(session->head_event_container));
|
||||||
INIT_LIST_HEAD(&(session->head_rpc_acs));
|
INIT_LIST_HEAD(&(session->head_rpc_acs));
|
||||||
INIT_LIST_HEAD(&(session->head_rpc_cpe));
|
INIT_LIST_HEAD(&(session->head_rpc_cpe));
|
||||||
if ((rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM)) == NULL) {
|
rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM);
|
||||||
|
if (rpc_acs == NULL) {
|
||||||
FREE(session);
|
FREE(session);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
ubus.c
6
ubus.c
|
|
@ -354,7 +354,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
||||||
}
|
}
|
||||||
blobmsg_close_array(&b, a);
|
blobmsg_close_array(&b, a);
|
||||||
} else if (u_args[i].type == UBUS_List_Param_Set) {
|
} else if (u_args[i].type == UBUS_List_Param_Set) {
|
||||||
struct cwmp_dm_parameter *param_value;
|
struct cwmp_dm_parameter *param_value = NULL;
|
||||||
void *a;
|
void *a;
|
||||||
a = blobmsg_open_array(&b, u_args[i].key);
|
a = blobmsg_open_array(&b, u_args[i].key);
|
||||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||||
|
|
@ -368,7 +368,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
||||||
}
|
}
|
||||||
blobmsg_close_array(&b, a);
|
blobmsg_close_array(&b, a);
|
||||||
} else if (u_args[i].type == UBUS_List_Param_Get) {
|
} else if (u_args[i].type == UBUS_List_Param_Get) {
|
||||||
struct cwmp_dm_parameter *param_value;
|
struct cwmp_dm_parameter *param_value = NULL;
|
||||||
void *a;
|
void *a;
|
||||||
a = blobmsg_open_array(&b, u_args[i].key);
|
a = blobmsg_open_array(&b, u_args[i].key);
|
||||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||||
|
|
@ -378,7 +378,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
||||||
}
|
}
|
||||||
blobmsg_close_array(&b, a);
|
blobmsg_close_array(&b, a);
|
||||||
} else if (u_args[i].type == UBUS_Obj_Obj) {
|
} else if (u_args[i].type == UBUS_Obj_Obj) {
|
||||||
struct cwmp_dm_parameter *param_value;
|
struct cwmp_dm_parameter *param_value = NULL;
|
||||||
json_object *input_json_obj = json_object_new_object();
|
json_object *input_json_obj = json_object_new_object();
|
||||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||||
if (!param_value->name)
|
if (!param_value->name)
|
||||||
|
|
|
||||||
3
upload.c
3
upload.c
|
|
@ -97,7 +97,7 @@ int cwmp_launch_upload(struct upload *pupload, struct transfer_complete **ptrans
|
||||||
int error = FAULT_CPE_NO_FAULT;
|
int error = FAULT_CPE_NO_FAULT;
|
||||||
char *upload_startTime;
|
char *upload_startTime;
|
||||||
struct transfer_complete *p;
|
struct transfer_complete *p;
|
||||||
char *name = "";
|
char *name = NULL;
|
||||||
upload_startTime = mix_get_time();
|
upload_startTime = mix_get_time();
|
||||||
char file_path[128] = {'\0'};
|
char file_path[128] = {'\0'};
|
||||||
bkp_session_delete_upload(pupload);
|
bkp_session_delete_upload(pupload);
|
||||||
|
|
@ -105,6 +105,7 @@ int cwmp_launch_upload(struct upload *pupload, struct transfer_complete **ptrans
|
||||||
|
|
||||||
if (pupload->file_type[0] == '1' || pupload->file_type[0] == '3') {
|
if (pupload->file_type[0] == '1' || pupload->file_type[0] == '3') {
|
||||||
if (pupload->f_instance && isdigit(pupload->f_instance[0])) {
|
if (pupload->f_instance && isdigit(pupload->f_instance[0])) {
|
||||||
|
name = NULL;
|
||||||
lookup_vcf_name(pupload->f_instance, &name);
|
lookup_vcf_name(pupload->f_instance, &name);
|
||||||
if (name && strlen(name) > 0) {
|
if (name && strlen(name) > 0) {
|
||||||
snprintf(file_path, sizeof(file_path), "/tmp/%s", name);
|
snprintf(file_path, sizeof(file_path), "/tmp/%s", name);
|
||||||
|
|
|
||||||
2
xml.c
2
xml.c
|
|
@ -35,7 +35,7 @@ mxmlFindElementOpaque(mxml_node_t *node, /* I - Current node */
|
||||||
node = mxmlWalkNext(node, top, descend);
|
node = mxmlWalkNext(node, top, descend);
|
||||||
|
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if (node->type == MXML_OPAQUE && node->value.opaque && (!text || !strcmp(node->value.opaque, text))) {
|
if (node->type == MXML_OPAQUE && node->value.opaque && (!strcmp(node->value.opaque, text))) {
|
||||||
return (node);
|
return (node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue