mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-17 09:41:19 +01:00
Ticket refs #2974: Referenced objects have trailing dot
This commit is contained in:
parent
7ec89f485b
commit
f9d2c345f1
23 changed files with 132 additions and 124 deletions
|
|
@ -654,6 +654,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct
|
|||
{
|
||||
char *linker = NULL, *tmp, *device = NULL;
|
||||
struct uci_section *curr_section = NULL;
|
||||
char interface[256] = {0};
|
||||
json_object *res;
|
||||
|
||||
switch (action) {
|
||||
|
|
@ -662,7 +663,8 @@ static int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", linker, String}}, 1, &res);
|
||||
if (!res) return 0;
|
||||
|
|
@ -1043,6 +1045,7 @@ static int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct d
|
|||
{
|
||||
char *linker = NULL, *tmp, *device = NULL;
|
||||
struct uci_section *curr_section = NULL;
|
||||
char interface[256] = {0};
|
||||
json_object *res;
|
||||
|
||||
switch (action) {
|
||||
|
|
@ -1051,7 +1054,8 @@ static int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct d
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", linker, String}}, 1, &res);
|
||||
if (!res) return 0;
|
||||
|
|
|
|||
|
|
@ -652,10 +652,7 @@ static void set_lowerlayers_management_port(struct dmctx *ctx, void *data, char
|
|||
p = new_device;
|
||||
for (pch = strtok_r(value, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) {
|
||||
|
||||
if (pch[strlen(pch)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", pch);
|
||||
else
|
||||
strncpy(lower_layer, pch, sizeof(lower_layer) - 1);
|
||||
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);
|
||||
|
||||
|
|
@ -1451,10 +1448,7 @@ static int set_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx,
|
|||
} else {
|
||||
/* Management Port ==> false */
|
||||
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
char *linker = NULL;
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
|
|
@ -2026,11 +2020,7 @@ static int set_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, vo
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
|
||||
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 */
|
||||
|
|
@ -2114,11 +2104,7 @@ static int set_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, vo
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -1157,6 +1157,7 @@ static int get_dhcp_interface(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
static int set_dhcp_interface_linker_parameter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
char interface[256] = {0};
|
||||
char *linker;
|
||||
|
||||
switch (action) {
|
||||
|
|
@ -1165,7 +1166,8 @@ static int set_dhcp_interface_linker_parameter(char *refparam, struct dmctx *ctx
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section(((struct dhcp_args *)data)->dhcp_sec, "interface", linker);
|
||||
dmfree(linker);
|
||||
|
|
@ -1477,7 +1479,8 @@ 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;
|
||||
char *linker = NULL, *newvalue = NULL, *v;
|
||||
char *linker = NULL, *v;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1487,11 +1490,8 @@ static int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
if(strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
return FAULT_9007;
|
||||
|
||||
if (value[strlen(value)-1]!='.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
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)
|
||||
|
|
@ -1506,11 +1506,8 @@ static int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1]!='.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
DMUCI_SET_VALUE_BY_SECTION(bbfdm, ((struct dhcp_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2179,7 +2176,8 @@ 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;
|
||||
char *linker = NULL, *newvalue = NULL, *v;
|
||||
char *linker = NULL, *v;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -2189,11 +2187,8 @@ static int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx
|
|||
if (strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
return FAULT_9007;
|
||||
|
||||
if (value[strlen(value)-1] != '.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
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) {
|
||||
|
|
@ -2210,11 +2205,8 @@ static int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1]!='.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
DMUCI_SET_VALUE_BY_SECTION(bbfdm, ((struct dhcp_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -557,23 +557,19 @@ 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;
|
||||
char *linker = NULL, *newvalue = NULL, *v;
|
||||
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) {
|
||||
if (strlen(value) == 0 || strcmp(value, "") == 0)
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
if (value[strlen(value)-1] != '.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
}
|
||||
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)
|
||||
|
|
@ -588,12 +584,8 @@ static int set_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
}
|
||||
break;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1]!='.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
}
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
DMUCI_SET_VALUE_BY_SECTION(bbfdm, ((struct dhcpv6_client_args *)data)->dhcp_client_dm, "section_name", linker);
|
||||
break;
|
||||
}
|
||||
|
|
@ -914,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 *linker;
|
||||
char interface[256] = {0}, *linker;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -922,7 +914,8 @@ static int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section(((struct dhcpv6_args *)data)->dhcp_sec, "interface", linker);
|
||||
dmfree(linker);
|
||||
|
|
|
|||
|
|
@ -639,6 +639,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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -646,8 +647,9 @@ 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);
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &ointerface);
|
||||
adm_entry_get_linker_value(ctx, value, &interface);
|
||||
if (strcmp(ointerface, interface) == 0)
|
||||
return 0;
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "peerdns", &str);
|
||||
|
|
@ -774,6 +776,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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -781,8 +784,9 @@ 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);
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &ointerface);
|
||||
adm_entry_get_linker_value(ctx, value, &interface);
|
||||
if (strcmp(ointerface, interface) == 0)
|
||||
return 0;
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "peerdns", &str);
|
||||
|
|
|
|||
|
|
@ -473,7 +473,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 *linker = NULL;
|
||||
char lower_layer[256] = {0}, *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -481,7 +481,8 @@ static int set_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (linker)
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "service_name", linker);
|
||||
else
|
||||
|
|
@ -504,7 +505,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 *linker = NULL;
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -512,7 +513,8 @@ static int set_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker)
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "interface", linker);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -992,10 +992,7 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
|
||||
if (strncmp(lower_layer, "Device.Ethernet.Interface.", 26) == 0) {
|
||||
char *linker, *int_name;
|
||||
|
|
@ -1218,10 +1215,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ static int get_firewall_config(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
static int get_firewall_advanced_level(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "Device.Firewall.Level.1.";
|
||||
*value = "Device.Firewall.Level.1";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ static int get_level_description(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
static int get_level_chain(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "Device.Firewall.Chain.1.";
|
||||
*value = "Device.Firewall.Chain.1";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -906,18 +906,21 @@ static int set_rule_source_interface(char *refparam, struct dmctx *ctx, void *da
|
|||
{
|
||||
char *iface, *zone, *net;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface == NULL || iface[0] == '\0')
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface && iface[0] != '\0') {
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "network", &net);
|
||||
|
|
@ -937,6 +940,7 @@ static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
char *iface, *zone, *net;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -948,7 +952,9 @@ static int set_rule_dest_interface(char *refparam, struct dmctx *ctx, void *data
|
|||
dmuci_set_value_by_section((struct uci_section *)data, "dest", "");
|
||||
break;
|
||||
}
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface != NULL && iface[0] != '\0') {
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "name", &net);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
layer_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "interface", s, "section_name", section_name(s), "ip_int_instance", "ip_int_alias");
|
||||
if (*layer_inst == '\0')
|
||||
continue;
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.IP.Interface.%s.", layer_inst);
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.IP.Interface.%s", layer_inst);
|
||||
|
||||
higheralias = get_alias_by_section("dmmap_network", "interface", s, "ip_int_alias");
|
||||
if (*higheralias == '\0')
|
||||
|
|
@ -127,7 +127,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
layer_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "interface", s, "section_name", section_name(s), "ppp_int_instance", "ppp_int_alias");
|
||||
if (*layer_inst == '\0')
|
||||
continue;
|
||||
snprintf(buf_lowerlayer, sizeof(buf_lowerlayer), "Device.PPP.Interface.%s.", layer_inst);
|
||||
snprintf(buf_lowerlayer, sizeof(buf_lowerlayer), "Device.PPP.Interface.%s", layer_inst);
|
||||
loweralias = get_alias_by_section("dmmap_network", "interface", s, "ppp_int_alias");
|
||||
if (*loweralias == '\0')
|
||||
snprintf(buf_loweralias, sizeof(buf_loweralias), "cpe-%s", layer_inst);
|
||||
|
|
@ -197,7 +197,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
layer_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "interface", s, "section_name", section_name(s), "ppp_int_instance", "ppp_int_alias");
|
||||
if (*layer_inst == '\0')
|
||||
continue;
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.PPP.Interface.%s.", layer_inst);
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.PPP.Interface.%s", layer_inst);
|
||||
|
||||
higheralias = get_alias_by_section("dmmap_network", "interface", s, "ppp_int_alias");
|
||||
if (*higheralias == '\0')
|
||||
|
|
@ -277,7 +277,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
if (*layer_inst == '\0')
|
||||
continue;
|
||||
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.Ethernet.VLANTermination.%s.", layer_inst);
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.Ethernet.VLANTermination.%s", layer_inst);
|
||||
|
||||
higheralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
|
||||
if (*higheralias == '\0')
|
||||
|
|
@ -335,7 +335,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
|||
if (*layer_inst == '\0')
|
||||
continue;
|
||||
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.Ethernet.Link.%s.", layer_inst);
|
||||
snprintf(buf_higherlayer, sizeof(buf_higherlayer), "Device.Ethernet.Link.%s", layer_inst);
|
||||
|
||||
dmuci_get_value_by_section_string(s, "link_alias", &higheralias);
|
||||
if (*higheralias == '\0')
|
||||
|
|
|
|||
|
|
@ -401,7 +401,7 @@ static int get_IPInterface_LastChange(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
static int get_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
*value = "Device.Routing.Router.1.";
|
||||
*value = "Device.Routing.Router.1";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -731,10 +731,7 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
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);
|
||||
|
|
@ -914,7 +911,7 @@ static int get_IPInterfaceIPv6Address_Prefix(char *refparam, struct dmctx *ctx,
|
|||
|
||||
*value = "";
|
||||
if(((struct ipv6prefix_args *)data)->ip_6prefixaddress[0] != '\0')
|
||||
dmasprintf(value, "Device.IP.Interface.%s.IPv6Prefix.1.", inst);
|
||||
dmasprintf(value, "Device.IP.Interface.%s.IPv6Prefix.1", inst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,7 @@ 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:
|
||||
|
|
@ -255,7 +256,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)) {
|
||||
adm_entry_get_linker_value(ctx, pch, &iface);
|
||||
append_dot_to_string(interface, pch, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface) {
|
||||
dmuci_add_list_value_by_section((struct uci_section *)data, "network", iface);
|
||||
dmfree(iface);
|
||||
|
|
@ -363,6 +365,7 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
char *iface, *network, *zone;
|
||||
struct uci_section *s = NULL;
|
||||
char interface[256] = {0};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -370,7 +373,8 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface[0] != '\0') {
|
||||
uci_foreach_sections("firewall", "zone", s) {
|
||||
dmuci_get_value_by_section_string(s, "network", &network);
|
||||
|
|
|
|||
|
|
@ -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 *linker, *newvalue = NULL;
|
||||
char lower_layer[256] = {0}, *linker;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -293,11 +293,8 @@ static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1]!='.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if(linker)
|
||||
dmuci_set_value_by_section(((struct uci_section *)data), "ifname", linker);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -925,13 +925,16 @@ 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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &interface_linker);
|
||||
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);
|
||||
break;
|
||||
|
|
@ -3073,13 +3076,16 @@ 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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &interface_linker);
|
||||
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);
|
||||
break;
|
||||
|
|
@ -3484,13 +3490,16 @@ 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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, 0, NULL, 0))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &interface_linker);
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,6 +596,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};
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -603,7 +604,8 @@ int set_QoS_DefaultQueue(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
dmuci_set_value("qos", "Default", "default", linker);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -649,7 +649,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 *linker;
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -657,7 +657,8 @@ static int set_router_ipv4forwarding_interface_linker_parameter(char *refparam,
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "interface", linker);
|
||||
dmfree(linker);
|
||||
|
|
@ -790,7 +791,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 *linker;
|
||||
char interface[256] = {0}, *linker = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -798,7 +799,8 @@ static int set_RoutingRouterIPv6Forwarding_Interface(char *refparam, struct dmct
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "interface", linker);
|
||||
dmfree(linker);
|
||||
|
|
|
|||
|
|
@ -165,15 +165,18 @@ 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 *iface= NULL;
|
||||
char interface[256] = {0}, *iface = NULL;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
if (iface == NULL || iface[0] == '\0')
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &iface);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &iface);
|
||||
dmuci_set_value("system", "ntp", "interface", iface);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1948,7 +1948,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 *linker, *newvalue = NULL;
|
||||
char lower_layer[256] = {0}, *linker;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
|
|
@ -1956,11 +1956,8 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
|||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
if (value[strlen(value)-1] != '.') {
|
||||
dmasprintf(&newvalue, "%s.", value);
|
||||
adm_entry_get_linker_value(ctx, newvalue, &linker);
|
||||
} else
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(lower_layer, value, sizeof(lower_layer));
|
||||
adm_entry_get_linker_value(ctx, lower_layer, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section(((struct wifi_ssid_args *)data)->wifi_ssid_sec, "device", linker);
|
||||
dmfree(linker);
|
||||
|
|
|
|||
|
|
@ -228,12 +228,9 @@ 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[250] = {0};
|
||||
char lower_layer[256] = {0};
|
||||
|
||||
if (value[strlen(value)-1] != '.')
|
||||
snprintf(lower_layer, sizeof(lower_layer), "%s.", value);
|
||||
else
|
||||
strncpy(lower_layer, value, sizeof(lower_layer) - 1);
|
||||
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)
|
||||
|
|
@ -1781,7 +1778,10 @@ static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da
|
|||
interface_linker = dmstrdup(ifname);
|
||||
is_br = true;
|
||||
} else {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
char interface[256] = {0};
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if(strcmp(section_name(s), linker) != 0) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -651,7 +651,10 @@ 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 {
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
char interface[256] = {0};
|
||||
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
if(strcmp(section_name(s), linker) != 0) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -107,13 +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 *linker;
|
||||
char interface[256] = {0}, *linker;
|
||||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
return 0;
|
||||
case VALUESET:
|
||||
adm_entry_get_linker_value(ctx, value, &linker);
|
||||
append_dot_to_string(interface, value, sizeof(interface));
|
||||
adm_entry_get_linker_value(ctx, interface, &linker);
|
||||
if (linker) {
|
||||
dmuci_set_value_by_section((struct uci_section *)data, "interface", linker);
|
||||
dmfree(linker);
|
||||
|
|
|
|||
|
|
@ -2053,6 +2053,8 @@ static int get_linker_check_obj(DMOBJECT_ARGS)
|
|||
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;
|
||||
dmctx->linker_param = dmstrdup(node->current_object);
|
||||
dmctx->stop = true;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1779,3 +1779,12 @@ int check_browse_section(struct uci_section *s, void *data)
|
|||
return 0;
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -333,4 +333,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);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue