mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2026-02-21 03:42:57 +01:00
Ticket refs #7501: icwmp: Fix static code warnings with cppcheck-2.7
This commit is contained in:
parent
11b4339fc3
commit
8fe0cf54ea
45 changed files with 282 additions and 267 deletions
|
|
@ -4,8 +4,8 @@ include:
|
|||
|
||||
variables:
|
||||
DEBUG: 'TRUE'
|
||||
COMMON_IMAGE: "iopsys/code-analysis:0.25"
|
||||
RUN_CPPCHECK: "cppcheck --enable=all --inline-suppr --include=/usr/include/uci.h --suppress=unusedFunction -i ./test/"
|
||||
COMMON_IMAGE: "iopsys/code-analysis:0.27"
|
||||
RUN_CPPCHECK: "cppcheck --force --enable=all --error-exitcode=1 -D_GNU_SOURCE --include=/usr/include/libubox/list.h --include=/usr/include/uci.h -I ./inc --suppress=unusedFunction -i ./test/ --inline-suppr"
|
||||
SOURCE_FOLDER: "."
|
||||
CWMP_WORKER_PROCESSES: 1
|
||||
NBI_WORKER_PROCESSES: 1
|
||||
|
|
|
|||
|
|
@ -11,17 +11,16 @@
|
|||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "backupSession.h"
|
||||
#include "log.h"
|
||||
#include "notifications.h"
|
||||
#include "event.h"
|
||||
#include "download.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "upload.h"
|
||||
#include "sched_inform.h"
|
||||
#include "download.h"
|
||||
#include "upload.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "notifications.h"
|
||||
#include "xml.h"
|
||||
|
||||
static mxml_node_t *bkp_tree = NULL;
|
||||
pthread_mutex_t mutex_backup_session = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
|
@ -521,7 +520,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)
|
||||
{
|
||||
struct operations *p = NULL;
|
||||
struct operations *p;
|
||||
char schedule_time[128];
|
||||
mxml_node_t *b, *n;
|
||||
|
||||
|
|
@ -530,7 +529,6 @@ void bkp_session_insert_change_du_state(struct change_du_state *pchange_du_state
|
|||
b = bkp_session_insert(bkp_tree, "change_du_state", NULL);
|
||||
bkp_session_insert(b, "command_key", pchange_du_state->command_key);
|
||||
bkp_session_insert(b, "time", schedule_time);
|
||||
|
||||
list_for_each_entry (p, &(pchange_du_state->list_operation), list) {
|
||||
if (p->type == DU_INSTALL) {
|
||||
n = bkp_session_insert(b, "install", NULL);
|
||||
|
|
@ -663,7 +661,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)
|
||||
{
|
||||
char schedule_time[128], resolved[8], fault_code[8];
|
||||
struct opresult *p = NULL;
|
||||
struct opresult *p;
|
||||
mxml_node_t *b;
|
||||
|
||||
pthread_mutex_lock(&mutex_backup_session);
|
||||
|
|
@ -800,6 +798,10 @@ void load_queue_event(mxml_node_t *tree, struct cwmp *cwmp)
|
|||
while (b) {
|
||||
if (b->type == MXML_ELEMENT) {
|
||||
if (strcmp(b->value.element.name, "command_key") == 0) {
|
||||
/*
|
||||
* This condition is not always false.
|
||||
* while the value of idx can be changed while call of load_specific_backup_attributes.
|
||||
*/
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (idx != -1) {
|
||||
if (EVENT_CONST[idx].RETRY & EVENT_RETRY_AFTER_REBOOT) {
|
||||
|
|
@ -830,7 +832,7 @@ void load_schedule_inform(mxml_node_t *tree)
|
|||
char *command_key = NULL;
|
||||
time_t scheduled_time = 0;
|
||||
struct schedule_inform *schedule_inform = NULL;
|
||||
struct list_head *ilist = NULL;
|
||||
struct list_head *ilist;
|
||||
|
||||
struct backup_attributes bkp_attrs = { .command_key = &command_key, .time = &scheduled_time };
|
||||
load_specific_backup_attributes(tree, &bkp_attrs);
|
||||
|
|
|
|||
51
common.c
51
common.c
|
|
@ -8,23 +8,20 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <sys/stat.h>
|
||||
#include <curl/curl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/file.h>
|
||||
#include <regex.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "cwmp_cli.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "ubus.h"
|
||||
#include "log.h"
|
||||
#include "cwmp_cli.h"
|
||||
#include "cwmp_du_state.h"
|
||||
|
||||
|
||||
#ifndef CWMP_REVISION
|
||||
#define CWMP_REVISION "8.2.10"
|
||||
|
|
@ -586,7 +583,7 @@ void icwmp_restart_services()
|
|||
}
|
||||
}
|
||||
if (g_firewall_restart) {
|
||||
CWMP_LOG(INFO, "Initiating Firewall restart")
|
||||
CWMP_LOG(INFO, "Initiating Firewall restart");
|
||||
cwmp_uci_set_varstate_value("cwmp", "cpe", "firewall_restart", "in_progress");
|
||||
cwmp_commit_package("cwmp", UCI_VARSTATE_CONFIG);
|
||||
}
|
||||
|
|
@ -691,3 +688,33 @@ int copy_file(char *source_file, char *target_file)
|
|||
fclose(target);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ubus_network_interface_callback(struct ubus_request *req __attribute__((unused)), int type __attribute__((unused)), struct blob_attr *msg)
|
||||
{
|
||||
const struct blobmsg_policy p[1] = { { "device", BLOBMSG_TYPE_STRING } };
|
||||
struct blob_attr *tb[1] = { NULL };
|
||||
blobmsg_parse(p, 1, tb, blobmsg_data(msg), blobmsg_len(msg));
|
||||
if (!tb[0]) {
|
||||
cwmp_main.conf.interface = NULL;
|
||||
CWMP_LOG(DEBUG, "CWMP IFACE - interface: NOT FOUND");
|
||||
return;
|
||||
}
|
||||
|
||||
FREE(cwmp_main.conf.interface);
|
||||
cwmp_main.conf.interface = strdup(blobmsg_get_string(tb[0]));
|
||||
CWMP_LOG(DEBUG, "CWMP IFACE - interface: %s", cwmp_main.conf.interface);
|
||||
}
|
||||
|
||||
int get_connection_interface()
|
||||
{
|
||||
int e = cwmp_ubus_call("network.interface", "status", CWMP_UBUS_ARGS{ { "interface", { .str_val = cwmp_main.conf.default_wan_iface }, UBUS_String } }, 1, ubus_network_interface_callback, NULL);
|
||||
if (e != 0) {
|
||||
CWMP_LOG(INFO, "Get network interface from network.interface ubus method failed. Ubus err code: %d", e);
|
||||
return -1;
|
||||
}
|
||||
if (cwmp_main.conf.interface == NULL) {
|
||||
CWMP_LOG(INFO, "Not able to get the network interface from network.interface ubus method.");
|
||||
return -1;
|
||||
}
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
|
|
|||
36
config.c
36
config.c
|
|
@ -9,13 +9,13 @@
|
|||
* Author Ahmed Zribi <ahmed.zribi@pivasoftware.com>
|
||||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "reboot.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "ubus.h"
|
||||
|
||||
pthread_mutex_t mutex_config_load = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
|
|
@ -592,36 +592,6 @@ int get_global_config(struct config *conf)
|
|||
return CWMP_OK;
|
||||
}
|
||||
|
||||
void ubus_network_interface_callback(struct ubus_request *req __attribute__((unused)), int type __attribute__((unused)), struct blob_attr *msg)
|
||||
{
|
||||
const struct blobmsg_policy p[1] = { { "device", BLOBMSG_TYPE_STRING } };
|
||||
struct blob_attr *tb[1] = { NULL };
|
||||
blobmsg_parse(p, 1, tb, blobmsg_data(msg), blobmsg_len(msg));
|
||||
if (!tb[0]) {
|
||||
cwmp_main.conf.interface = NULL;
|
||||
CWMP_LOG(DEBUG, "CWMP IFACE - interface: NOT FOUND");
|
||||
return;
|
||||
}
|
||||
|
||||
FREE(cwmp_main.conf.interface);
|
||||
cwmp_main.conf.interface = strdup(blobmsg_get_string(tb[0]));
|
||||
CWMP_LOG(DEBUG, "CWMP IFACE - interface: %s", cwmp_main.conf.interface);
|
||||
}
|
||||
|
||||
int get_connection_interface()
|
||||
{
|
||||
int e = cwmp_ubus_call("network.interface", "status", CWMP_UBUS_ARGS{ { "interface", { .str_val = cwmp_main.conf.default_wan_iface }, UBUS_String } }, 1, ubus_network_interface_callback, NULL);
|
||||
if (e != 0) {
|
||||
CWMP_LOG(INFO, "Get network interface from network.interface ubus method failed. Ubus err code: %d", e);
|
||||
return -1;
|
||||
}
|
||||
if (cwmp_main.conf.interface == NULL) {
|
||||
CWMP_LOG(INFO, "Not able to get the network interface from network.interface ubus method.");
|
||||
return -1;
|
||||
}
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
||||
int reload_networking_config()
|
||||
{
|
||||
int error;
|
||||
|
|
@ -640,7 +610,7 @@ int reload_networking_config()
|
|||
return error;
|
||||
}
|
||||
|
||||
if ((error = get_connection_interface()))
|
||||
if (get_connection_interface() == -1)
|
||||
return -1;
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
|
|
|||
54
cwmp.c
54
cwmp.c
|
|
@ -10,31 +10,32 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <libubox/uloop.h>
|
||||
#include <sys/file.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "session.h"
|
||||
#include "backupSession.h"
|
||||
#include "http.h"
|
||||
#include "diagnostic.h"
|
||||
#include "config.h"
|
||||
#include "ubus.h"
|
||||
#include "log.h"
|
||||
#include "notifications.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "download.h"
|
||||
#include "upload.h"
|
||||
#include "sched_inform.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "digestauth.h"
|
||||
#include "ssl_utils.h"
|
||||
#include "xml.h"
|
||||
#include "notifications.h"
|
||||
#include "event.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "session.h"
|
||||
#include "diagnostic.h"
|
||||
#include "http.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "config.h"
|
||||
#include "backupSession.h"
|
||||
#include "ubus.h"
|
||||
#include "digestauth.h"
|
||||
#include "upload.h"
|
||||
#include "download.h"
|
||||
#include "sched_inform.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "cwmp_du_state.h"
|
||||
|
||||
static pthread_t periodic_event_thread;
|
||||
static pthread_t scheduleInform_thread;
|
||||
|
|
@ -154,7 +155,6 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session)
|
|||
|
||||
while (1) {
|
||||
list_for_each (ilist, &(session->head_rpc_acs)) {
|
||||
|
||||
rpc_acs = list_entry(ilist, struct rpc, list);
|
||||
if (!rpc_acs->type || thread_end)
|
||||
goto retry;
|
||||
|
|
@ -171,6 +171,11 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session)
|
|||
goto retry;
|
||||
|
||||
CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||
/*
|
||||
* This condition is not always false.
|
||||
* while the value of idx can be changed to true in the exit of icwmp.
|
||||
*/
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (rpc_acs_methods[rpc_acs->type].parse_response || thread_end)
|
||||
if (rpc_acs_methods[rpc_acs->type].parse_response(cwmp, session, rpc_acs))
|
||||
goto retry;
|
||||
|
|
@ -200,7 +205,6 @@ static int cwmp_schedule_rpc(struct cwmp *cwmp, struct session *session)
|
|||
goto retry;
|
||||
|
||||
while (session->head_rpc_cpe.next != &(session->head_rpc_cpe)) {
|
||||
|
||||
rpc_cpe = list_entry(session->head_rpc_cpe.next, struct rpc, list);
|
||||
if (!rpc_cpe->type || thread_end)
|
||||
goto retry;
|
||||
|
|
@ -516,19 +520,19 @@ void load_boot_inform_json_file(struct cwmp *cwmp)
|
|||
blob_buf_free(&bbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
const struct blobmsg_policy p[1] = { { "boot_inform", BLOBMSG_TYPE_ARRAY } };
|
||||
struct blob_attr *tb[1] = { NULL };
|
||||
blobmsg_parse(p, 1, tb, blobmsg_data(bbuf.head), blobmsg_len(bbuf.head));
|
||||
if (!tb[0])
|
||||
return;
|
||||
custom_boot_inform_list = tb[0];
|
||||
|
||||
if (custom_boot_inform_list == NULL) {
|
||||
if (tb[0] == NULL) {
|
||||
CWMP_LOG(WARNING, "The JSON file %s doesn't contain a boot inform parameters list", cwmp->conf.custom_notify_json);
|
||||
blob_buf_free(&bbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
custom_boot_inform_list = tb[0];
|
||||
|
||||
blobmsg_for_each_attr(cur, custom_boot_inform_list, rem)
|
||||
{
|
||||
char parameter_path[128];
|
||||
|
|
|
|||
14
cwmp_cli.c
14
cwmp_cli.c
|
|
@ -8,13 +8,13 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "notifications.h"
|
||||
#include "cwmp_cli.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "notifications.h"
|
||||
|
||||
LIST_HEAD(parameters_list);
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ void display_get_cmd_result(struct cmd_input in __attribute__((unused)), union c
|
|||
fprintf(stderr, "Fault %s: %s\n", fault, get_fault_message_by_fault_code(fault));
|
||||
return;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, res.param_list, list) {
|
||||
fprintf(stdout, "%s => %s\n", param_value->name, param_value->value);
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ char *cmd_set_exec_func(struct cmd_input in, union cmd_result *res __attribute__
|
|||
int fault_idx = cwmp_set_multiple_parameters_values(&list_set_param_value, "set_key", &flag, &faults_list);
|
||||
cwmp_free_all_dm_parameter_list(&list_set_param_value);
|
||||
if (fault_idx != FAULT_CPE_NO_FAULT) {
|
||||
struct cwmp_param_fault *param_fault = NULL;
|
||||
struct cwmp_param_fault *param_fault;
|
||||
char fault[5] = {0};
|
||||
list_for_each_entry (param_fault, &faults_list, list) {
|
||||
snprintf(fault, sizeof(fault), "%d", param_fault->fault);
|
||||
|
|
@ -204,7 +204,7 @@ void display_get_notif_cmd_result(struct cmd_input in __attribute__((unused)), u
|
|||
fprintf(stderr, "Fault %s: %s\n", fault, get_fault_message_by_fault_code(fault));
|
||||
return;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, res.param_list, list) {
|
||||
fprintf(stdout, "%s => %s\n", param_value->name, param_value->notification == 2 ? "active" : param_value->notification == 1 ? "passive" : "off");
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ void display_get_names_cmd_result(struct cmd_input in __attribute__((unused)), u
|
|||
fprintf(stderr, "Fault %s: %s\n", fault, get_fault_message_by_fault_code(fault));
|
||||
return;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, res.param_list, list) {
|
||||
fprintf(stdout, "%s => %s\n", param_value->name, param_value->writable ? "writable" : "not-writable");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,15 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "ubus.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "ubus.h"
|
||||
#include "log.h"
|
||||
#include "backupSession.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "backupSession.h"
|
||||
#include "event.h"
|
||||
|
||||
LIST_HEAD(list_change_du_state);
|
||||
|
|
@ -117,7 +116,7 @@ static char *get_software_module_object_eq(char *param1, char *val1, char *param
|
|||
if (err)
|
||||
return NULL;
|
||||
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
char instance[8];
|
||||
list_for_each_entry (param_value, sw_parameters, list) {
|
||||
snprintf(instance, (size_t)(strchr(param_value->name + strlen("Device.SoftwareModules.DeploymentUnit."), '.') - param_value->name - strlen("Device.SoftwareModules.DeploymentUnit.") + 1), "%s", (char *)(param_value->name + strlen("Device.SoftwareModules.DeploymentUnit.")));
|
||||
|
|
@ -138,7 +137,7 @@ static int get_deployment_unit_name_version(char *uuid, char **name, char **vers
|
|||
snprintf(version_param, sizeof(version_param), "Device.SoftwareModules.DeploymentUnit.%s.Version", sw_by_uuid_instance);
|
||||
snprintf(environment_param, sizeof(environment_param), "Device.SoftwareModules.DeploymentUnit.%s.ExecutionEnvRef", sw_by_uuid_instance);
|
||||
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, &sw_parameters, list) {
|
||||
if (strcmp(param_value->name, name_param) == 0) {
|
||||
*name = strdup(param_value->value);
|
||||
|
|
@ -169,7 +168,7 @@ static char *get_softwaremodules_uuid(char *url)
|
|||
|
||||
snprintf(uuid_param, sizeof(uuid_param), "Device.SoftwareModules.DeploymentUnit.%s.UUID", sw_by_url_instance);
|
||||
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, &sw_parameters, list) {
|
||||
if (strcmp(param_value->name, uuid_param) == 0) {
|
||||
uuid = strdup(param_value->value);
|
||||
|
|
@ -191,7 +190,7 @@ static char *get_softwaremodules_url(char *uuid)
|
|||
|
||||
snprintf(url_param, sizeof(url_param), "Device.SoftwareModules.DeploymentUnit.%s.URL", sw_by_uuid_instance);
|
||||
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, &sw_parameters, list) {
|
||||
if (strcmp(param_value->name, url_param) == 0) {
|
||||
url = strdup(param_value->value);
|
||||
|
|
@ -235,7 +234,7 @@ static char *get_exec_env_name(char *environment_path)
|
|||
if (err)
|
||||
return strdup("");
|
||||
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
snprintf(env_param, sizeof(env_param), "%sName", environment_path);
|
||||
list_for_each_entry (param_value, &environment_list, list) {
|
||||
if (strcmp(param_value->name, env_param) == 0) {
|
||||
|
|
|
|||
16
cwmp_uci.c
16
cwmp_uci.c
|
|
@ -8,9 +8,12 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
|
||||
struct uci_paths uci_save_conf_paths[] = {
|
||||
[UCI_STANDARD_CONFIG] = { "/etc/config", "/tmp/.uci", NULL },
|
||||
|
|
@ -213,7 +216,7 @@ int cwmp_uci_get_value_by_section_string(struct uci_section *s, char *option, ch
|
|||
struct uci_option *o;
|
||||
|
||||
*value = NULL;
|
||||
if (s == NULL || option == NULL)
|
||||
if (s == NULL || &s->options == NULL || option == NULL)
|
||||
goto not_found;
|
||||
|
||||
uci_foreach_element(&s->options, e)
|
||||
|
|
@ -374,13 +377,16 @@ void cwmp_delete_uci_element_from_list(struct uci_element *e)
|
|||
void cwmp_free_uci_list(struct uci_list *list)
|
||||
{
|
||||
struct uci_element *e = NULL, *tmp = NULL;
|
||||
|
||||
if (list == NULL)
|
||||
return;
|
||||
uci_foreach_element_safe(list, e, tmp)
|
||||
cwmp_delete_uci_element_from_list(e);
|
||||
}
|
||||
|
||||
char *cwmp_uci_list_to_string(struct uci_list *list, char *delimitor)
|
||||
{
|
||||
if (delimitor == NULL)
|
||||
return NULL;
|
||||
if (list && !uci_list_empty(list)) {
|
||||
struct uci_element *e = NULL;
|
||||
char list_val[512] = { 0 };
|
||||
|
|
@ -704,6 +710,10 @@ int cwmp_uci_import(char *package_name, const char *input_path, uci_config_paths
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (uci_save_conf_paths[uci_type].uci_ctx == NULL) {
|
||||
ret = -1;
|
||||
goto end;
|
||||
}
|
||||
uci_foreach_element(&uci_save_conf_paths[uci_type].uci_ctx->root, e)
|
||||
{
|
||||
struct uci_package *p = uci_to_package(e);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
*/
|
||||
|
||||
#include <zlib.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <libubox/blobmsg_json.h>
|
||||
|
||||
#include "datamodel_interface.h"
|
||||
#include "log.h"
|
||||
#include "ubus.h"
|
||||
#include "notifications.h"
|
||||
#include "log.h"
|
||||
|
||||
int transaction_id = 0;
|
||||
|
||||
|
|
|
|||
10
diagnostic.c
10
diagnostic.c
|
|
@ -9,17 +9,13 @@
|
|||
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
* Author: Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "diagnostic.h"
|
||||
#include "config.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "ubus.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "event.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
|
||||
struct diagnostic_input {
|
||||
char *input_name;
|
||||
|
|
|
|||
|
|
@ -10,16 +10,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "common.h"
|
||||
#include "digestauth.h"
|
||||
#include "md5.h"
|
||||
#include "log.h"
|
||||
#include "ssl_utils.h"
|
||||
#include "md5.h"
|
||||
|
||||
#define HASH_MD5_HEX_LEN (2 * MD5_DIGEST_SIZE)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,16 +9,16 @@
|
|||
*/
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <string.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "download.h"
|
||||
#include "ubus.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "backupSession.h"
|
||||
#include "ubus.h"
|
||||
#include "log.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
#include "cwmp_uci.h"
|
||||
|
||||
LIST_HEAD(list_download);
|
||||
LIST_HEAD(list_schedule_download);
|
||||
|
|
|
|||
17
event.c
17
event.c
|
|
@ -11,17 +11,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "backupSession.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
#include "session.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "download.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "upload.h"
|
||||
#include "sched_inform.h"
|
||||
#include "download.h"
|
||||
#include "upload.h"
|
||||
#include "log.h"
|
||||
|
||||
const struct EVENT_CONST_STRUCT EVENT_CONST[] = {[EVENT_IDX_0BOOTSTRAP] = { "0 BOOTSTRAP", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL | EVENT_RETRY_AFTER_REBOOT },
|
||||
[EVENT_IDX_1BOOT] = { "1 BOOT", EVENT_TYPE_SINGLE, EVENT_RETRY_AFTER_TRANSMIT_FAIL },
|
||||
|
|
@ -62,17 +57,17 @@ void cwmp_save_event_container(struct event_container *event_container) //to be
|
|||
struct event_container *cwmp_add_event_container(struct cwmp *cwmp, int event_code, char *command_key)
|
||||
{
|
||||
struct event_container *event_container;
|
||||
struct session *session;
|
||||
struct list_head *ilist;
|
||||
|
||||
if (cwmp->head_event_container == NULL) {
|
||||
struct session *session;
|
||||
session = cwmp_add_queue_session(cwmp);
|
||||
if (session == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
cwmp->head_event_container = &(session->head_event_container);
|
||||
}
|
||||
session = list_entry(cwmp->head_event_container, struct session, head_event_container);
|
||||
//session = list_entry(cwmp->head_event_container, struct session, head_event_container);
|
||||
list_for_each (ilist, cwmp->head_event_container) {
|
||||
event_container = list_entry(ilist, struct event_container, list);
|
||||
if (event_container->code == event_code && EVENT_CONST[event_code].TYPE == EVENT_TYPE_SINGLE) {
|
||||
|
|
@ -386,7 +381,7 @@ void *thread_event_periodic(void *v)
|
|||
|
||||
bool event_exist_in_list(struct cwmp *cwmp, int event)
|
||||
{
|
||||
struct event_container *event_container = NULL;
|
||||
struct event_container *event_container;
|
||||
list_for_each_entry (event_container, cwmp->head_event_container, list) {
|
||||
if (event_container->code == event)
|
||||
return true;
|
||||
|
|
|
|||
13
http.c
13
http.c
|
|
@ -10,21 +10,18 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
* Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
|
||||
*/
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <pthread.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "event.h"
|
||||
#include "http.h"
|
||||
#include "digestauth.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
#include "ubus.h"
|
||||
#include "config.h"
|
||||
#include "digestauth.h"
|
||||
|
||||
#define REALM "authenticate@cwmp"
|
||||
#define OPAQUE "11733b200778ce33060f31c9af70a870ba96ddd4"
|
||||
|
|
|
|||
|
|
@ -11,15 +11,11 @@
|
|||
#ifndef __CCOMMON_H
|
||||
#define __CCOMMON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <libubox/list.h>
|
||||
#include <sys/time.h>
|
||||
#include <libubox/list.h>
|
||||
#include <pthread.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef CWMP_VERSION
|
||||
#define CWMP_VERSION "3.0.0"
|
||||
|
|
@ -491,6 +487,7 @@ void load_forced_inform_json_file(struct cwmp *cwmp);
|
|||
void clean_custom_inform_parameters();
|
||||
char *string_to_hex(const unsigned char *str, size_t size);
|
||||
int copy_file(char *source_file, char *target_file);
|
||||
int get_connection_interface();
|
||||
#ifndef FREE
|
||||
#define FREE(x) \
|
||||
do { \
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@
|
|||
#ifndef _CONFIG_H__
|
||||
#define _CONFIG_H__
|
||||
|
||||
#include <pthread.h>
|
||||
#include "common.h"
|
||||
#include "cwmp_uci.h"
|
||||
|
||||
extern pthread_mutex_t mutex_config_load;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ struct cmd_input {
|
|||
char *second_input;
|
||||
};
|
||||
|
||||
|
||||
char *cmd_get_exec_func(struct cmd_input in, union cmd_result *res);
|
||||
char *cmd_set_exec_func(struct cmd_input in, union cmd_result *res __attribute__((unused)));
|
||||
char *cmd_add_exec_func(struct cmd_input in, union cmd_result *res);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef CWMP_DU_STATE_H
|
||||
#define CWMP_DU_STATE_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern struct list_head list_change_du_state;
|
||||
extern pthread_mutex_t mutex_change_du_state;
|
||||
extern pthread_cond_t threshold_change_du_state;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <uci.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
//struct uci_context *cwmp_uci_ctx = ((void *)0);
|
||||
#define UCI_DHCP_DISCOVERY_PATH "cwmp.acs.dhcp_discovery"
|
||||
#define UCI_ACS_URL_PATH "cwmp.acs.url"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#ifndef SRC_DATAMODELIFACE_H_
|
||||
#define SRC_DATAMODELIFACE_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define DM_ROOT_OBJ "Device."
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef CWMP_DOWNLOAD_H
|
||||
#define CWMP_DOWNLOAD_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#define DOWNLOAD_PROTOCOL_HTTP "http://"
|
||||
#define DOWNLOAD_PROTOCOL_HTTPS "https://"
|
||||
#define DOWNLOAD_PROTOCOL_FTP "ftp://"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
#ifndef EVENT_H_
|
||||
#define EVENT_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "session.h"
|
||||
|
||||
typedef struct event_container {
|
||||
struct list_head list;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#define _FREECWMP_HTTP_H__
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern char *fc_cookies;
|
||||
|
||||
#define HTTP_TIMEOUT 30
|
||||
|
|
|
|||
|
|
@ -18,15 +18,12 @@
|
|||
#ifndef MD5_H
|
||||
#define MD5_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#define HIGHFIRST
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MD5_DIGEST_SIZE 16
|
||||
|
||||
struct MD5Context {
|
||||
|
|
|
|||
|
|
@ -11,15 +11,12 @@
|
|||
|
||||
#ifndef NOTIFICATIONS_H_
|
||||
#define NOTIFICATIONS_H_
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
#include <libubus.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "event.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "rpc_soap.h"
|
||||
|
||||
enum NOTIFICATION_STATUS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,10 +14,8 @@
|
|||
#ifndef __RPC__SOAP__H_
|
||||
#define __RPC__SOAP__H_
|
||||
|
||||
#include <microxml.h>
|
||||
#include "common.h"
|
||||
#include "session.h"
|
||||
#include "xml.h"
|
||||
|
||||
#define MAX_NBRE_CUSTOM_INFORM 256
|
||||
extern char *custom_forced_inform_parameters[MAX_NBRE_CUSTOM_INFORM];
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef CWMP_SCHED_INFORM_H
|
||||
#define CWMP_SCHED_INFORM_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern struct list_head list_schedule_inform;
|
||||
extern pthread_mutex_t mutex_schedule_inform;
|
||||
extern pthread_cond_t threshold_schedule_inform;
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@
|
|||
*/
|
||||
#ifndef _FREECWMP_UBUS_H__
|
||||
#define _FREECWMP_UBUS_H__
|
||||
#include <libubus.h>
|
||||
/*
|
||||
#include <json-c/json.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
#include <libubus.h>
|
||||
|
||||
#include "common.h"
|
||||
*/
|
||||
#include "common.h"
|
||||
|
||||
#define ARRAY_MAX 8
|
||||
|
||||
int cwmp_ubus_init(struct cwmp *cwmp);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
#ifndef CWMP_UPLOAD_H
|
||||
#define CWMP_UPLOAD_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern struct list_head list_upload;
|
||||
extern pthread_mutex_t mutex_upload;
|
||||
extern pthread_cond_t threshold_upload;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
#define __XML__H_
|
||||
|
||||
#include <microxml.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "session.h"
|
||||
#include "common.h"
|
||||
|
||||
#define CWMP_MXML_TAB_SPACE " "
|
||||
#define MAX_SCHEDULE_INFORM_QUEUE 10
|
||||
|
|
|
|||
11
log.c
11
log.c
|
|
@ -10,13 +10,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdarg.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "common.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "common.h"
|
||||
|
||||
static char *SEVERITY_NAMES[8] = { "[EMERG] ", "[ALERT] ", "[CRITIC] ", "[ERROR] ", "[WARNING]", "[NOTICE] ", "[INFO] ", "[DEBUG] " };
|
||||
static int log_severity = DEFAULT_LOG_SEVERITY;
|
||||
|
|
|
|||
3
md5.c
3
md5.c
|
|
@ -15,6 +15,9 @@
|
|||
* will fill a supplied 16-byte array with the digest.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "md5.h"
|
||||
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
|
|
|
|||
27
netlink.c
27
netlink.c
|
|
@ -11,29 +11,20 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <getopt.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
#include <linux/netlink.h>
|
||||
#include <stddef.h>
|
||||
#include <libubox/uloop.h>
|
||||
#include <libubox/usock.h>
|
||||
#include "http.h"
|
||||
#include "log.h"
|
||||
#include "config.h"
|
||||
#include "event.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "netlink.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
|
||||
static int itfcmp(char *itf1, char *itf2);
|
||||
static void netlink_new_msg(struct uloop_fd *ufd, unsigned events);
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*
|
||||
*/
|
||||
#include <unistd.h>
|
||||
|
||||
#include <netdb.h>
|
||||
#include <libubox/list.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "notifications.h"
|
||||
#include "ubus.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "ssl_utils.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
#include "xml.h"
|
||||
|
||||
LIST_HEAD(list_value_change);
|
||||
LIST_HEAD(list_lw_value_change);
|
||||
|
|
@ -206,7 +206,9 @@ int get_parameter_leaf_notification_from_childs_list(char *parameter_name, struc
|
|||
{
|
||||
char *parent = NULL;
|
||||
int ret_notif = -1;
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
if (childs_list == NULL)
|
||||
return -1;
|
||||
list_for_each_entry (param_value, childs_list, list) {
|
||||
if (strcmp(param_value->name, parameter_name) == 0) {
|
||||
ret_notif = param_value->notification;
|
||||
|
|
@ -236,7 +238,7 @@ char *cwmp_get_parameter_attributes(char *parameter_name, struct list_head *para
|
|||
cwmp_free_all_dm_parameter_list(&childs_notifs);
|
||||
return error;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, ¶ms_list, list) {
|
||||
int notif_leaf;
|
||||
notif_leaf = check_parameter_forced_notification(param_value->name);
|
||||
|
|
@ -263,11 +265,13 @@ char *cwmp_get_parameter_attributes(char *parameter_name, struct list_head *para
|
|||
bool parameter_is_other_notif_object_child(char *parent, char *parameter)
|
||||
{
|
||||
struct list_head list_iter, *list_ptr;
|
||||
// cppcheck-suppress unreadVariable
|
||||
list_iter.next = list_param_obj_notify.next;
|
||||
list_iter.prev = list_param_obj_notify.prev;
|
||||
struct cwmp_dm_parameter *dm_parameter = NULL;
|
||||
while (list_iter.prev != &list_param_obj_notify) {
|
||||
struct cwmp_dm_parameter *dm_parameter;
|
||||
if (list_iter.prev == NULL)
|
||||
continue;
|
||||
|
||||
dm_parameter = list_entry(list_iter.prev, struct cwmp_dm_parameter, list);
|
||||
list_ptr = list_iter.prev;
|
||||
list_iter.prev = list_ptr->prev;
|
||||
|
|
@ -300,7 +304,7 @@ void create_list_param_obj_notify()
|
|||
|
||||
char* updated_list_param_leaf_notify_with_sub_parameter_list(struct list_head *list_param_leaf_notify, struct cwmp_dm_parameter parent_parameter, 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 = NULL;
|
||||
struct cwmp_dm_parameter *param_iter;
|
||||
LIST_HEAD(params_list);
|
||||
char *err = cwmp_get_parameter_values(parent_parameter.name, ¶ms_list);
|
||||
if (err)
|
||||
|
|
@ -319,7 +323,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)
|
||||
{
|
||||
struct cwmp_dm_parameter *param_iter = NULL;
|
||||
struct cwmp_dm_parameter *param_iter;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (int)ARRAY_SIZE(forced_notifications_parameters); i++)
|
||||
|
|
@ -453,7 +457,7 @@ void load_custom_notify_json(struct cwmp *cwmp)
|
|||
*/
|
||||
void get_parameter_value_from_parameters_list(struct list_head *params_list, char *parameter_name, char **value, char **type)
|
||||
{
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, params_list, list) {
|
||||
if (param_value->name == NULL)
|
||||
continue;
|
||||
|
|
@ -682,6 +686,8 @@ static void free_all_list_lw_notify()
|
|||
{
|
||||
while (list_lw_value_change.next != &list_lw_value_change) {
|
||||
struct cwmp_dm_parameter *dm_parameter;
|
||||
if (list_lw_value_change.next == NULL)
|
||||
continue;
|
||||
dm_parameter = list_entry(list_lw_value_change.next, struct cwmp_dm_parameter, list);
|
||||
del_list_lw_notify(dm_parameter);
|
||||
}
|
||||
|
|
|
|||
5
reboot.c
5
reboot.c
|
|
@ -9,11 +9,10 @@
|
|||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "session.h"
|
||||
#include "reboot.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "log.h"
|
||||
#include "reboot.h"
|
||||
#include "session.h"
|
||||
|
||||
static pthread_t delay_reboot_thread;
|
||||
static pthread_t delay_schedule_thread;
|
||||
|
|
|
|||
75
rpc_soap.c
75
rpc_soap.c
|
|
@ -12,25 +12,22 @@
|
|||
* Copyright (C) 2011-2012 Luka Perkov <freecwmp@lukaperkov.net>
|
||||
* Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "rpc_soap.h"
|
||||
|
||||
#include "http.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "cwmp_zlib.h"
|
||||
#include "notifications.h"
|
||||
#include "messages.h"
|
||||
#include "backupSession.h"
|
||||
#include "log.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "diagnostic.h"
|
||||
#include "ubus.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "download.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "log.h"
|
||||
#include "event.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "messages.h"
|
||||
#include "event.h"
|
||||
#include "xml.h"
|
||||
#include "backupSession.h"
|
||||
#include "notifications.h"
|
||||
#include "upload.h"
|
||||
#include "sched_inform.h"
|
||||
#include "diagnostic.h"
|
||||
|
||||
#define PROCESSING_DELAY (1) // In download/upload the message enqueued before sending the response, which cause the download/upload
|
||||
// to start just before the time. This delay is to compensate the time lapsed during the message enqueue and response
|
||||
|
|
@ -254,6 +251,7 @@ create_value:
|
|||
return 0;
|
||||
}
|
||||
|
||||
// cppcheck-suppress constParameter
|
||||
int cwmp_rpc_acs_prepare_message_inform(struct cwmp *cwmp, struct session *session, struct rpc *this)
|
||||
{
|
||||
struct cwmp_dm_parameter *dm_parameter;
|
||||
|
|
@ -782,7 +780,7 @@ int cwmp_handle_rpc_cpe_get_parameter_values(struct session *session, struct rpc
|
|||
fault_code = cwmp_get_fault_code_by_string(err);
|
||||
goto fault;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, ¶meters_list, list) {
|
||||
n = mxmlNewElement(parameter_list, "ParameterValueStruct");
|
||||
if (!n)
|
||||
|
|
@ -894,7 +892,7 @@ int cwmp_handle_rpc_cpe_get_parameter_names(struct session *session, struct rpc
|
|||
goto fault;
|
||||
}
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, ¶meters_list, list) {
|
||||
n = mxmlNewElement(parameter_list, "ParameterInfoStruct");
|
||||
if (!n)
|
||||
|
|
@ -985,7 +983,7 @@ int cwmp_handle_rpc_cpe_get_parameter_attributes(struct session *session, struct
|
|||
fault_code = cwmp_get_fault_code_by_string(err);
|
||||
goto fault;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, ¶meters_list, list) {
|
||||
n = mxmlNewElement(parameter_list, "ParameterAttributeStruct");
|
||||
if (!n)
|
||||
|
|
@ -1080,6 +1078,7 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc
|
|||
}
|
||||
|
||||
LIST_HEAD(list_fault_param);
|
||||
// cppcheck-suppress autoVariables
|
||||
rpc->list_set_value_fault = &list_fault_param;
|
||||
LIST_HEAD(list_set_param_value);
|
||||
while (b) {
|
||||
|
|
@ -1091,11 +1090,11 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc
|
|||
}
|
||||
}
|
||||
|
||||
if (b && b->type == MXML_ELEMENT && !strcmp(b->value.element.name, "Name") && !b->child) {
|
||||
if (b->type == MXML_ELEMENT && !strcmp(b->value.element.name, "Name") && !b->child) {
|
||||
parameter_name = icwmp_strdup("");
|
||||
}
|
||||
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Value")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Value")) {
|
||||
parameter_value = icwmp_strdup((char *)mxmlGetOpaque(b));
|
||||
n = b->parent;
|
||||
while ((b = mxmlWalkNext(b, n, MXML_DESCEND))) {
|
||||
|
|
@ -1105,7 +1104,7 @@ int cwmp_handle_rpc_cpe_set_parameter_values(struct session *session, struct rpc
|
|||
}
|
||||
b = n->last_child;
|
||||
}
|
||||
if (b && b->type == MXML_ELEMENT && !strcmp(b->value.element.name, "Value") && !b->child) {
|
||||
if (b->type == MXML_ELEMENT && !strcmp(b->value.element.name, "Value") && !b->child) {
|
||||
parameter_value = icwmp_strdup("");
|
||||
}
|
||||
if (parameter_name && parameter_value) {
|
||||
|
|
@ -1608,7 +1607,7 @@ int cancel_transfer(char *key)
|
|||
if (strcmp(pupload->command_key, key) == 0) {
|
||||
pthread_mutex_lock(&mutex_upload);
|
||||
bkp_session_delete_upload(pupload);
|
||||
bkp_session_save(); //is it needed
|
||||
bkp_session_save();
|
||||
list_del(&(pupload->list));
|
||||
if (pupload->scheduled_time != 0)
|
||||
count_download_queue--;
|
||||
|
|
@ -1862,7 +1861,7 @@ int cwmp_handle_rpc_cpe_change_du_state(struct session *session, struct rpc *rpc
|
|||
}
|
||||
}
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "CommandKey")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "CommandKey")) {
|
||||
change_du_state->command_key = strdup(b->value.opaque);
|
||||
}
|
||||
b = mxmlWalkNext(b, n, MXML_DESCEND);
|
||||
|
|
@ -1974,7 +1973,7 @@ int cwmp_handle_rpc_cpe_download(struct session *session, struct rpc *rpc)
|
|||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "CommandKey")) {
|
||||
download->command_key = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileType")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileType")) {
|
||||
if (download->file_type == NULL) {
|
||||
download->file_type = strdup(b->value.opaque);
|
||||
file_type = icwmp_strdup(b->value.opaque);
|
||||
|
|
@ -1986,20 +1985,20 @@ int cwmp_handle_rpc_cpe_download(struct session *session, struct rpc *rpc)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
download->url = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
download->username = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
download->password = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileSize")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileSize")) {
|
||||
str_file_size = strdup(b->value.opaque ? b->value.opaque: "0");
|
||||
download->file_size = atoi(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "DelaySeconds")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "DelaySeconds")) {
|
||||
str_download_delay = strdup(b->value.opaque ? b->value.opaque: "0");
|
||||
download_delay = atol(b->value.opaque);
|
||||
}
|
||||
|
|
@ -2125,7 +2124,7 @@ int cwmp_handle_rpc_cpe_schedule_download(struct session *session, struct rpc *r
|
|||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "CommandKey")) {
|
||||
schedule_download->command_key = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileType")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileType")) {
|
||||
if (schedule_download->file_type != NULL) {
|
||||
tmp = file_type;
|
||||
if (cwmp_asprintf(&file_type, "%s %s", tmp, b->value.opaque) == -1) {
|
||||
|
|
@ -2137,21 +2136,21 @@ int cwmp_handle_rpc_cpe_schedule_download(struct session *session, struct rpc *r
|
|||
file_type = icwmp_strdup(b->value.opaque);
|
||||
}
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
schedule_download->url = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
schedule_download->username = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
schedule_download->password = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileSize")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "FileSize")) {
|
||||
str_file_size = strdup(b->value.opaque);
|
||||
schedule_download->file_size = atoi(b->value.opaque);
|
||||
}
|
||||
|
||||
if (b && b->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "TimeWindowList")) {
|
||||
if (b->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "TimeWindowList")) {
|
||||
if (!t)
|
||||
return -1; //TO CHECK*/
|
||||
t = mxmlWalkNext(t, b, MXML_DESCEND);
|
||||
|
|
@ -2335,16 +2334,16 @@ int cwmp_handle_rpc_cpe_upload(struct session *session, struct rpc *rpc)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "URL")) {
|
||||
upload->url = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Username")) {
|
||||
upload->username = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "Password")) {
|
||||
upload->password = strdup(b->value.opaque);
|
||||
}
|
||||
if (b && b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "DelaySeconds")) {
|
||||
if (b->type == MXML_OPAQUE && b->value.opaque && b->parent->type == MXML_ELEMENT && !strcmp(b->parent->value.element.name, "DelaySeconds")) {
|
||||
str_upload_delay = strdup(b->value.opaque);
|
||||
upload_delay = atol(b->value.opaque);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,10 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "sched_inform.h"
|
||||
#include "log.h"
|
||||
#include "backupSession.h"
|
||||
#include "event.h"
|
||||
#include "log.h"
|
||||
|
||||
LIST_HEAD(list_schedule_inform);
|
||||
pthread_mutex_t mutex_schedule_inform = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
|
|
|||
10
session.c
10
session.c
|
|
@ -9,11 +9,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "session.h"
|
||||
#include "event.h"
|
||||
#include "backupSession.h"
|
||||
#include "config.h"
|
||||
#include "event.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "backupSession.h"
|
||||
|
||||
unsigned int end_session_flag = 0;
|
||||
|
||||
|
|
@ -162,13 +164,13 @@ int cwmp_move_session_to_session_queue(struct cwmp *cwmp, struct session *sessio
|
|||
if (session->head_rpc_acs.next != &(session->head_rpc_acs)) {
|
||||
rpc_acs = list_entry(session->head_rpc_acs.next, struct rpc, list);
|
||||
if (rpc_acs->type != RPC_ACS_INFORM) {
|
||||
if ((rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM)) == NULL) {
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((rpc_acs = cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM)) == NULL) {
|
||||
if (cwmp_add_session_rpc_acs_head(session, RPC_ACS_INFORM) == NULL) {
|
||||
pthread_mutex_unlock(&(cwmp->mutex_session_queue));
|
||||
return CWMP_MEM_ERR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <openssl/ssl.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
|
|
@ -38,7 +39,7 @@ char *generate_random_string(size_t size)
|
|||
|
||||
int written = RAND_bytes(buf, size);
|
||||
if (written != 1) {
|
||||
printf("Failed to get random bytes");
|
||||
CWMP_LOG(ERROR,"Failed to get random bytes");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <setjmp.h>
|
||||
#include <cmocka.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "rpc_soap.h"
|
||||
#include "event.h"
|
||||
|
|
@ -22,6 +23,7 @@
|
|||
#include "log.h"
|
||||
#include "download.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "xml.h"
|
||||
|
||||
#include "icwmp_soap_msg_unit_test.h"
|
||||
|
||||
|
|
|
|||
21
ubus.c
21
ubus.c
|
|
@ -11,21 +11,22 @@
|
|||
* Copyright (C) 2012 Luka Perkov <freecwmp@lukaperkov.net>
|
||||
*/
|
||||
|
||||
#include <json-c/json.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/socket.h>
|
||||
#include <libubox/blobmsg_json.h>
|
||||
|
||||
#include "ubus.h"
|
||||
#include "session.h"
|
||||
#include "log.h"
|
||||
#include "netlink.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "event.h"
|
||||
#include "backupSession.h"
|
||||
#include "sched_inform.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "http.h"
|
||||
#include "download.h"
|
||||
#include "upload.h"
|
||||
#include "http.h"
|
||||
#include "rpc_soap.h"
|
||||
#include "cwmp_du_state.h"
|
||||
#include "netlink.h"
|
||||
#include "event.h"
|
||||
#include "cwmp_time.h"
|
||||
|
||||
static struct ubus_context *ctx = NULL;
|
||||
|
||||
|
|
@ -354,7 +355,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
|||
}
|
||||
blobmsg_close_array(&b, a);
|
||||
} else if (u_args[i].type == UBUS_List_Param_Set) {
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
void *a;
|
||||
a = blobmsg_open_array(&b, u_args[i].key);
|
||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||
|
|
@ -368,7 +369,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
|||
}
|
||||
blobmsg_close_array(&b, a);
|
||||
} else if (u_args[i].type == UBUS_List_Param_Get) {
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
void *a;
|
||||
a = blobmsg_open_array(&b, u_args[i].key);
|
||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||
|
|
@ -378,7 +379,7 @@ int cwmp_ubus_call(const char *obj, const char *method, const struct cwmp_ubus_a
|
|||
}
|
||||
blobmsg_close_array(&b, a);
|
||||
} else if (u_args[i].type == UBUS_Obj_Obj) {
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
json_object *input_json_obj = json_object_new_object();
|
||||
list_for_each_entry (param_value, u_args[i].val.param_value_list, list) {
|
||||
if (!param_value->name)
|
||||
|
|
|
|||
22
upload.c
22
upload.c
|
|
@ -8,18 +8,17 @@
|
|||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include <curl/curl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "upload.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "download.h"
|
||||
#include "log.h"
|
||||
#include "cwmp_time.h"
|
||||
#include "datamodel_interface.h"
|
||||
#include "log.h"
|
||||
#include "backupSession.h"
|
||||
#include "cwmp_uci.h"
|
||||
#include "event.h"
|
||||
#include "cwmp_uci.h"
|
||||
|
||||
#define CURL_TIMEOUT 20
|
||||
|
||||
|
|
@ -34,9 +33,11 @@ int lookup_vcf_name(char *instance, char **value)
|
|||
char *err = NULL;
|
||||
LIST_HEAD(vcf_parameters);
|
||||
snprintf(vcf_name_parameter, sizeof(vcf_name_parameter), "Device.DeviceInfo.VendorConfigFile.%s.Name", instance);
|
||||
if ((err = cwmp_get_parameter_values(vcf_name_parameter, &vcf_parameters)) != NULL)
|
||||
if (cwmp_get_parameter_values(vcf_name_parameter, &vcf_parameters) != NULL) {
|
||||
CWMP_LOG(ERROR, "Not able to get the value of the parameter %s : %s", vcf_name_parameter, err);
|
||||
return -1;
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, &vcf_parameters, list) {
|
||||
*value = strdup(param_value->value);
|
||||
break;
|
||||
|
|
@ -51,9 +52,11 @@ int lookup_vlf_name(char *instance, char **value)
|
|||
char *err = NULL;
|
||||
LIST_HEAD(vlf_parameters);
|
||||
snprintf(vlf_name_parameter, sizeof(vlf_name_parameter), "Device.DeviceInfo.VendorLogFile.%s.Name", instance);
|
||||
if ((err = cwmp_get_parameter_values(vlf_name_parameter, &vlf_parameters)) != NULL)
|
||||
if (cwmp_get_parameter_values(vlf_name_parameter, &vlf_parameters) != NULL) {
|
||||
CWMP_LOG(ERROR, "Not able to get the value of the parameter %s : %s", vlf_name_parameter, err);
|
||||
return -1;
|
||||
struct cwmp_dm_parameter *param_value = NULL;
|
||||
}
|
||||
struct cwmp_dm_parameter *param_value;
|
||||
list_for_each_entry (param_value, &vlf_parameters, list) {
|
||||
*value = strdup(param_value->value);
|
||||
break;
|
||||
|
|
@ -108,6 +111,7 @@ int cwmp_launch_upload(struct upload *pupload, struct transfer_complete **ptrans
|
|||
name = NULL;
|
||||
lookup_vcf_name(pupload->f_instance, &name);
|
||||
if (name && strlen(name) > 0) {
|
||||
// cppcheck-suppress uninitvar
|
||||
snprintf(file_path, sizeof(file_path), "/tmp/%s", name);
|
||||
cwmp_uci_export_package(name, file_path, UCI_STANDARD_CONFIG);
|
||||
FREE(name);
|
||||
|
|
|
|||
6
xml.c
6
xml.c
|
|
@ -9,13 +9,13 @@
|
|||
* Author Ahmed Zribi <ahmed.zribi@pivasoftware.com>
|
||||
* Author Omar Kallel <omar.kallel@pivasoftware.com>
|
||||
*/
|
||||
|
||||
#include "xml.h"
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "cwmp_zlib.h"
|
||||
#include "http.h"
|
||||
#include "notifications.h"
|
||||
#include "messages.h"
|
||||
#include "http.h"
|
||||
#include "cwmp_zlib.h"
|
||||
|
||||
static const char *soap_env_url = "http://schemas.xmlsoap.org/soap/envelope/";
|
||||
static const char *soap_enc_url = "http://schemas.xmlsoap.org/soap/encoding/";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue