diff --git a/src/common.h b/src/common.h index d0438e5..05b2c8b 100644 --- a/src/common.h +++ b/src/common.h @@ -181,7 +181,6 @@ typedef struct cwmp { struct connection net; struct session *session; bool cwmp_cr_event; - bool init_complete; bool prev_periodic_enable; bool prev_heartbeat_enable; bool heart_session; diff --git a/src/config.c b/src/config.c index e6fd611..fd92067 100755 --- a/src/config.c +++ b/src/config.c @@ -85,49 +85,32 @@ int get_preinit_config() static int global_conf_init() { - int error = CWMP_OK; + get_global_config(); - if ((error = get_global_config())) { - cwmp_main->init_complete = false; - goto end; - } - - cwmp_main->init_complete = true; /* Launch reboot methods if needed */ launch_reboot_methods(); -end: - return error; + return 0; } void cwmp_config_load() { - int ret = CWMP_GEN_ERR; int error = CWMP_GEN_ERR; - ret = global_conf_init(); + global_conf_init(); if (cwmp_stop == true) return; - if (ret == CWMP_OK) { - cwmp_main->net.ipv6_status = is_ipv6_enabled(); - error = icwmp_check_http_connection(); - } + 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"); - } - + CWMP_LOG(DEBUG, "Init: failed to check http connection"); sleep(UCI_OPTION_READ_INTERVAL); - ret = global_conf_init(); - if (ret == CWMP_OK) { - cwmp_main->net.ipv6_status = is_ipv6_enabled(); - error = icwmp_check_http_connection(); - } + global_conf_init(); + cwmp_main->net.ipv6_status = is_ipv6_enabled(); + error = icwmp_check_http_connection(); } } diff --git a/src/ubus_utils.c b/src/ubus_utils.c index a825ec7..b2a6014 100644 --- a/src/ubus_utils.c +++ b/src/ubus_utils.c @@ -139,11 +139,6 @@ static const struct blobmsg_policy icwmp_cmd_policy[] = { static int icwmp_command_handler(struct ubus_context *ctx, struct ubus_object *obj __attribute__((unused)), struct ubus_request_data *req, const char *method __attribute__((unused)), struct blob_attr *msg) { - if (cwmp_main->init_complete == false) { - CWMP_LOG(INFO, "Request can't be handled since icwmpd is still in init state"); - return 0; - } - if (ctx == NULL) return -1; struct blob_attr *tb[__COMMAND_MAX] = {0}; @@ -219,7 +214,7 @@ static void bb_add_icwmp_status(struct blob_buf *bb) return; } void *tbl = blobmsg_open_table(bb, "cwmp"); - bb_add_string(bb, "status", cwmp_main->init_complete ? "up" : "init"); + bb_add_string(bb, "status", "up"); bb_add_string(bb, "start_time", get_time(cwmp_main->start_time)); bb_add_string(bb, "acs_url", cwmp_main->conf.acs_url); blobmsg_close_table(bb, tbl); @@ -320,14 +315,6 @@ static int icwmp_inform_handler(struct ubus_context *ctx, struct ubus_object *ob CWMP_MEMSET(&bb, 0, sizeof(struct blob_buf)); blob_buf_init(&bb, 0); - if (cwmp_main->init_complete == false) { - CWMP_LOG(WARNING, "Inform can't be sent since icwmpd is still in init state"); - blobmsg_add_u32(&bb, "status", -1); - blobmsg_add_string(&bb, "info", "icwmpd is still in init state"); - goto end; - } - - struct blob_attr *tb[__INFORM_MAX] = {0}; bool is_get_rpc = false; char *event = "";