diff --git a/dm/dmcwmp.c b/dm/dmcwmp.c index cdcfe37..cfea4ba 100644 --- a/dm/dmcwmp.c +++ b/dm/dmcwmp.c @@ -596,6 +596,7 @@ char *get_last_instance_lev2_icwmpd(char *package, char *section, char* dmmap_pa char *instance = NULL; char *last_inst = NULL, *v= NULL; + check_create_dmmap_package(dmmap_package); uci_foreach_option_cont(package, section, opt_check, value_check, s) { get_dmmap_section_of_config_section(dmmap_package, section, section_name(s), &dmmap_section); if(dmmap_section == NULL){ diff --git a/dm/dmtree/common/x_inteno_se_dropbear.c b/dm/dmtree/common/x_inteno_se_dropbear.c index c85177a..3c72a66 100644 --- a/dm/dmtree/common/x_inteno_se_dropbear.c +++ b/dm/dmtree/common/x_inteno_se_dropbear.c @@ -41,10 +41,13 @@ int browseXIntenoDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d { char *idropbear = NULL, *idropbear_last = NULL; struct uci_section *s = NULL; + struct dmmap_dup *p; + LIST_HEAD(dup_list); - uci_foreach_sections("dropbear", "dropbear", s) { - idropbear = handle_update_instance(1, dmctx, &idropbear_last, update_instance_alias, 3, s, "dropbearinstance", "dropbearalias"); - if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, idropbear) == DM_STOP) + synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list); + list_for_each_entry(p, &dup_list, list) { + idropbear = handle_update_instance(1, dmctx, &idropbear_last, update_instance_alias, 3, p->dmmap_section, "dropbearinstance", "dropbearalias"); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, idropbear) == DM_STOP) break; } return 0; @@ -366,17 +369,23 @@ int set_x_inteno_dropbear_banner_file(char *refparam, struct dmctx *ctx, void *d int get_x_inteno_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - dmuci_get_value_by_section_string((struct uci_section *)data, "dropbearalias", value); + struct uci_section *dmmap_section; + + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); + dmuci_get_value_by_section_string(dmmap_section, "dropbearalias", value); return 0; } int set_x_inteno_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) { + struct uci_section *dmmap_section; + + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); switch (action) { case VALUECHECK: return 0; case VALUESET: - dmuci_set_value_by_section((struct uci_section *)data, "dropbearalias", value); + dmuci_set_value_by_section(dmmap_section, "dropbearalias", value); return 0; } return 0; @@ -385,11 +394,13 @@ int set_x_inteno_dropbear_alias(char *refparam, struct dmctx *ctx, void *data, c /***** ADD DEL OBJ *******/ int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char **instancepara) { - char *value; + char *value, *v; char *instance; - struct uci_section *dropbear_sec = NULL; + struct uci_section *dropbear_sec = NULL, *dmmap_sec= NULL; + + check_create_dmmap_package("dmmap_dropbear"); + instance = get_last_instance_icwmpd("dmmap_dropbear", "dropbear", "dropbearinstance"); - instance = get_last_instance("dropbear", "dropbear", "dropbearinstance"); dmuci_add_section("dropbear", "dropbear", &dropbear_sec, &value); dmuci_set_value_by_section(dropbear_sec, "verbose", "0"); dmuci_set_value_by_section(dropbear_sec, "Port", "22"); @@ -397,7 +408,10 @@ int add_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char ** dmuci_set_value_by_section(dropbear_sec, "GatewayPorts", "0"); dmuci_set_value_by_section(dropbear_sec, "SSHKeepAlive", "300"); dmuci_set_value_by_section(dropbear_sec, "IdleTimeout", "0"); - *instancepara = update_instance(dropbear_sec, instance, "dropbearinstance"); + + dmuci_add_section_icwmpd("dmmap_dropbear", "dropbear", &dmmap_sec, &v); + dmuci_set_value_by_section(dmmap_sec, "section_name", section_name(dropbear_sec)); + *instancepara = update_instance_icwmpd(dmmap_sec, instance, "dropbearinstance"); return 0; } @@ -405,20 +419,32 @@ int delete_dropbear_instance(char *refparam, struct dmctx *ctx, void *data, char { struct uci_section *s = NULL; struct uci_section *ss = NULL; + struct uci_section *dmmap_section; int found = 0; + switch (del_action) { case DEL_INST: + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name((struct uci_section *)data), &dmmap_section); + dmuci_delete_by_section(dmmap_section, NULL, NULL); dmuci_delete_by_section((struct uci_section *)data, NULL, NULL); break; case DEL_ALL: uci_foreach_sections("dropbear", "dropbear", s) { - if (found != 0) + if (found != 0){ + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name(ss), &dmmap_section); + if(dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); dmuci_delete_by_section(ss, NULL, NULL); + } ss = s; found++; } - if (ss != NULL) + if (ss != NULL){ + get_dmmap_section_of_config_section("dmmap_dropbear", "dropbear", section_name(ss), &dmmap_section); + if(dmmap_section != NULL) + dmuci_delete_by_section(dmmap_section, NULL, NULL); dmuci_delete_by_section(ss, NULL, NULL); + } return 0; } return 0; diff --git a/dm/dmtree/tr098/landevice.c b/dm/dmtree/tr098/landevice.c index 7202e8a..06fdc12 100644 --- a/dm/dmtree/tr098/landevice.c +++ b/dm/dmtree/tr098/landevice.c @@ -3769,14 +3769,14 @@ int browseWlanConfigurationInst(struct dmctx *dmctx, DMNODE *parent_node, void * LIST_HEAD(dup_list); lan_sec = section_name(lanargs->ldlansection); - iwlan = get_last_instance_lev2("wireless", "wifi-iface", "lwlaninstance", "network", lan_sec); + iwlan = get_last_instance_lev2_icwmpd("wireless", "wifi-iface", "dmmap_wireless", "lwlaninstance", "network", lan_sec); + synchronize_specific_config_sections_with_dmmap("wireless", "wifi-iface", "dmmap_wireless", &dup_list); uci_foreach_sections("wireless", "wifi-device", ss) { int wlctl_num=0; list_for_each_entry(p, &dup_list, list) { dmuci_get_value_by_section_string(p->config_section, "device", &wifi_iface_device); if(strcmp(wifi_iface_device, section_name(ss)) != 0) continue; - //uci_foreach_option_eq("wireless", "wifi-iface", "device", section_name(ss), sss) { dmuci_get_value_by_section_string(p->config_section, "network", &network); if (strcmp(network, lan_sec) != 0) continue; diff --git a/dm/dmtree/tr098/layer_2_bridging.c b/dm/dmtree/tr098/layer_2_bridging.c index db5c665..7e8f547 100644 --- a/dm/dmtree/tr098/layer_2_bridging.c +++ b/dm/dmtree/tr098/layer_2_bridging.c @@ -263,7 +263,7 @@ int synchronize_availableinterfaceInst(struct dmctx *dmctx) } } #else - synchronize_specific_config_sections_with_dmmap("ports", wan_interface_tab[i].section, "dmmap_ports", &dup_list); + synchronize_specific_config_sections_with_dmmap("ports", "ethport", "dmmap_ports", &dup_list); list_for_each_entry(p, &dup_list, list) { if(!strcmp(p->config_section->e.name, "WAN")){ waninstance = update_instance(p->dmmap_section, waninstance, "waninstance");