mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
bbf: improve and cleanup the code
- update_instance_alias: read config and type section from the passed section in handle_update_instance - remove append_dot_to_string() function
This commit is contained in:
parent
906840a5c2
commit
5d10fba083
44 changed files with 447 additions and 517 deletions
|
|
@ -56,17 +56,15 @@ void init_diagnostics_operation(char *sec_name, char *operation_path)
|
|||
|
||||
void set_diagnostics_interface_option(struct dmctx *ctx, char *sec_name, char *value)
|
||||
{
|
||||
char interface[64] = {0}, *linker = NULL;
|
||||
char *linker = NULL;
|
||||
|
||||
if (value[0] == 0)
|
||||
return;
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
|
||||
if (strncmp(interface, "Device.IP.Interface.", 20) != 0)
|
||||
if (strncmp(value, "Device.IP.Interface.", 20) != 0)
|
||||
return;
|
||||
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
|
||||
if (linker && *linker) {
|
||||
set_diagnostics_option(sec_name, "interface", linker);
|
||||
|
|
|
|||
|
|
@ -519,6 +519,7 @@ int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, cha
|
|||
|
||||
dm_entry_get_linker(&dmctx);
|
||||
*value = dmctx.linker_param;
|
||||
|
||||
dm_ctx_clean_sub(&dmctx);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -526,14 +527,16 @@ int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, cha
|
|||
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value)
|
||||
{
|
||||
struct dmctx dmctx = {0};
|
||||
char linker[256] = {0};
|
||||
*value = NULL;
|
||||
|
||||
if (!param || param[0] == '\0') {
|
||||
if (!param || param[0] == '\0')
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(linker, sizeof(linker), "%s%c", param, (param[strlen(param) - 1] != '.') ? '.' : '\0');
|
||||
|
||||
dm_ctx_init_sub(&dmctx, ctx->dm_type, ctx->amd_version, ctx->instance_mode);
|
||||
dmctx.in_param = param;
|
||||
dmctx.in_param = linker;
|
||||
|
||||
dm_entry_get_linker_value(&dmctx);
|
||||
*value = dmctx.linker;
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ int browse_obj(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *
|
|||
synchronize_specific_config_sections_with_dmmap(arg2, arg3, arg4, &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, buf_instance, buf_alias, arg4, arg3);
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, buf_instance, buf_alias);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ static int browseServicesVoiceServiceVoIPProfileInst(struct dmctx *dmctx, DMNODE
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "clientinstance", "clientalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -105,8 +105,8 @@ static int browseServicesVoiceServiceCodecProfileInst(struct dmctx *dmctx, DMNOD
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "codec_profile", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "codecprofileinstance", "codecprofilealias", "dmmap_asterisk", "codec_profile");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "codecprofileinstance", "codecprofilealias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -219,8 +219,10 @@ static int browseVoiceServiceInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
|
||||
update_section_list(DMMAP,"voice_service", NULL, 1, NULL, NULL, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap", "voice_service", s) {
|
||||
vs = handle_update_instance(1, dmctx, &vs_last, update_instance_alias, 5,
|
||||
s, "vsinstance", "vsalias", "dmmap", "voice_service");
|
||||
|
||||
vs = handle_update_instance(1, dmctx, &vs_last, update_instance_alias, 3,
|
||||
s, "vsinstance", "vsalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, vs) == DM_STOP)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ static int browseServicesVoiceServiceCallControlLineInst(struct dmctx *dmctx, DM
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "tel_line", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "lineinstance", "linealias", "dmmap_asterisk", "tel_line");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "lineinstance", "linealias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -54,8 +54,8 @@ static int browseServicesVoiceServiceCallControlIncomingMapInst(struct dmctx *dm
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "clientinstance", "clientalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -74,8 +74,8 @@ static int browseServicesVoiceServiceCallControlOutgoingMapInst(struct dmctx *dm
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "clientinstance", "clientalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -94,8 +94,8 @@ static int browseServicesVoiceServiceCallControlNumberingPlanInst(struct dmctx *
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "tel_advanced", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "numberingplaninstance", "numberingplanalias", "dmmap_asterisk", "tel_advanced");
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "numberingplaninstance", "numberingplanalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -114,8 +114,8 @@ static int browseServicesVoiceServiceCallControlCallingFeaturesSetInst(struct dm
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "advanced_features", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "setinstance", "setalias", "dmmap_asterisk", "advanced_features");
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "setinstance", "setalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -134,8 +134,8 @@ static int browseServicesVoiceServiceCallControlCallingFeaturesSetSCREJInst(stru
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "call_filter_rule_incoming", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(3, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "screjinstance", "screjalias", "dmmap_asterisk", "call_filter_rule_incoming");
|
||||
inst = handle_update_instance(3, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "screjinstance", "screjalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -336,7 +336,6 @@ static int set_ServicesVoiceServiceCallControlLine_Provider(char *refparam, stru
|
|||
{
|
||||
char sip_client[64] = "Device.Services.VoiceService.1.SIP.Client.";
|
||||
size_t client_len = strlen(sip_client);
|
||||
char lower_layer[64] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -344,11 +343,10 @@ static int set_ServicesVoiceServiceCallControlLine_Provider(char *refparam, stru
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
if (strncmp(lower_layer, sip_client, client_len) == 0) {
|
||||
if (strncmp(value, sip_client, client_len) == 0) {
|
||||
/* check linker is available */
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "sip_account", linker);
|
||||
dmfree(linker);
|
||||
|
|
@ -389,7 +387,7 @@ static int get_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, s
|
|||
|
||||
static int set_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *dup = NULL, *token = NULL, *saveptr = NULL, *p, buf[16] = { 0, 0 }, lower_layer[64] = {0};
|
||||
char *dup = NULL, *token = NULL, *saveptr = NULL, *p, buf[16] = { 0, 0 };
|
||||
char call_line[64] = "Device.Services.VoiceService.1.CallControl.Line.";
|
||||
size_t line_len = strlen(call_line);
|
||||
|
||||
|
|
@ -407,12 +405,10 @@ static int set_ServicesVoiceServiceCallControlIncomingMap_Line(char *refparam, s
|
|||
p = buf;
|
||||
for (token = strtok_r(value, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) {
|
||||
|
||||
append_dot_to_string(lower_layer, token, sizeof(lower_layer));
|
||||
|
||||
if (strncmp(lower_layer, call_line, line_len) == 0) {
|
||||
if (strncmp(token, call_line, line_len) == 0) {
|
||||
/* check linker is available */
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, token, &linker);
|
||||
if (!linker || linker[0] == '\0')
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ static int browseServicesVoiceServicePOTSFXSInst(struct dmctx *dmctx, DMNODE *pa
|
|||
dmuci_get_value_by_section_string(p->config_section, "name", &line_name);
|
||||
if (*line_name == '\0' || strcasestr(line_name, "DECT") == NULL) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5, p->dmmap_section,
|
||||
"fxsinstance", "fxsalias", "dmmap_asterisk", "tel_line");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "fxsinstance", "fxsalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ static int browseServicesVoiceServiceSIPClientInst(struct dmctx *dmctx, DMNODE *
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "clientinstance", "clientalias", "dmmap_asterisk", "sip_service_provider");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "clientinstance", "clientalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -63,8 +63,8 @@ static int browseServicesVoiceServiceSIPNetworkInst(struct dmctx *dmctx, DMNODE
|
|||
synchronize_specific_config_sections_with_dmmap("asterisk", "sip_service_provider", "dmmap_asterisk", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 5,
|
||||
p->dmmap_section, "networkinstance", "networkalias", "dmmap_asterisk", "sip_service_provider");
|
||||
inst = handle_update_instance(2, dmctx, &inst_last, update_instance_alias, 3,
|
||||
p->dmmap_section, "networkinstance", "networkalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1593,8 +1593,8 @@ static int browseIPDiagnosticsTraceRouteRouteHopsInst(struct dmctx *dmctx, DMNOD
|
|||
|
||||
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "RouteHops", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
(void *)s, "routehop_instance", "routehop_alias", DMMAP_DIAGNOSTIGS, "RouteHops");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "routehop_instance", "routehop_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -1609,8 +1609,8 @@ static int browseIPDiagnosticsDownloadDiagnosticsPerConnectionResultInst(struct
|
|||
|
||||
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "DownloadPerConnection", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
(void *)s, "perconnection_instance", "perconnection_alias", DMMAP_DIAGNOSTIGS, "DownloadPerConnection");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "perconnection_instance", "perconnection_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -1625,8 +1625,8 @@ static int browseIPDiagnosticsUploadDiagnosticsPerConnectionResultInst(struct dm
|
|||
|
||||
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "UploadPerConnection", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
(void *)s, "perconnection_instance", "perconnection_alias", DMMAP_DIAGNOSTIGS, "UploadPerConnection");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "perconnection_instance", "perconnection_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -359,8 +359,8 @@ static int browseAtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmuci_get_value_by_section_string(p->config_section, "device", &ifname);
|
||||
init_atm_link(&curr_atm_args, p->config_section, ifname);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "atmlinkinstance", "atmlinkalias", "dmmap_dsl", "atm-device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "atmlinkinstance", "atmlinkalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_atm_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -641,20 +641,18 @@ static int remove_vlanid_from_ifname_list(struct uci_section *bridge_sec, char *
|
|||
|
||||
static void set_lowerlayers_management_port(struct dmctx *ctx, void *data, char *value)
|
||||
{
|
||||
char lower_layer[256] = {0}, lower_layer_path[256] = {0};
|
||||
char lower_layer_path[256] = {0};
|
||||
char *pch = NULL, *spch = NULL, *p, new_device[512] = { 0, 0 };
|
||||
|
||||
p = new_device;
|
||||
for (pch = strtok_r(value, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) {
|
||||
|
||||
append_dot_to_string(lower_layer, pch, sizeof(lower_layer));
|
||||
|
||||
snprintf(lower_layer_path, sizeof(lower_layer_path), "Device.Bridging.Bridge.%s.Port.", ((struct bridge_port_args *)data)->br_inst);
|
||||
|
||||
if (strncmp(lower_layer, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
if (strncmp(pch, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
/* check linker is available */
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, pch, &linker);
|
||||
if (!linker || linker[0] == '\0')
|
||||
continue;
|
||||
|
||||
|
|
@ -1427,7 +1425,7 @@ static int get_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx,
|
|||
|
||||
static int set_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, *management;
|
||||
char *management = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1436,16 +1434,14 @@ static int set_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx,
|
|||
return 0;
|
||||
case VALUESET:
|
||||
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_dmmap_sec, "management", &management);
|
||||
if (strcmp(management, "1") == 0) {
|
||||
if (management && strcmp(management, "1") == 0) {
|
||||
/* Management Port ==> true */
|
||||
set_lowerlayers_management_port(ctx, data, value);
|
||||
} else {
|
||||
/* Management Port ==> false */
|
||||
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (!linker || linker[0] == '\0')
|
||||
return 0;
|
||||
|
||||
|
|
@ -2028,7 +2024,7 @@ static int get_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
static int set_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, lower_layer_path[256] = {0};
|
||||
char lower_layer_path[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -2036,15 +2032,14 @@ static int set_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, vo
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
snprintf(lower_layer_path, sizeof(lower_layer_path), "Device.Bridging.Bridge.%s.VLAN.", ((struct bridge_vlanport_args *)data)->br_inst);
|
||||
|
||||
/* Check the path object is correct or no */
|
||||
if (strncmp(lower_layer, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
if (strncmp(value, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
/* Check linker exist */
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (!linker)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (!linker || *linker == '\0')
|
||||
return 0;
|
||||
|
||||
char *br = strstr(linker, ":vlan_");
|
||||
|
|
@ -2112,7 +2107,7 @@ static int get_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
static int set_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, lower_layer_path[256] = {0};
|
||||
char lower_layer_path[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -2120,13 +2115,12 @@ static int set_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, vo
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
snprintf(lower_layer_path, sizeof(lower_layer_path), "Device.Bridging.Bridge.%s.Port.", ((struct bridge_vlanport_args *)data)->br_inst);
|
||||
|
||||
if (strncmp(lower_layer, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
if (strncmp(value, lower_layer_path, strlen(lower_layer_path)) == 0) {
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (!linker)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (!linker || *linker == '\0')
|
||||
return 0;
|
||||
|
||||
char *br = strchr(linker, ':');
|
||||
|
|
@ -2239,8 +2233,8 @@ static int browseBridgingBridgeInst(struct dmctx *dmctx, DMNODE *parent_node, vo
|
|||
synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "type", "bridge", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "bridge_instance", "bridge_alias", "dmmap_network", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "bridge_instance", "bridge_alias");
|
||||
|
||||
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
|
||||
init_bridging_args(&curr_bridging_args, p->config_section, ifname, inst);
|
||||
|
|
@ -2268,8 +2262,8 @@ static int browseBridgingBridgePortInst(struct dmctx *dmctx, DMNODE *parent_node
|
|||
browse_args.option = "br_inst";
|
||||
browse_args.value = br_args->br_inst;
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
s, "bridge_port_instance", "bridge_port_alias", "dmmap_bridge_port", "bridge_port",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "bridge_port_instance", "bridge_port_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_port_args, inst) == DM_STOP)
|
||||
|
|
@ -2293,8 +2287,8 @@ static int browseBridgingBridgeVLANInst(struct dmctx *dmctx, DMNODE *parent_node
|
|||
browse_args.option = "br_inst";
|
||||
browse_args.value = br_args->br_inst;
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
s, "bridge_vlan_instance", "bridge_vlan_alias", "dmmap_bridge_vlanport", "bridge_vlan",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "bridge_vlan_instance", "bridge_vlan_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlan_args, inst) == DM_STOP)
|
||||
|
|
@ -2319,8 +2313,8 @@ static int browseBridgingBridgeVLANPortInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "br_inst";
|
||||
browse_args.value = br_args->br_inst;
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
s, "bridge_vlanport_instance", "bridge_vlanport_alias", "dmmap_bridge_vlanport", "bridge_vlanport",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "bridge_vlanport_instance", "bridge_vlanport_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_bridge_vlanport_args, inst) == DM_STOP)
|
||||
|
|
|
|||
|
|
@ -351,8 +351,8 @@ static int browseVcfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
|
|||
continue;
|
||||
}
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "vcf_instance", "vcf_alias", "dmmap", "vcf");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "vcf_instance", "vcf_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -389,8 +389,8 @@ static int browseVlfInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_da
|
|||
uci_path_foreach_sections(bbfdm, "dmmap", "vlf", dm_sec) {
|
||||
char *inst, *max_inst = NULL;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dm_sec, "vlf_instance", "vlf_alias", "dmmap", "vlf");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dm_sec, "vlf_instance", "vlf_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)dm_sec, inst) == DM_STOP){
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -871,8 +871,7 @@ static int get_DHCPv4ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
static int set_DHCPv4ServerPool_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0};
|
||||
char *linker;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -880,9 +879,8 @@ static int set_DHCPv4ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct dhcp_args *)data)->dhcp_sec, "interface", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
|
|
@ -1729,25 +1727,24 @@ static int get_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
static int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *s;
|
||||
struct uci_section *s = NULL;
|
||||
char *linker = NULL, *v;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
|
||||
if(strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || linker[0] == '\0')
|
||||
return FAULT_9007;
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_dhcp_client", "interface", s) {
|
||||
dmuci_get_value_by_section_string(s, "section_name", &v);
|
||||
if(strcmp(v, linker) == 0)
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if(strcmp(section_name(s), linker) == 0){
|
||||
dmuci_get_value_by_section_string(s, "proto", &v);
|
||||
|
|
@ -1757,8 +1754,7 @@ static int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
dmuci_set_value_by_section_bbfdm(((struct dhcp_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2410,27 +2406,24 @@ static int get_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx
|
|||
|
||||
static int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *s;
|
||||
struct uci_section *s = NULL;
|
||||
char *linker = NULL, *v;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
|
||||
if (strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || linker[0] == '\0')
|
||||
return FAULT_9007;
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker == NULL)
|
||||
return FAULT_9007;
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_dhcp_relay", "interface", s) {
|
||||
dmuci_get_value_by_section_string(s, "section_name", &v);
|
||||
if (strcmp(v, linker) == 0)
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if (strcmp(section_name(s), linker) == 0) {
|
||||
dmuci_get_value_by_section_string(s, "proto", &v);
|
||||
|
|
@ -2440,8 +2433,7 @@ static int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
dmuci_set_value_by_section_bbfdm(((struct dhcp_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2698,8 +2690,8 @@ static int browseDHCPv4ServerPoolInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
|
||||
dhcp_leases_assign_to_interface(&curr_dhcp_args, &leases, interface);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "dhcp_instance", "dhcp_alias", "dmmap_dhcp", "dhcp");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "dhcp_instance", "dhcp_alias");
|
||||
|
||||
dmuci_get_value_by_section_string(p->dmmap_section, "order", &v);
|
||||
if (v == NULL || strlen(v) == 0)
|
||||
|
|
@ -2736,8 +2728,8 @@ static int browseDHCPv4ServerPoolStaticAddressInst(struct dmctx *dmctx, DMNODE *
|
|||
browse_args.option = "dhcp";
|
||||
browse_args.value = ((struct dhcp_args *)prev_data)->interface;
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "dhcp_host_instance", "dhcp_host_alias", "dmmap_dhcp", "host",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "dhcp_host_instance", "dhcp_host_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_dhcp_host_args, inst) == DM_STOP)
|
||||
|
|
@ -2892,8 +2884,8 @@ static int browseDHCPv4ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
dhcp_client_arg.dhcp_client_conf = p->config_section;
|
||||
dhcp_client_arg.dhcp_client_dm = p->dmmap_section;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "bbf_dhcpv4client_instance", "bbf_dhcpv4client_alias", "dmmap_dhcp_client", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "bbf_dhcpv4client_instance", "bbf_dhcpv4client_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_arg, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -2947,8 +2939,8 @@ static int browseDHCPv4ClientSentOptionInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name(dhcp_client_args->dhcp_client_conf);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_sect, "bbf_dhcpv4_sentopt_instance", "bbf_dhcpv4_sentopt_alias", "dmmap_dhcp_client", "send_option",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "bbf_dhcpv4_sentopt_instance", "bbf_dhcpv4_sentopt_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
|
||||
|
|
@ -2988,8 +2980,8 @@ static int browseDHCPv4ClientReqOptionInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name(dhcp_client_args->dhcp_client_conf);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_sect, "bbf_dhcpv4_reqtopt_instance", "bbf_dhcpv4_reqtopt_alias", "dmmap_dhcp_client", "req_option",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "bbf_dhcpv4_reqtopt_instance", "bbf_dhcpv4_reqtopt_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
|
||||
|
|
@ -3045,8 +3037,8 @@ static int browseDHCPv4ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name(curr_dhcp_args->dhcp_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_sect, "bbf_dhcpv4_servpool_option_instance", "bbf_dhcpv4_servpool_option_alias", "dmmap_dhcp", "servpool_option",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "bbf_dhcpv4_servpool_option_instance", "bbf_dhcpv4_servpool_option_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
|
||||
|
|
@ -3128,8 +3120,8 @@ static int browseDHCPv4RelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
dhcp_relay_arg.dhcp_client_dm= p->dmmap_section;
|
||||
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "bbf_dhcpv4relay_instance", "bbf_dhcpv4relay_alias", "dmmap_dhcp_relay", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "bbf_dhcpv4relay_instance", "bbf_dhcpv4relay_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_relay_arg, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ static int browseDHCPv6ClientInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
dhcpv6_client_arg.dhcp_client_dm = p->dmmap_section;
|
||||
dhcpv6_client_arg.ip = dmstrdup(ipv6addr?ipv6addr:"");
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "bbf_dhcpv6client_instance", "bbf_dhcpv6client_alias", "dmmap_dhcpv6", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "bbf_dhcpv6client_instance", "bbf_dhcpv6client_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcpv6_client_arg, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -157,8 +157,8 @@ static int browseDHCPv6ServerPoolInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
dmuci_get_value_by_section_string(p->config_section, "interface", &interface);
|
||||
init_dhcpv6_args(&curr_dhcp6_args, p->config_section, interface);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "dhcpv6_serv_pool_instance", "dhcpv6_serv_pool_alias", "dmmap_dhcpv6", "dhcp");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "dhcpv6_serv_pool_instance", "dhcpv6_serv_pool_alias");
|
||||
|
||||
dmuci_get_value_by_section_string(p->dmmap_section, "order", &v);
|
||||
if (v == NULL || strlen(v) == 0)
|
||||
|
|
@ -249,8 +249,8 @@ static int browseDHCPv6ServerPoolOptionInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name(curr_dhcp_args->dhcp_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_sect, "bbf_dhcpv6_servpool_option_instance", "bbf_dhcpv6_servpool_option_alias", "dmmap_dhcpv6", "servpool_option",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "bbf_dhcpv6_servpool_option_instance", "bbf_dhcpv6_servpool_option_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&dhcp_client_opt_args, inst) == DM_STOP)
|
||||
|
|
@ -558,25 +558,24 @@ static int get_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
static int set_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
struct uci_section *s;
|
||||
struct uci_section *s = NULL;
|
||||
char *linker = NULL, *v;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
|
||||
if (strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || linker[0] == '\0')
|
||||
return FAULT_9007;
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_dhcpv6", "interface", s) {
|
||||
dmuci_get_value_by_section_string(s, "section_name", &v);
|
||||
if (strcmp(v, linker) == 0)
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if (strcmp(section_name(s), linker) == 0) {
|
||||
dmuci_get_value_by_section_string(s, "proto", &v);
|
||||
|
|
@ -586,8 +585,7 @@ static int set_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
dmuci_set_value_by_section_bbfdm(((struct dhcpv6_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -908,7 +906,7 @@ static int get_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
static int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *linker;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -916,13 +914,12 @@ static int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct dhcpv6_args *)data)->dhcp_sec, "interface", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ static int browseServerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
|
|||
dmmap_synchronizeDNSClientRelayServer(dmctx, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_dns", "dns_server", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "dns_server_instance", "dns_server_alias", "dmmap_dns", "dns_server");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "dns_server_instance", "dns_server_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -126,8 +126,8 @@ static int browseRelayForwardingInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
dmmap_synchronizeDNSClientRelayServer(dmctx, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_dns", "dns_server", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "dns_server_instance", "dns_server_alias", "dmmap_dns", "dns_server");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "dns_server_instance", "dns_server_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -142,8 +142,8 @@ static int browseResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
|
|||
|
||||
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "NSLookupResult", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "nslookup_res_instance", "nslookup_res_alias", DMMAP_DIAGNOSTIGS, "NSLookupResult");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "nslookup_res_instance", "nslookup_res_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -627,8 +627,7 @@ static int set_server_dns_server(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
static int set_server_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *str, *ointerface, *ip, *interface;
|
||||
char intf[256] = {0};
|
||||
char *str, *ointerface, *ip, *interface = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -636,8 +635,10 @@ static int set_server_interface(char *refparam, struct dmctx *ctx, void *data, c
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(intf, value, sizeof(intf));
|
||||
adm_entry_get_linker_value(ctx, intf, &interface);
|
||||
adm_entry_get_linker_value(ctx, value, &interface);
|
||||
if (interface == NULL && interface[0] == '\0')
|
||||
return 0;
|
||||
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &ointerface);
|
||||
if (strcmp(ointerface, interface) == 0)
|
||||
return 0;
|
||||
|
|
@ -764,8 +765,7 @@ static int set_forwarding_dns_server(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
static int set_forwarding_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *str, *ointerface, *ip, *interface;
|
||||
char intf[256] = {0};
|
||||
char *str, *ointerface, *ip, *interface = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -773,8 +773,10 @@ static int set_forwarding_interface(char *refparam, struct dmctx *ctx, void *dat
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(intf, value, sizeof(intf));
|
||||
adm_entry_get_linker_value(ctx, intf, &interface);
|
||||
adm_entry_get_linker_value(ctx, value, &interface);
|
||||
if (interface == NULL || interface[0] == '\0')
|
||||
return 0;
|
||||
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &ointerface);
|
||||
if (strcmp(ointerface, interface) == 0)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -118,8 +118,8 @@ static int browseDSLLineInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
s = update_create_dmmap_dsl_line(cur_dsl_line_args.id);
|
||||
init_dsl_line(&cur_dsl_line_args, s);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "dsl_line_instance", "dsl_line_alias", "dmmap", "dsl_line");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "dsl_line_instance", "dsl_line_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_line_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -149,8 +149,8 @@ static int browseDSLChannelInst(struct dmctx *dmctx, DMNODE *parent_node, void *
|
|||
s = update_create_dmmap_dsl_channel(cur_dsl_channel_args.id);
|
||||
init_dsl_channel(&cur_dsl_channel_args, s);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "dsl_channel_instance", "dsl_channel_alias", "dmmap", "dsl_line");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "dsl_channel_instance", "dsl_channel_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&cur_dsl_channel_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ static int browseDynamicDNSClientInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
synchronize_specific_config_sections_with_dmmap("ddns", "service", "dmmap_ddns", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "clientinstance", "clientalias", "dmmap_ddns", "service");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "clientinstance", "clientalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -133,8 +133,8 @@ static int browseDynamicDNSServerInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
dmmap_synchronizeDynamicDNSServer(dmctx, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_ddns", "ddns_server", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "serverinstance", "serveralias", "dmmap_ddns", "ddns_server");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "serverinstance", "serveralias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -469,7 +469,7 @@ static int get_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
static int set_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, *linker = NULL;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -477,12 +477,11 @@ static int set_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (linker)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "service_name", linker);
|
||||
else
|
||||
return FAULT_9005;
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -501,7 +500,7 @@ static int get_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
static int set_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -509,12 +508,11 @@ static int set_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "interface", linker);
|
||||
else
|
||||
return FAULT_9005;
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -230,8 +230,8 @@ static int browseEthernetInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
|
||||
init_eth_port(&curr_eth_port_args, p->config_section, ifname);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "eth_port_instance", "eth_port_alias", "dmmap_ports", "ethport");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "eth_port_instance", "eth_port_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_port_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -248,8 +248,8 @@ static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
dmmap_synchronizeEthernetLink(dmctx, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, DMMAP, "link", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "link_instance", "link_alias", "dmmap", "link");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "link_instance", "link_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -272,8 +272,8 @@ static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent
|
|||
if (strcmp(type, "untagged") == 0 || (*name != '\0' && !is_vlan_termination_section(name)))
|
||||
continue;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "vlan_term_instance", "vlan_term_alias", "dmmap_network", "device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "vlan_term_instance", "vlan_term_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -297,8 +297,8 @@ static int browseEthernetRMONStatsInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
if (!res) continue;
|
||||
init_eth_rmon(&curr_eth_rmon_args, p->config_section, res);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "eth_rmon_instance", "eth_rmon_alias", "dmmap_eth_rmon", "ethport");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "eth_rmon_instance", "eth_rmon_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_eth_rmon_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -978,7 +978,7 @@ static int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -986,32 +986,26 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
if (strncmp(lower_layer, "Device.Ethernet.Interface.", 26) == 0) {
|
||||
char *linker, *int_name;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
|
||||
if (strncmp(value, "Device.Ethernet.Interface.", 26) == 0) {
|
||||
struct uci_section *s = NULL;
|
||||
char *int_name = NULL;
|
||||
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "device", linker);
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &int_name);
|
||||
struct uci_section *s;
|
||||
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if (strcmp(section_name(s), int_name) == 0) {
|
||||
dmuci_set_value_by_section(s, "ifname", linker);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (strncmp(lower_layer, "Device.Bridging.Bridge.", 23) == 0) {
|
||||
char *linker;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
|
||||
} else if (strncmp(value, "Device.Bridging.Bridge.", 23) == 0) {
|
||||
char br_linker[250] = {0};
|
||||
|
||||
strncpy(br_linker, linker, sizeof(br_linker) - 1);
|
||||
|
||||
char *bridge = strchr(br_linker, ':');
|
||||
|
|
@ -1213,7 +1207,7 @@ static int get_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
|
||||
static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1221,15 +1215,13 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
if (strncmp(lower_layer, "Device.Ethernet.Link.", 21) == 0) {
|
||||
char new_name[16] = {0}, *linker = NULL, *type;
|
||||
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
|
||||
if (strncmp(value, "Device.Ethernet.Link.", 21) == 0) {
|
||||
char new_name[16] = {0}, *type;
|
||||
|
||||
// Get type option from device section
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "type", &type);
|
||||
|
||||
|
|
@ -1239,7 +1231,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
struct uci_section *s = NULL, *dmmap_s = NULL;
|
||||
char link_inst[8] = {0}, sec_name[32] = {0};
|
||||
|
||||
snprintf(link_inst, sizeof(link_inst), "%c", lower_layer[strlen(lower_layer)-2]);
|
||||
snprintf(link_inst, sizeof(link_inst), "%c", value[21]);
|
||||
snprintf(new_name, sizeof(new_name), "%s_%s", linker, link_inst);
|
||||
|
||||
if (is_name_exist_in_devices(new_name))
|
||||
|
|
@ -1281,15 +1273,10 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
// Set ifname and name options of device section
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker);
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "name", new_name);
|
||||
} else if (strncmp(lower_layer, "Device.Ethernet.VLANTermination.", 32) == 0) {
|
||||
char new_name[16] = {0}, *linker = NULL;
|
||||
|
||||
} else if (strncmp(value, "Device.Ethernet.VLANTermination.", 32) == 0) {
|
||||
struct uci_section *ss = NULL;
|
||||
char *dev_name, *inner_vid, *vid;
|
||||
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
|
||||
char *dev_name, *inner_vid, *vid, new_name[16] = {0};
|
||||
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "vid", &vid);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ static int browseLevelInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_
|
|||
|
||||
s = is_dmmap_section_exist("dmmap_firewall", "level");
|
||||
if (!s) dmuci_add_section_bbfdm("dmmap_firewall", "level", &s);
|
||||
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "firewall_level_instance", "firewall_level_alias", "dmmap_firewall", "level");
|
||||
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "firewall_level_instance", "firewall_level_alias");
|
||||
DM_LINK_INST_OBJ(dmctx, parent_node, s, "1");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ static int browseChainInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_
|
|||
|
||||
s = is_dmmap_section_exist("dmmap_firewall", "chain");
|
||||
if (!s) dmuci_add_section_bbfdm("dmmap_firewall", "chain", &s);
|
||||
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "firewall_chain_instance", "firewall_chain_alias", "dmmap_firewall", "chain");
|
||||
handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "firewall_chain_instance", "firewall_chain_alias");
|
||||
DM_LINK_INST_OBJ(dmctx, parent_node, s, "1");
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -49,8 +49,8 @@ static int browseRuleInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
|
|||
synchronize_specific_config_sections_with_dmmap("firewall", "rule", "dmmap_firewall", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "firewall_chain_rule_instance", "firewall_chain_rule_alias", "dmmap_firewall", "rule");
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "firewall_chain_rule_instance", "firewall_chain_rule_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -900,24 +900,22 @@ static int set_rule_target(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
static int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *iface, *zone, *net;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
char *iface = NULL, *zone, *net;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (iface == NULL || iface[0] == '\0')
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (iface && iface[0] != '\0') {
|
||||
struct uci_section *s = NULL;
|
||||
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "network", &net);
|
||||
if (dm_strword(net, iface)) {
|
||||
|
|
@ -926,6 +924,7 @@ static int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *da
|
|||
break;
|
||||
}
|
||||
}
|
||||
dmfree(iface);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -934,9 +933,7 @@ static int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *iface, *zone, *net;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
char *iface = NULL, *zone, *net;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -949,9 +946,10 @@ static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data
|
|||
break;
|
||||
}
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (iface != NULL && iface[0] != '\0') {
|
||||
struct uci_section *s = NULL;
|
||||
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "name", &net);
|
||||
if (dm_strword(net, iface)) {
|
||||
|
|
@ -960,6 +958,7 @@ static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data
|
|||
break;
|
||||
}
|
||||
}
|
||||
dmfree(iface);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ static int browseGRETunnelInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
synchronize_specific_config_sections_with_dmmap_eq("network", "interface", "dmmap_network", "proto", "gre", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "gretunnel_instance", "gretunnel_alias", "dmmap_network", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "gretunnel_instance", "gretunnel_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -62,8 +62,8 @@ static int browseGRETunnelInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name(dm->config_section);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "greiface_instance", "greiface_alias", "dmmap_network", "interface",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "greiface_instance", "greiface_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ static int browseIEEE1905ALForwardingTableForwardingRuleInst(struct dmctx *dmctx
|
|||
synchronize_specific_config_sections_with_dmmap("ieee1905", "forwarding_rule", "dmmap_forwarding_rule", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "forwardingruleinstance", "forwardingrulealias", "dmmap_forwarding_rule", "forwarding_rule");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "forwardingruleinstance", "forwardingrulealias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -188,8 +188,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -266,8 +266,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -329,8 +329,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -425,8 +425,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -509,8 +509,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -627,8 +627,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
snprintf(buf_instance, sizeof(buf_instance), "%d", ++instance);
|
||||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -682,8 +682,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -729,8 +729,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
@ -776,8 +776,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmmap_s = create_dmmap_interface_stack_section(buf_instance);
|
||||
|
||||
// link instance to interface stack data
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias", "dmmap_interface_stack", "interface_stack");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_s, "interface_stack_instance", "interface_stack_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&intf_stack_data, inst) == DM_STOP)
|
||||
goto end;
|
||||
|
|
|
|||
|
|
@ -433,8 +433,8 @@ static int browseIPInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
strchr(ifname, '@'))
|
||||
continue;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "ip_int_instance", "ip_int_alias", "dmmap_network", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "ip_int_instance", "ip_int_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -480,8 +480,8 @@ static int browseIPInterfaceIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv4_instance", "ipv4_alias", "dmmap_network_ipv4", "intf_ipv4",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv4_instance", "ipv4_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -497,8 +497,8 @@ static int browseIPInterfaceIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv4_instance", "ipv4_alias", "dmmap_network_ipv4", "intf_ipv4",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv4_instance", "ipv4_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -547,8 +547,8 @@ static int browseIPInterfaceIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias", "dmmap_network_ipv6", "intf_ipv6",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -564,8 +564,8 @@ static int browseIPInterfaceIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias", "dmmap_network_ipv6", "intf_ipv6",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -586,8 +586,8 @@ static int browseIPInterfaceIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias", "dmmap_network_ipv6", "intf_ipv6",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_instance", "ipv6_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -638,8 +638,8 @@ static int browseIPInterfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias", "dmmap_network_ipv6_prefix", "intf_ipv6_prefix",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -655,8 +655,8 @@ static int browseIPInterfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias", "dmmap_network_ipv6_prefix", "intf_ipv6_prefix",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -679,8 +679,8 @@ static int browseIPInterfaceIPv6PrefixInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
browse_args.option = "parent_section";
|
||||
browse_args.value = section_name(parent_sec);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias", "dmmap_network_ipv6_prefix", "intf_ipv6_prefix",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_s, "ipv6_prefix_instance", "ipv6_prefix_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_intf_ip_args, inst) == DM_STOP)
|
||||
|
|
@ -1323,7 +1323,6 @@ static int get_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *linker = NULL;
|
||||
char lower_layer[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1331,14 +1330,11 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
if (strncmp(lower_layer, "Device.Ethernet.VLANTermination.", 32) == 0) {
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
|
||||
if (strncmp(value, "Device.Ethernet.VLANTermination.", 32) == 0) {
|
||||
struct uci_section *s = NULL, *stmp = NULL;
|
||||
|
||||
// Remove the device section corresponding to this interface if exists
|
||||
|
|
@ -1377,11 +1373,7 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
// Update ifname list
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker);
|
||||
|
||||
} else if (strncmp(lower_layer, "Device.Ethernet.Link.", 21) == 0) {
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
|
||||
if (linker == NULL || *linker == '\0')
|
||||
return -1;
|
||||
} else if (strncmp(value, "Device.Ethernet.Link.", 21) == 0) {
|
||||
|
||||
// Get interface name from Ethernet.Link. object
|
||||
struct uci_section *s = NULL;
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ static int get_nat_interface_setting_interface(char *refparam, struct dmctx *ctx
|
|||
static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *iface, *pch, *pchr, buf[256] = "";
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -254,9 +253,8 @@ static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx
|
|||
strcpy(buf, value);
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "network", "");
|
||||
for(pch = strtok_r(buf, ",", &pchr); pch != NULL; pch = strtok_r(NULL, ",", &pchr)) {
|
||||
append_dot_to_string(interface, pch, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface) {
|
||||
adm_entry_get_linker_value(ctx, pch, &iface);
|
||||
if (iface && *iface) {
|
||||
dmuci_add_list_value_by_section((struct uci_section *)data, "network", iface);
|
||||
dmfree(iface);
|
||||
}
|
||||
|
|
@ -361,9 +359,7 @@ static int get_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *iface, *network, *zone;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
char *iface = NULL, *network, *zone;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -371,9 +367,10 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface[0] != '\0') {
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (iface && *iface) {
|
||||
struct uci_section *s = NULL;
|
||||
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "network", &network);
|
||||
if (is_strword_in_optionvalue(network, iface)) {
|
||||
|
|
@ -382,6 +379,7 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
break;
|
||||
}
|
||||
}
|
||||
dmfree(iface);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -580,8 +578,8 @@ static int browseInterfaceSettingInst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
synchronize_specific_config_sections_with_dmmap("firewall", "zone", "dmmap_firewall", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "interface_setting_instance", "interface_setting_alias", "dmmap_firewall", "zone");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "interface_setting_instance", "interface_setting_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -603,8 +601,8 @@ static int browsePortMappingInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
if (*target != '\0' && strcmp(target, "DNAT") != 0)
|
||||
continue;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "port_mapping_instance", "port_mapping_alias", "dmmap_firewall", "redirect");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "port_mapping_instance", "port_mapping_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ static int get_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, *linker;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -293,12 +293,11 @@ static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if(linker)
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct uci_section *)data), "ifname", linker);
|
||||
else
|
||||
return FAULT_9005;
|
||||
dmfree(linker);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -465,8 +464,8 @@ static int browseInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
if (!strstr(proto, "ppp"))
|
||||
continue;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "ppp_int_instance", "ppp_int_alias", "dmmap_network", "interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "ppp_int_instance", "ppp_int_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -253,8 +253,8 @@ static int browsePtmLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
dmuci_get_value_by_section_string(p->config_section, "device", &ifname);
|
||||
init_ptm_link(&curr_ptm_args, p->config_section, ifname);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "ptmlinkinstance", "ptmlinkalias", "dmmap_dsl", "ptm-device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "ptmlinkinstance", "ptmlinkalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_ptm_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, voi
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "classify_instance", "classifyalias", "dmmap_qos", "classify");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "classify_instance", "classifyalias");
|
||||
|
||||
//synchronizing option src_ip of uci classify section to src_mask/src_ip of dmmap's classify section
|
||||
dmuci_get_value_by_section_string(p->config_section, "src_ip", &value);
|
||||
|
|
@ -69,8 +69,8 @@ int browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, void *
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "classificationinstance", "classificationalias", "dmmap_qos", "classify");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "classificationinstance", "classificationalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -107,8 +107,8 @@ int os_browseQoSPolicerInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "policer", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "policer_instance", "policeralias", "dmmap_qos", "policer");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "policer_instance", "policeralias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -127,8 +127,8 @@ int os_browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "queue", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "queueinstance", "queuealias", "dmmap_qos", "queue");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "queueinstance", "queuealias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -151,8 +151,8 @@ int os_browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "shaper", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "shaperinstance", "shaperalias", "dmmap_qos", "shaper");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "shaperinstance", "shaperalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -1028,8 +1028,7 @@ int os_get_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *interface_linker = NULL;
|
||||
char interface[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1037,10 +1036,11 @@ int os_set_QoSClassification_Interface(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &interface_linker);
|
||||
if (interface_linker)
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", interface_linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -2468,29 +2468,21 @@ int os_get_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
int os_set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *linker = NULL;
|
||||
char policer[256] = {0};
|
||||
struct uci_section *dmmap_s = NULL;
|
||||
char *linker = NULL, link_inst[8] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(policer, value, sizeof(policer));
|
||||
|
||||
if (strncmp(policer, "Device.QoS.Policer.", 19) != 0)
|
||||
if (strncmp(value, "Device.QoS.Policer.", 19) != 0)
|
||||
return 0;
|
||||
|
||||
struct uci_section *dmmap_s = NULL;
|
||||
char link_inst[8] = {0};
|
||||
snprintf(link_inst, sizeof(link_inst), "%c", policer[strlen(policer)-2]);
|
||||
snprintf(link_inst, sizeof(link_inst), "%c", value[19]);
|
||||
get_dmmap_section_of_config_section_eq("dmmap_qos", "policer", "policer_instance", link_inst, &dmmap_s);
|
||||
|
||||
if (dmmap_s == NULL)
|
||||
break;
|
||||
|
||||
dmuci_get_value_by_section_string(dmmap_s, "section_name", &linker);
|
||||
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "policer", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -3316,8 +3308,7 @@ int os_get_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *interface_linker = NULL;
|
||||
char interface[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -3325,10 +3316,11 @@ int os_set_QoSQueue_Interface(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &interface_linker);
|
||||
if (interface_linker)
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", interface_linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -3729,8 +3721,7 @@ int os_get_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *interface_linker = NULL;
|
||||
char interface[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -3738,9 +3729,11 @@ int os_set_QoSShaper_Interface(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &interface_linker);
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", interface_linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "ifname", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ int os_browseQoSClassificationInst(struct dmctx *dmctx, DMNODE *parent_node, voi
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "classify", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "classifinstance", "classifalias", "dmmap_qos", "classify");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "classifinstance", "classifalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -152,8 +152,8 @@ int os_browseQoSQueueStatsInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
if (lastinstancestore != NULL && max_inst != NULL)
|
||||
max_inst = dmstrdup(lastinstancestore);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "queuestatsinstance", "queuestatsalias", "dmmap_qos", "qos_queue_stats");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "queuestatsinstance", "queuestatsalias");
|
||||
|
||||
lastinstancestore = dmstrdup(max_inst);
|
||||
|
||||
|
|
@ -586,8 +586,7 @@ int get_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
|
||||
int set_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *linker;
|
||||
char lower_layer[256] = {0};
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -595,9 +594,11 @@ int set_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value("qos", "Default", "default", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -3392,8 +3393,8 @@ int browseQoSQueueInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data
|
|||
synchronize_specific_config_sections_with_dmmap("qos", "class", "dmmap_qos", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "queueinstance", "queuealias", "dmmap_qos", "class");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "queueinstance", "queuealias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -3705,8 +3706,8 @@ int browseQoSShaperInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_dat
|
|||
if (limitrate == NULL || strlen(limitrate) == 0)
|
||||
continue;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "shaperinstance", "shaperalias", "dmmap_qos", "class");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "shaperinstance", "shaperalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ static int get_router_ipv4forwarding_interface_linker_parameter(char *refparam,
|
|||
|
||||
static int set_router_ipv4forwarding_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -659,9 +659,8 @@ static int set_router_ipv4forwarding_interface_linker_parameter(char *refparam,
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "interface", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
|
|
@ -793,7 +792,7 @@ static int get_RoutingRouterIPv6Forwarding_Interface(char *refparam, struct dmct
|
|||
|
||||
static int set_RoutingRouterIPv6Forwarding_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -801,9 +800,8 @@ static int set_RoutingRouterIPv6Forwarding_Interface(char *refparam, struct dmct
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "interface", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
|
|
@ -1180,8 +1178,8 @@ static int browseRouterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev
|
|||
update_section_list(DMMAP,"router", NULL, 1, NULL, NULL, NULL, NULL, NULL);
|
||||
uci_path_foreach_sections(bbfdm, "dmmap", "router", s) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "router_instance", "router_alias", "dmmap", "router");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "router_instance", "router_alias");
|
||||
|
||||
DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
}
|
||||
init_certificate(certifcates_paths[i], cert, dmmap_sect, &certificateprofile);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "security_certificate_instance", "security_certificate_alias", "dmmap_security", "security_certificate");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "security_certificate_instance", "security_certificate_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -258,8 +258,8 @@ static int browseSecurityCertificateInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
}
|
||||
init_certificate(certifcates_paths[i], cacert, dmmap_sect, &certificateprofile);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "security_certificate_instance", "security_certificate_alias", "dmmap_security", "security_certificate");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "security_certificate_instance", "security_certificate_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&certificateprofile, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -160,18 +160,16 @@ static int get_time_ntpserver5(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
static int set_time_source_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *iface = NULL;
|
||||
char *iface = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
if (iface == NULL || iface[0] == '\0')
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
dmuci_set_value("system", "ntp", "interface", iface);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,8 +137,8 @@ static int browseUPnPDiscoveryRootDeviceInst(struct dmctx *dmctx, DMNODE *parent
|
|||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_root_device_instance", "upnp_root_device_alias", "dmmap_upnp", "upnp_root_device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_root_device_instance", "upnp_root_device_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
@ -183,8 +183,8 @@ static int browseUPnPDiscoveryDeviceInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_evice_instance", "upnp_device_alias", "dmmap_upnp", "upnp_device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_evice_instance", "upnp_device_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
@ -229,8 +229,8 @@ static int browseUPnPDiscoveryServiceInst(struct dmctx *dmctx, DMNODE *parent_no
|
|||
|
||||
upnp_dev.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_service_instance", "upnp_service_alias", "dmmap_upnp", "upnp_service");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_service_instance", "upnp_service_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
@ -263,8 +263,8 @@ static int browseUPnPDescriptionDeviceDescriptionInst(struct dmctx *dmctx, DMNOD
|
|||
}
|
||||
upnp_desc.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_service_instance", "upnp_service_alias", "dmmap_upnp", "upnp_description");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_service_instance", "upnp_service_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_desc, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
@ -308,8 +308,8 @@ static int browseUPnPDescriptionDeviceInstanceInst(struct dmctx *dmctx, DMNODE *
|
|||
|
||||
upnp_dev_inst.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_device_inst_instance", "upnp_device_inst_alias", "dmmap_upnp", "upnp_device_inst");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_device_inst_instance", "upnp_device_inst_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_dev_inst, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
@ -347,8 +347,8 @@ static int browseUPnPDescriptionServiceInstanceInst(struct dmctx *dmctx, DMNODE
|
|||
|
||||
upnp_services_inst.dmmap_sect = dmmap_sect;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "upnp_service_inst_instance", "upnp_service_inst_alias", "dmmap_upnp", "upnp_service_inst");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "upnp_service_inst_instance", "upnp_service_inst_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &upnp_services_inst, inst) == DM_STOP)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -161,8 +161,8 @@ static int browseUSBInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
dmasprintf(&statistics_path, "%s/statistics", iface_path);
|
||||
init_usb_interface(p->dm, iface_name, iface_path, statistics_path, port_link, &iface);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dm, "usb_iface_instance", "usb_iface_alias", "dmmap_usb", "dmmap_interface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dm, "usb_iface_instance", "usb_iface_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &iface, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -197,8 +197,8 @@ static int browseUSBPortInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
|
||||
init_usb_port(p->dm, p->sysfs_folder_name, p->sysfs_folder_path, &port);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dm, "usb_port_instance", "usb_port_alias", "dmmap_usb", "dmmap_port");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dm, "usb_port_instance", "usb_port_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -226,8 +226,8 @@ static int browseUSBUSBHostsHostInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
init_usb_port(p->dm, p->sysfs_folder_name, p->sysfs_folder_path, &port);
|
||||
port.dmsect= p->dm;
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dm, "usb_host_instance", "usb_host_alias", "dmmap_usb", "dmmap_host");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dm, "usb_host_instance", "usb_host_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -332,8 +332,8 @@ static int browseUSBUSBHostsHostDeviceInst(struct dmctx *dmctx, DMNODE *parent_n
|
|||
|
||||
port.dmsect = prev_port->dmsect;
|
||||
|
||||
instance = handle_update_instance(2, dmctx, &instnbr, update_instance_alias, 5,
|
||||
p->dm, "usb_host_device_instance", "usb_host_device_alias", "dmmap_usb", "dmmap_host_device");
|
||||
instance = handle_update_instance(2, dmctx, &instnbr, update_instance_alias, 3,
|
||||
p->dm, "usb_host_device_instance", "usb_host_device_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, instance) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -360,8 +360,8 @@ static int browseUSBUSBHostsHostDeviceConfigurationInst(struct dmctx *dmctx, DMN
|
|||
|
||||
init_usb_port(s, usb_dev->folder_name, usb_dev->folder_path, &port);
|
||||
|
||||
handle_update_instance(3, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "usb_device_conf_instance", "usb_device_conf_alias", "dmmap_usb", "usb_device_conf");
|
||||
handle_update_instance(3, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "usb_device_conf_instance", "usb_device_conf_alias");
|
||||
|
||||
DM_LINK_INST_OBJ(dmctx, parent_node, &port, "1");
|
||||
return 0;
|
||||
|
|
@ -395,8 +395,8 @@ static int browseUSBUSBHostsHostDeviceConfigurationInterfaceInst(struct dmctx *d
|
|||
|
||||
init_usb_port(dmmap_sect, ent->d_name, sysfs_rep_path, &port);
|
||||
|
||||
inst = handle_update_instance(4, dmctx, &max_inst, update_instance_alias, 5,
|
||||
dmmap_sect, "usb_device_conf_iface_instance", "usb_device_conf_iface_alias", "dmmap_usb", "usb_device_conf_interface");
|
||||
inst = handle_update_instance(4, dmctx, &max_inst, update_instance_alias, 3,
|
||||
dmmap_sect, "usb_device_conf_iface_instance", "usb_device_conf_iface_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, &port, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ static int browseUserInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
|
|||
synchronize_specific_config_sections_with_dmmap("users", "user", "dmmap_users", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "user_instance", "user_alias", "dmmap_users", "user");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "user_instance", "user_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -1793,7 +1793,7 @@ static int get_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char lower_layer[256] = {0}, *linker;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1801,13 +1801,11 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", linker);
|
||||
dmfree(linker);
|
||||
} else
|
||||
return FAULT_9005;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1987,8 +1985,8 @@ static int browseWifiRadioInst(struct dmctx *dmctx, DMNODE *parent_node, void *p
|
|||
list_for_each_entry(p, &dup_list, list) {
|
||||
init_wifi_radio(&curr_wifi_radio_args, p->config_section);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "radioinstance", "radioalias", "dmmap_wireless", "wifi-device");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "radioinstance", "radioalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_radio_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -2015,8 +2013,8 @@ static int browseWifiSsidInst(struct dmctx *dmctx, DMNODE *parent_node, void *pr
|
|||
#endif
|
||||
init_wifi_ssid(&curr_wifi_ssid_args, p->config_section, ifname, linker);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "ssidinstance", "ssidalias", "dmmap_wireless", "wifi-iface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "ssidinstance", "ssidalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_ssid_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -2041,8 +2039,8 @@ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
|
||||
init_wifi_acp(&curr_wifi_acp_args, p->config_section, ifname);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "ap_instance", "ap_alias", "dmmap_wireless", "wifi-iface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "ap_instance", "ap_alias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_acp_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -2067,8 +2065,8 @@ static int browseWiFiEndPointInst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
dmuci_get_value_by_section_string(p->config_section, "ifname", &ifname);
|
||||
init_wifi_enp(&curr_wifi_enp_args, p->config_section, ifname);
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "endpointinstance", "endpointalias", "dmmap_wireless", "wifi-iface");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "endpointinstance", "endpointalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_wifi_enp_args, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -2091,8 +2089,8 @@ static int browseWiFiEndPointProfileInst(struct dmctx *dmctx, DMNODE *parent_nod
|
|||
dmuci_add_section_bbfdm("dmmap_wireless", "ep_profile", &s);
|
||||
dmuci_set_value_by_section_bbfdm(s, "ep_key", ep_instance);
|
||||
|
||||
handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
s, "ep_profile_instance", "ep_profile_alias", "dmmap_wireless", "wifi-iface");
|
||||
handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 3,
|
||||
s, "ep_profile_instance", "ep_profile_alias");
|
||||
|
||||
DM_LINK_INST_OBJ(dmctx, parent_node, ep_args->wifi_enp_sec, "1");
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ int browseXIopsysEuButton(struct dmctx *dmctx, DMNODE *parent_node, void *prev_d
|
|||
synchronize_specific_config_sections_with_dmmap("buttons", "button", "dmmap_buttons", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "buttoninstance", "buttonalias", "dmmap_buttons", "button");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "buttoninstance", "buttonalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ int browseXIopsysEuDropbear(struct dmctx *dmctx, DMNODE *parent_node, void *prev
|
|||
synchronize_specific_config_sections_with_dmmap("dropbear", "dropbear", "dmmap_dropbear", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "dropbearinstance", "dropbearalias", "dmmap_dropbear", "dropbear");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "dropbearinstance", "dropbearalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -225,16 +225,12 @@ static int get_br_key_from_lower_layer(char *lower_layer, char *key, size_t s_ke
|
|||
|
||||
int get_mcast_snooping_interface_val(char *value, char *ifname, size_t s_ifname)
|
||||
{
|
||||
char lower_layer[256] = {0};
|
||||
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
/* Check if the value is valid or not. */
|
||||
if (strncmp(lower_layer, "Device.Bridging.Bridge.", 23) != 0)
|
||||
if (strncmp(value, "Device.Bridging.Bridge.", 23) != 0)
|
||||
return -1;
|
||||
|
||||
char key[10] = {0};
|
||||
if (get_br_key_from_lower_layer(lower_layer, key, sizeof(key)) != 0)
|
||||
if (get_br_key_from_lower_layer(value, key, sizeof(key)) != 0)
|
||||
return -1;
|
||||
|
||||
/* Find out bridge section name using bridge key. */
|
||||
|
|
@ -352,8 +348,8 @@ static int browse_igmp_proxy_inst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
browse_args.option = "proto";
|
||||
browse_args.value = "igmp";
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "proxy_instance", "proxy_alias", "dmmap_mcast", "proxy",
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "proxy_instance", "proxy_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -448,8 +444,8 @@ static int browse_igmp_snooping_inst(struct dmctx *dmctx, DMNODE *parent_node, v
|
|||
browse_args.option = "proto";
|
||||
browse_args.value = "igmp";
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "snooping_instance", "snooping_alias", "dmmap_mcast", "snooping",
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "snooping_instance", "snooping_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -583,8 +579,8 @@ static int browse_igmps_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, vo
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "snooping_filter",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "filter_instance", "filter_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -1065,8 +1061,8 @@ static int browse_igmpp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "iface_instance", "iface_alias", "dmmap_mcast", "proxy_interface",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "iface_instance", "iface_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -1159,8 +1155,8 @@ static int browse_igmpp_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, vo
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "proxy_filter",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "filter_instance", "filter_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -1745,7 +1741,7 @@ static void set_igmpp_iface_val(void *data, char *instance, char *linker, char *
|
|||
|
||||
static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *linker, *interface_linker = NULL;
|
||||
char *linker = NULL, *interface_linker = NULL;
|
||||
char ifname[16];
|
||||
char *if_type;
|
||||
struct uci_section *s;
|
||||
|
|
@ -1762,14 +1758,11 @@ static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da
|
|||
interface_linker = dmstrdup(ifname);
|
||||
is_br = true;
|
||||
} else {
|
||||
char interface[256] = {0};
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if(strcmp(section_name(s), linker) != 0) {
|
||||
if(strcmp(section_name(s), linker) != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
dmuci_get_value_by_section_string(s, "type", &if_type);
|
||||
if (strcmp(if_type, "bridge") == 0) {
|
||||
|
|
@ -1781,6 +1774,7 @@ static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_igmpp_iface_val(data, instance, linker, interface_linker, is_br);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -98,8 +98,8 @@ static int browse_mld_proxy_inst(struct dmctx *dmctx, DMNODE *parent_node, void
|
|||
browse_args.option = "proto";
|
||||
browse_args.value = "mld";
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "proxy_instance", "proxy_alias", "dmmap_mcast", "proxy",
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "proxy_instance", "proxy_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -193,8 +193,8 @@ static int browse_mld_snooping_inst(struct dmctx *dmctx, DMNODE *parent_node, vo
|
|||
browse_args.option = "proto";
|
||||
browse_args.value = "mld";
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "snooping_instance", "snooping_alias", "dmmap_mcast", "snooping",
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "snooping_instance", "snooping_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -280,8 +280,8 @@ static int browse_mlds_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, voi
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "snooping_filter",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "filter_instance", "filter_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -404,8 +404,8 @@ static int browse_mldp_interface_inst(struct dmctx *dmctx, DMNODE *parent_node,
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "iface_instance", "iface_alias", "dmmap_mcast", "proxy_interface",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "iface_instance", "iface_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -452,8 +452,8 @@ static int browse_mldp_filter_inst(struct dmctx *dmctx, DMNODE *parent_node, voi
|
|||
browse_args.option = "section_name";
|
||||
browse_args.value = section_name((struct uci_section *)prev_data);
|
||||
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 7,
|
||||
p->dmmap_section, "filter_instance", "filter_alias", "dmmap_mcast", "proxy_filter",
|
||||
inst = handle_update_instance(2, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "filter_instance", "filter_alias",
|
||||
check_browse_section, (void *)&browse_args);
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
|
|
@ -651,7 +651,7 @@ static int set_mld_proxy_version(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
static int set_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char *linker, *interface_linker = NULL;
|
||||
char *linker = NULL, *interface_linker = NULL;
|
||||
char ifname[16];
|
||||
char *up, *f_inst, *if_type;
|
||||
struct uci_section *d_sec, *s;
|
||||
|
|
@ -667,10 +667,8 @@ static int set_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *dat
|
|||
if (get_mcast_snooping_interface_val(value, ifname, sizeof(ifname)) == 0) {
|
||||
interface_linker = dmstrdup(ifname);
|
||||
} else {
|
||||
char interface[256] = {0};
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if(strcmp(section_name(s), linker) != 0) {
|
||||
continue;
|
||||
|
|
@ -683,6 +681,7 @@ static int set_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *dat
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
uci_path_foreach_option_eq(bbfdm, "dmmap_mcast", "proxy_interface",
|
||||
"section_name", section_name((struct uci_section *)data), d_sec) {
|
||||
dmuci_get_value_by_section_string(d_sec, "iface_instance", &f_inst);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ static int browseXIopsysEuOWSDVirtualHost(struct dmctx *dmctx, DMNODE *parent_no
|
|||
synchronize_specific_config_sections_with_dmmap("owsd", "owsd-listen", "dmmap_owsd", &dup_list);
|
||||
list_for_each_entry(p, &dup_list, list) {
|
||||
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
|
||||
p->dmmap_section, "olisteninstance", "olistenalias", "dmmap_owsd", "owsd-listen");
|
||||
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,
|
||||
p->dmmap_section, "olisteninstance", "olistenalias");
|
||||
|
||||
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
|
||||
break;
|
||||
|
|
@ -107,15 +107,14 @@ static int get_x_iopsys_eu_owsd_virtualhost_interface(char *refparam, struct dmc
|
|||
|
||||
static int set_x_iopsys_eu_owsd_virtualhost_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0}, *linker;
|
||||
char *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
return 0;
|
||||
case VALUESET:
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
if (linker && *linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "interface", linker);
|
||||
dmfree(linker);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,8 +494,8 @@ def cprintBrowseObj( fbrowse, name, mappingobj, dmobject ):
|
|||
print(" synchronize_specific_config_sections_with_dmmap(\"%s\", \"%s\", \"%s\", &dup_list);" % (res1, res2, res3), file=fp)
|
||||
print(" list_for_each_entry(p, &dup_list, list) {", file=fp)
|
||||
print("", file=fp)
|
||||
print(" inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,", file=fp)
|
||||
print(" p->dmmap_section, \"%s\", \"%s\", \"%s\", \"%s\");" % (name+"instance", name+"alias", res3, res2), file=fp)
|
||||
print(" inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 3,", file=fp)
|
||||
print(" p->dmmap_section, \"%s\", \"%s\");" % (name+"instance", name+"alias"), file=fp)
|
||||
print("", file=fp)
|
||||
print(" if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)", file=fp)
|
||||
print(" break;", file=fp)
|
||||
|
|
|
|||
|
|
@ -650,13 +650,11 @@ char *update_instance_alias(int action, char **last_inst, char **max_inst, void
|
|||
struct uci_section *s = (struct uci_section *) argv[0];
|
||||
char *inst_opt = (char *) argv[1];
|
||||
char *alias_opt = (char *) argv[2];
|
||||
char *dmmap_package = (char *) argv[3];
|
||||
char *section_type = (char *) argv[4];
|
||||
int (*check_browse)(struct uci_section *section, void *data) = argv[5];
|
||||
void *data = (void *) argv[6];
|
||||
int (*check_browse)(struct uci_section *section, void *data) = argv[3];
|
||||
void *data = (void *) argv[4];
|
||||
|
||||
if (*max_inst == NULL)
|
||||
max_instance = get_max_instance(dmmap_package, section_type, inst_opt, check_browse, data);
|
||||
max_instance = get_max_instance(section_config(s), section_type(s), inst_opt, check_browse, data);
|
||||
else
|
||||
max_instance = atoi(*max_inst);
|
||||
|
||||
|
|
@ -2028,16 +2026,17 @@ static int get_linker_check_obj(DMOBJECT_ARGS)
|
|||
{
|
||||
char *link_val = "";
|
||||
|
||||
if (!get_linker) {
|
||||
if (!get_linker)
|
||||
return FAULT_9005;
|
||||
}
|
||||
if (node->obj->browseinstobj && !node->is_instanceobj) {
|
||||
|
||||
if (node->obj->browseinstobj && !node->is_instanceobj)
|
||||
return FAULT_9005;
|
||||
}
|
||||
|
||||
get_linker(node->current_object, dmctx, data, instance, &link_val);
|
||||
if (dmctx->linker[0] == '\0') {
|
||||
|
||||
if (dmctx->linker[0] == '\0')
|
||||
return FAULT_9005;
|
||||
}
|
||||
|
||||
if (link_val && link_val[0] != '\0' && strcmp(link_val, dmctx->linker) == 0) {
|
||||
if (node->current_object[strlen(node->current_object) - 1] == '.')
|
||||
node->current_object[strlen(node->current_object) - 1] = 0;
|
||||
|
|
@ -2045,6 +2044,7 @@ static int get_linker_check_obj(DMOBJECT_ARGS)
|
|||
dmctx->stop = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return FAULT_9005;
|
||||
}
|
||||
|
||||
|
|
@ -2076,11 +2076,11 @@ int dm_entry_get_linker_value(struct dmctx *dmctx)
|
|||
|
||||
static int get_linker_value_check_obj(DMOBJECT_ARGS)
|
||||
{
|
||||
char *link_val;
|
||||
if (!get_linker)
|
||||
return FAULT_9005;
|
||||
|
||||
if (strcmp(node->current_object, dmctx->in_param) == 0) {
|
||||
char *link_val;
|
||||
get_linker(node->current_object, dmctx, data, instance, &link_val);
|
||||
dmctx->linker = dmstrdup(link_val);
|
||||
dmctx->stop = true;
|
||||
|
|
|
|||
|
|
@ -1760,14 +1760,6 @@ int check_browse_section(struct uci_section *s, void *data)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void append_dot_to_string(char *new_string, const char *string, size_t len)
|
||||
{
|
||||
if (string[strlen(string) - 1] != '.')
|
||||
snprintf(new_string, len, "%s.", string);
|
||||
else
|
||||
strncpy(new_string, string, len - 1);
|
||||
}
|
||||
|
||||
int check_instance_wildcard_parameter_by_regex(char *parameter, char* regex)
|
||||
{
|
||||
size_t l1, l2;
|
||||
|
|
|
|||
|
|
@ -330,6 +330,5 @@ int is_vlan_termination_section(char *name);
|
|||
void sync_dmmap_bool_to_uci_list(struct uci_section *s, char *section, char *value, bool b);
|
||||
void del_dmmap_sec_with_opt_eq(char *dmmap_file, char *section, char *option, char *value);
|
||||
int check_browse_section(struct uci_section *s, void *data);
|
||||
void append_dot_to_string(char *new_string, const char *string, size_t len);
|
||||
int check_instance_wildcard_parameter_by_regex(char *parameter, char* regex);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -122,6 +122,8 @@ struct package_change
|
|||
section = dmuci_walk_section(package, stype, arg, NULL, CMP_FILTER_FUNC, func, section, GET_NEXT_SECTION))
|
||||
|
||||
#define section_name(s) (s)->e.name
|
||||
#define section_type(s) (s)->type
|
||||
#define section_config(s) (s)->package->e.name
|
||||
|
||||
static inline void uci_list_insert(struct uci_list *list, struct uci_list *ptr)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue