mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Enable tr069 over usp
This commit is contained in:
parent
0e185edb0d
commit
798dfcf2a2
5 changed files with 35 additions and 9 deletions
13
src/common.c
13
src/common.c
|
|
@ -1226,3 +1226,16 @@ int regex_replace(char **str, const char *pattern, const char *replace, int *mat
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void stop_service(void)
|
||||
{
|
||||
struct blob_buf bb;
|
||||
|
||||
memset(&bb, 0, sizeof(struct blob_buf));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
blobmsg_add_string(&bb, "name", "icwmpd");
|
||||
|
||||
icwmp_ubus_invoke("service", "delete", bb.head, NULL, NULL);
|
||||
blob_buf_free(&bb);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ typedef struct config {
|
|||
unsigned int active_notif_throttle;
|
||||
unsigned int md_notif_limit;
|
||||
|
||||
bool enable;
|
||||
bool dhcp_discovery;
|
||||
bool periodic_enable;
|
||||
bool periodic_notify_enable;
|
||||
|
|
@ -685,4 +686,5 @@ void *cwmp_memset(void *src, int val, size_t size, const char *origin, int pos);
|
|||
void *cwmp_memcpy(void *dst, const void *src, size_t size, const char *origin, int pos);
|
||||
void cwmp_restart_service(struct uloop_timeout *timeout __attribute__((unused)));
|
||||
int regex_replace(char **str, const char *pattern, const char *replace, int *match_count);
|
||||
void stop_service(void);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -83,14 +83,12 @@ int get_preinit_config()
|
|||
}
|
||||
|
||||
|
||||
static int global_conf_init()
|
||||
static void global_conf_init()
|
||||
{
|
||||
get_global_config();
|
||||
|
||||
/* Launch reboot methods if needed */
|
||||
launch_reboot_methods();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cwmp_config_load()
|
||||
|
|
@ -148,9 +146,7 @@ int cwmp_config_reload()
|
|||
{
|
||||
CWMP_MEMSET(&cwmp_main->env, 0, sizeof(struct env));
|
||||
|
||||
int err = global_conf_init();
|
||||
if (err != CWMP_OK)
|
||||
return err;
|
||||
global_conf_init();
|
||||
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,8 +608,7 @@ int cwmp_apply_acs_changes(void)
|
|||
{
|
||||
int error;
|
||||
|
||||
if ((error = cwmp_config_reload()))
|
||||
return error;
|
||||
cwmp_config_reload();
|
||||
|
||||
if ((error = cwmp_root_cause_events()))
|
||||
return error;
|
||||
|
|
|
|||
|
|
@ -239,6 +239,7 @@ static void config_get_cpe_elements(struct uci_section *s)
|
|||
UCI_CPE_KEEP_SETTINGS,
|
||||
UCI_CPE_DEFAULT_WAN_IFACE,
|
||||
UCI_CPE_CLOCK_SYNC_TIMEOUT,
|
||||
UCI_CPE_ENABLE,
|
||||
__MAX_NUM_UCI_CPE_ATTRS,
|
||||
};
|
||||
|
||||
|
|
@ -261,7 +262,8 @@ static void config_get_cpe_elements(struct uci_section *s)
|
|||
[UCI_CPE_FORCE_IPV4] = { .name = "force_ipv4", .type = UCI_TYPE_STRING },
|
||||
[UCI_CPE_KEEP_SETTINGS] = { .name = "fw_upgrade_keep_settings", .type = UCI_TYPE_STRING },
|
||||
[UCI_CPE_DEFAULT_WAN_IFACE] = { .name = "default_wan_interface", .type = UCI_TYPE_STRING },
|
||||
[UCI_CPE_CLOCK_SYNC_TIMEOUT] = { .name = "clock_sync_timeout", .type = UCI_TYPE_STRING }
|
||||
[UCI_CPE_CLOCK_SYNC_TIMEOUT] = { .name = "clock_sync_timeout", .type = UCI_TYPE_STRING },
|
||||
[UCI_CPE_ENABLE] = { .name = "enable", .type = UCI_TYPE_STRING }
|
||||
};
|
||||
|
||||
struct uci_option *cpe_tb[__MAX_NUM_UCI_CPE_ATTRS];
|
||||
|
|
@ -390,6 +392,14 @@ static void config_get_cpe_elements(struct uci_section *s)
|
|||
}
|
||||
|
||||
CWMP_LOG(DEBUG, "CWMP CONFIG - cpe clock_sync_timeout: %d", cwmp_main->conf.clock_sync_timeout);
|
||||
|
||||
cwmp_main->conf.enable = true;
|
||||
char *cwmp_enable = get_value_from_uci_option(cpe_tb[UCI_CPE_ENABLE]);
|
||||
if (CWMP_STRLEN(cwmp_enable) != 0) {
|
||||
cwmp_main->conf.enable = str_to_bool(cwmp_enable);
|
||||
}
|
||||
|
||||
CWMP_LOG(DEBUG, "CWMP CONFIG - cpe enable: %d", cwmp_main->conf.enable);
|
||||
}
|
||||
|
||||
static void config_get_lwn_elements(struct uci_section *s)
|
||||
|
|
@ -899,6 +909,12 @@ exit:
|
|||
uci_free_context(uci_ctx);
|
||||
}
|
||||
pthread_mutex_unlock(&mutex_config_load);
|
||||
|
||||
if (cwmp_main->conf.enable == false) {
|
||||
CWMP_LOG(INFO, "icwmp service has been disabled.");
|
||||
stop_service();
|
||||
}
|
||||
|
||||
return CWMP_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue