Ticket refs #2920: TR-181: Device.IP.Interface.{i}. IPv4Address, IPv6Address and IPv6Prefix multi-instance objects are treated as single-instance

This commit is contained in:
Amin Ben Ramdhane 2020-11-02 10:46:38 +01:00
parent 3183933dad
commit 38bbb5e455
9 changed files with 1765 additions and 1419 deletions

View file

@ -238,13 +238,13 @@ static int get_atm_status(char *refparam, struct dmctx *ctx, void *data, char *i
*************************************************************/
static int add_atm_link(char *refparam, struct dmctx *ctx, void *data, char **instancepara)
{
char *instance = NULL, *atm_device = NULL, *v = NULL, *instance_update = NULL;
char *instance = NULL, *atm_device = NULL, *v = NULL;
struct uci_section *dmmap_atm = NULL;
check_create_dmmap_package("dmmap_dsl");
instance = get_last_instance_bbfdm("dmmap_dsl", "atm-device", "atmlinkinstance");
dmasprintf(&atm_device, "atm%d", instance ? atoi(instance) : 0);
dmasprintf(&instance_update, "%d", instance ? atoi(instance)+ 1 : 1);
dmuci_set_value("dsl", atm_device, "", "atm-device");
dmuci_set_value("dsl", atm_device, "name", "ATM");
dmuci_set_value("dsl", atm_device, "vpi", "8");

View file

@ -45,11 +45,11 @@ static inline int init_eth_rmon(struct eth_rmon_args *args, struct uci_section *
/*************************************************************
* COMMON Functions
**************************************************************/
static int eth_iface_sysfs(const struct dm_args *args, const char *name, char **value)
static int eth_iface_sysfs(const struct uci_section *data, const char *name, char **value)
{
char *device;
dmuci_get_value_by_section_string(args->section, "device", &device);
dmuci_get_value_by_section_string((struct uci_section *)data, "device", &device);
return get_net_device_sysfs(device, name, value);
}
@ -182,7 +182,7 @@ static int dmmap_synchronizeEthernetLink(struct dmctx *dmctx, DMNODE *parent_nod
// Skip this interface section if ifname is empty
dmuci_get_value_by_section_string(s, "ifname", &ifname);
if (*ifname == '\0')
if (*ifname == '\0' || strchr(ifname, '@'))
continue;
dmuci_get_value_by_section_string(s, "macaddr", &macaddr);
@ -241,18 +241,16 @@ static int browseEthernetInterfaceInst(struct dmctx *dmctx, DMNODE *parent_node,
static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct dm_args args = {0};
struct uci_section *s = NULL;
char *inst = NULL, *max_inst = NULL;
dmmap_synchronizeEthernetLink(dmctx, NULL, NULL, NULL);
uci_path_foreach_sections(bbfdm, DMMAP, "link", s) {
args.section = s;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
s, "link_instance", "link_alias", "dmmap", "link");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&args, inst) == DM_STOP)
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, inst) == DM_STOP)
break;
}
return 0;
@ -262,22 +260,21 @@ static int browseEthernetLinkInst(struct dmctx *dmctx, DMNODE *parent_node, void
static int browseEthernetVLANTerminationInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
char *type, *name, *inst = NULL, *max_inst = NULL;
struct dm_args curr_vlan_term_args = {0};
struct dmmap_dup *p = NULL;
LIST_HEAD(dup_list);
synchronize_specific_config_sections_with_dmmap("network", "device", "dmmap_network", &dup_list);
list_for_each_entry(p, &dup_list, list) {
dmuci_get_value_by_section_string(p->config_section, "type", &type);
dmuci_get_value_by_section_string(p->config_section, "name", &name);
if (strcmp(type, "untagged") == 0 || (*name != '\0' && !is_vlan_termination_section(name)))
continue;
curr_vlan_term_args.section = p->config_section;
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_alias, 5,
p->dmmap_section, "vlan_term_instance", "vlan_term_alias", "dmmap_network", "device");
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)&curr_vlan_term_args, inst) == DM_STOP)
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)p->config_section, inst) == DM_STOP)
break;
}
free_dmmap_config_dup_list(&dup_list);
@ -323,16 +320,13 @@ static int get_linker_interface(char *refparam, struct dmctx *dmctx, void *data,
static int get_linker_link(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "device", linker);
dmuci_get_value_by_section_string((struct uci_section *)data, "device", linker);
return 0;
}
static int get_linker_vlan_term(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
if(data && ((struct dm_args *)data)->section)
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", linker);
else
*linker = "";
dmuci_get_value_by_section_string((struct uci_section *)data, "name", linker);
return 0;
}
@ -365,9 +359,9 @@ static int delObjEthernetLink(char *refparam, struct dmctx *ctx, void *data, cha
switch (del_action) {
case DEL_INST:
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", &sect_name);
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &sect_name);
// Remove dmmap section
dmuci_delete_by_section(((struct dm_args *)data)->section, NULL, NULL);
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
// Check each network section in the list of sections
if (*sect_name == '\0')
@ -430,10 +424,10 @@ static int delObjEthernetVLANTermination(char *refparam, struct dmctx *ctx, void
switch (del_action) {
case DEL_INST:
// Remove device section
dmuci_delete_by_section(((struct dm_args *)data)->section, NULL, NULL);
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
// Remove device section in dmmap_network file
get_dmmap_section_of_config_section("dmmap_network", "device", section_name(((struct dm_args *)data)->section), &dmmap_section);
get_dmmap_section_of_config_section("dmmap_network", "device", section_name((struct uci_section *)data), &dmmap_section);
dmuci_delete_by_section(dmmap_section, NULL, NULL);
break;
case DEL_ALL:
@ -904,7 +898,7 @@ static int get_EthernetLink_Status(char *refparam, struct dmctx *ctx, void *data
static int get_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "link_alias", value);
dmuci_get_value_by_section_string((struct uci_section *)data, "link_alias", value);
if ((*value)[0] == '\0')
dmasprintf(value, "cpe-%s", instance);
return 0;
@ -918,7 +912,7 @@ static int set_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data,
return FAULT_9007;
break;
case VALUESET:
dmuci_set_value_by_section(((struct dm_args *)data)->section, "link_alias", value);
dmuci_set_value_by_section((struct uci_section *)data, "link_alias", value);
break;
}
return 0;
@ -926,7 +920,7 @@ static int set_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data,
static int get_EthernetLink_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "device", value);
dmuci_get_value_by_section_string((struct uci_section *)data, "device", value);
return 0;
}
@ -935,7 +929,7 @@ static int get_EthernetLink_LastChange(char *refparam, struct dmctx *ctx, void *
json_object *res;
char *interface;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", &interface);
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &interface);
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", interface, String}}, 1, &res);
DM_ASSERT(res, *value = "0");
*value = dmjson_get_value(res, 1, "uptime");
@ -947,11 +941,11 @@ static int get_EthernetLink_LastChange(char *refparam, struct dmctx *ctx, void *
static int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *linker;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "device", &linker);
dmuci_get_value_by_section_string((struct uci_section *)data, "device", &linker);
char *bridge = strstr(linker, "br-");
if (bridge) {
char *int_name;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", &int_name);
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &int_name);
struct uci_section *dmmap_section, *port;
get_dmmap_section_of_config_section("dmmap_network", "interface", int_name, &dmmap_section);
if (dmmap_section != NULL) {
@ -1001,8 +995,8 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
if (linker == NULL || *linker == '\0')
return -1;
dmuci_set_value_by_section(((struct dm_args *)data)->section, "device", linker);
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", &int_name);
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) {
@ -1030,7 +1024,7 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
char *interface, *curr_interface;
// Remove the network section corresponding to this dmmap interface if exists
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", &curr_interface);
dmuci_get_value_by_section_string((struct uci_section *)data, "section_name", &curr_interface);
struct uci_section *s, *tmp;
uci_foreach_sections_safe("network", "interface", tmp, s) {
if (strcmp(section_name(s), curr_interface) == 0) {
@ -1054,8 +1048,8 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
if (*device == '\0')
dmasprintf(&device, "br-%s", interface);
// Get dmmap section
dmuci_set_value_by_section(((struct dm_args *)data)->section, "device", device);
dmuci_set_value_by_section(((struct dm_args *)data)->section, "section_name", interface);
dmuci_set_value_by_section((struct uci_section *)data, "device", device);
dmuci_set_value_by_section((struct uci_section *)data, "section_name", interface);
}
}
break;
@ -1065,7 +1059,7 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
static int get_EthernetLink_MACAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "mac", value);
dmuci_get_value_by_section_string((struct uci_section *)data, "mac", value);
return 0;
}
@ -1144,7 +1138,7 @@ static int get_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx,
{
struct uci_section *dmmap_section = NULL;
get_dmmap_section_of_config_section("dmmap_network", "device", section_name(((struct dm_args *)data)->section), &dmmap_section);
get_dmmap_section_of_config_section("dmmap_network", "device", section_name((struct uci_section *)data), &dmmap_section);
dmuci_get_value_by_section_string(dmmap_section, "vlan_term_alias", value);
if ((*value)[0] == '\0')
dmasprintf(value, "cpe-%s", instance);
@ -1161,7 +1155,7 @@ static int set_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx,
return FAULT_9007;
return 0;
case VALUESET:
get_dmmap_section_of_config_section("dmmap_network", "device", section_name(((struct dm_args *)data)->section), &dmmap_section);
get_dmmap_section_of_config_section("dmmap_network", "device", section_name((struct uci_section *)data), &dmmap_section);
dmuci_set_value_by_section(dmmap_section, "vlan_term_alias", value);
return 0;
}
@ -1170,7 +1164,7 @@ static int set_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx,
static int get_EthernetVLANTermination_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmstrdup(section_name(((struct dm_args *)data)->section));
*value = dmstrdup(section_name((struct uci_section *)data));
return 0;
}
@ -1182,7 +1176,7 @@ static int get_EthernetVLANTermination_LastChange(char *refparam, struct dmctx *
char *devname;
*value = "0";
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &devname);
dmuci_get_value_by_section_string((struct uci_section *)data, "name", &devname);
uci_foreach_option_eq("network", "interface", "ifname", devname, s) {
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", section_name(s), String}}, 1, &res);
DM_ASSERT(res, *value = "0");
@ -1198,14 +1192,14 @@ static int get_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
{
char *name, *type, *inner_vid, *dev_name;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &name);
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "type", &type);
dmuci_get_value_by_section_string((struct uci_section *)data, "name", &name);
dmuci_get_value_by_section_string((struct uci_section *)data, "type", &type);
char *vid = strchr(name, '.');
if (vid) *vid = '\0';
if (strncmp(type, "8021ad", 6) == 0) {
// 8021ad device, will have a vlan termination object as its lowerlayer
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "inner_vid", &inner_vid);
dmuci_get_value_by_section_string((struct uci_section *)data, "inner_vid", &inner_vid);
dmasprintf(&dev_name, "%s.%s", name, inner_vid);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cVLANTermination%c", dmroot, dm_delim, dm_delim, dm_delim), dev_name, value);
} else {
@ -1237,7 +1231,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
return -1;
// Get type option from device section
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "type", &type);
dmuci_get_value_by_section_string((struct uci_section *)data, "type", &type);
if ((strcmp(type, "macvlan") == 0)) {
/* type == macvlan */
@ -1265,7 +1259,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
} else {
/* type != macvlan */
char *vid;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "vid", &vid);
dmuci_get_value_by_section_string((struct uci_section *)data, "vid", &vid);
if (*vid != '\0')
snprintf(new_name, sizeof(new_name), "%s.%s", linker, vid);
else
@ -1276,8 +1270,8 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
}
// Set ifname and name options of device section
dmuci_set_value_by_section(((struct dm_args *)data)->section, "ifname", linker);
dmuci_set_value_by_section(((struct dm_args *)data)->section, "name", new_name);
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;
struct uci_section *ss = NULL;
@ -1288,7 +1282,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
return -1;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "vid", &vid);
dmuci_get_value_by_section_string((struct uci_section *)data, "vid", &vid);
uci_foreach_option_eq("network", "device", "name", linker, ss) {
dmuci_get_value_by_section_string(ss, "vid", &inner_vid);
@ -1299,9 +1293,9 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
if (is_name_exist_in_devices(new_name))
return -1;
dmuci_set_value_by_section(((struct dm_args *)data)->section, "ifname", dev_name);
dmuci_set_value_by_section(((struct dm_args *)data)->section, "name", new_name);
dmuci_set_value_by_section(((struct dm_args *)data)->section, "inner_vid", inner_vid);
dmuci_set_value_by_section((struct uci_section *)data, "ifname", dev_name);
dmuci_set_value_by_section((struct uci_section *)data, "name", new_name);
dmuci_set_value_by_section((struct uci_section *)data, "inner_vid", inner_vid);
}
break;
}
@ -1311,7 +1305,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
/*#Device.Ethernet.VLANTermination.{i}.VLANID!UCI:network/device,@i-1/vid*/
static int get_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmuci_get_value_by_section_fallback_def(((struct dm_args *)data)->section, "vid", "1");
*value = dmuci_get_value_by_section_fallback_def((struct uci_section *)data, "vid", "1");
return 0;
}
@ -1328,18 +1322,18 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx,
return 0;
case VALUESET:
// Get type option from device section
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "type", &type);
dmuci_get_value_by_section_string((struct uci_section *)data, "type", &type);
if (strcmp(type, "macvlan") != 0) {
/* only when type != macvlan */
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "ifname", &ifname);
dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname);
if (*ifname != '\0') {
if (strcmp(type, "8021ad") == 0) {
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "inner_vid", &inner_vid);
dmuci_get_value_by_section_string((struct uci_section *)data, "inner_vid", &inner_vid);
dmasprintf(&name, "%s.%s.%s", ifname, inner_vid, value);
} else {
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "vid", &old_vid);
dmuci_get_value_by_section_string((struct uci_section *)data, "vid", &old_vid);
dmasprintf(&old_name, "%s.%s.", ifname, old_vid);
dmasprintf(&name, "%s.%s", ifname, value);
}
@ -1348,7 +1342,7 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx,
return -1;
// set ifname option of the corresponding interface section
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &curr_ifname);
dmuci_get_value_by_section_string((struct uci_section *)data, "name", &curr_ifname);
uci_foreach_option_eq("network", "interface", "ifname", curr_ifname, s) {
dmuci_set_value_by_section(s, "ifname", name);
}
@ -1378,13 +1372,13 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx,
}
// set name option of the device section
dmuci_set_value_by_section(((struct dm_args *)data)->section, "name", name);
dmuci_set_value_by_section((struct uci_section *)data, "name", name);
dmfree(name);
}
}
// set vid option of the device section
dmuci_set_value_by_section(((struct dm_args *)data)->section, "vid", value);
dmuci_set_value_by_section((struct uci_section *)data, "vid", value);
return 0;
}
return 0;
@ -1393,7 +1387,7 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx,
/*#Device.Ethernet.VLANTermination.{i}.TPID!UCI:network/device,@i-1/type*/
static int get_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "type", value);
dmuci_get_value_by_section_string((struct uci_section *)data, "type", value);
if (strcmp(*value, "8021q") == 0)
*value = "33024";
else if (strcmp(*value, "8021ad") == 0)
@ -1412,9 +1406,9 @@ static int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, v
return 0;
case VALUESET:
if (strcmp(value, "33024") == 0)
dmuci_set_value_by_section(((struct dm_args *)data)->section, "type", "8021q");
dmuci_set_value_by_section((struct uci_section *)data, "type", "8021q");
else if (strcmp(value, "34984") == 0)
dmuci_set_value_by_section(((struct dm_args *)data)->section, "type", "8021ad");
dmuci_set_value_by_section((struct uci_section *)data, "type", "8021ad");
return 0;
}
return 0;
@ -1422,7 +1416,7 @@ static int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, v
static int get_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "type", value);
dmuci_get_value_by_section_string((struct uci_section *)data, "type", value);
*value = (strcmp(*value, "macvlan") == 0) ? "1" : "0";
return 0;
}
@ -1439,8 +1433,8 @@ static int set_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx
break;
case VALUESET:
string_to_bool(value, &b);
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "ifname", &ifname);
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &name);
dmuci_get_value_by_section_string((struct uci_section *)data, "ifname", &ifname);
dmuci_get_value_by_section_string((struct uci_section *)data, "name", &name);
struct uci_section *s = NULL, *dmmap_s = NULL;
char *link_instance, new_name[16] = {0};
if (b && *name != '\0') {
@ -1512,10 +1506,10 @@ static int set_EthernetVLANTermination_MACVLAN(char *refparam, struct dmctx *ctx
}
}
dmuci_set_value_by_section(((struct dm_args *)data)->section, "name", new_name);
dmuci_set_value_by_section(((struct dm_args *)data)->section, "type", "macvlan");
dmuci_set_value_by_section((struct uci_section *)data, "name", new_name);
dmuci_set_value_by_section((struct uci_section *)data, "type", "macvlan");
} else {
dmuci_set_value_by_section(((struct dm_args *)data)->section, "type", b ? "macvlan" : "8021q");
dmuci_set_value_by_section((struct uci_section *)data, "type", b ? "macvlan" : "8021q");
}
break;
}

View file

@ -102,9 +102,14 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
/* Higher layers are Device.IP.Interface.{i}. */
uci_foreach_sections("network", "interface", s) {
char *proto;
char *proto, *ifname;
dmuci_get_value_by_section_string(s, "proto", &proto);
if (strcmp(section_name(s), "loopback") == 0 || *proto == '\0')
dmuci_get_value_by_section_string(s, "ifname", &ifname);
if (strcmp(section_name(s), "loopback") == 0 ||
*proto == '\0' ||
strchr(ifname, '@'))
continue;
// The higher layer is Device.IP.Interface.{i}.

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 iopsys Software Solutions AB
* Copyright (C) 2020 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
@ -23,6 +23,6 @@ extern DMLEAF tIPInterfaceIPv4AddressParams[];
extern DMLEAF tIPInterfaceIPv6AddressParams[];
extern DMLEAF tIPInterfaceIPv6PrefixParams[];
extern DMLEAF tIPInterfaceStatsParams[];
extern DMLEAF tIPInterfaceTWAMPReflectorParams[];
#endif
#endif //__IP_H

View file

@ -39835,6 +39835,21 @@
{
"max": 49
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "globals",
"name": "globals"
},
"option": {
"name": "ula_prefix"
}
}
}
]
},
"InterfaceNumberOfEntries": {
@ -39912,7 +39927,22 @@
"cwmp",
"usp"
],
"datatype": "boolean"
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "disabled"
}
}
}
]
},
"IPv6Enable": {
"type": "boolean",
@ -40103,6 +40133,12 @@
"min": 64,
"max": 65535
}
],
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/mtu"
}
]
},
"Type": {
@ -40208,7 +40244,22 @@
"cwmp",
"usp"
],
"datatype": "boolean"
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "disabled"
}
}
}
]
},
"Status": {
"type": "string",
@ -40259,9 +40310,9 @@
{
"type": "uci",
"uci": {
"file": "dmmap_network",
"file": "dmmap_network_ipv4",
"section": {
"type": "interface",
"type": "intf_ipv4",
"index": "@i-1"
},
"option": {
@ -40396,7 +40447,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_bytes"
}
]
},
"BytesReceived": {
"type": "unsignedLong",
@ -40406,7 +40463,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_bytes"
}
]
},
"PacketsSent": {
"type": "unsignedLong",
@ -40416,7 +40479,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_packets"
}
]
},
"PacketsReceived": {
"type": "unsignedLong",
@ -40426,7 +40495,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_packets"
}
]
},
"ErrorsSent": {
"type": "unsignedInt",
@ -40436,7 +40511,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedInt"
"datatype": "unsignedInt",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_errors"
}
]
},
"ErrorsReceived": {
"type": "unsignedInt",
@ -40446,7 +40527,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedInt"
"datatype": "unsignedInt",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_errors"
}
]
},
"UnicastPacketsSent": {
"type": "unsignedLong",
@ -40476,7 +40563,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedInt"
"datatype": "unsignedInt",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_dropped"
}
]
},
"DiscardPacketsReceived": {
"type": "unsignedInt",
@ -40486,7 +40579,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedInt"
"datatype": "unsignedInt",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_dropped"
}
]
},
"MulticastPacketsSent": {
"type": "unsignedLong",
@ -40506,7 +40605,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/multicast"
}
]
},
"BroadcastPacketsSent": {
"type": "unsignedLong",
@ -40669,7 +40774,22 @@
"cwmp",
"usp"
],
"datatype": "boolean"
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "ipv6"
}
}
}
]
},
"Status": {
"type": "string",
@ -40685,6 +40805,21 @@
"Enabled",
"Error_Misconfigured",
"Error"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "ipv6"
}
}
}
]
},
"IPAddressStatus": {
@ -40720,6 +40855,21 @@
{
"max": 64
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "dmmap_network_ipv6",
"section": {
"type": "intf_ipv6",
"index": "@i-1"
},
"option": {
"name": "ipv6_alias"
}
}
}
]
},
"IPAddress": {
@ -40788,22 +40938,7 @@
"cwmp",
"usp"
],
"datatype": "dateTime",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "adv_preferred_lifetime"
}
}
}
]
"datatype": "dateTime"
},
"ValidLifetime": {
"type": "dateTime",
@ -40813,22 +40948,7 @@
"cwmp",
"usp"
],
"datatype": "dateTime",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "adv_valid_lifetime"
}
}
}
]
"datatype": "dateTime"
},
"Anycast": {
"type": "boolean",
@ -40861,7 +40981,22 @@
"cwmp",
"usp"
],
"datatype": "boolean"
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "ipv6"
}
}
}
]
},
"Status": {
"type": "string",
@ -40876,6 +41011,21 @@
"Disabled",
"Enabled",
"Error"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "network",
"section": {
"type": "interface",
"index": "@i-1"
},
"option": {
"name": "ipv6"
}
}
}
]
},
"PrefixStatus": {
@ -40908,6 +41058,21 @@
{
"max": 64
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "dmmap_network_ipv6_prefix",
"section": {
"type": "intf_ipv6_prefix",
"index": "@i-1"
},
"option": {
"name": "ipv6_prefix_alias"
}
}
}
]
},
"Prefix": {

View file

@ -589,7 +589,7 @@ static int rootcmp(char *inparam, char *rootobj)
char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **max_inst, char * (*up_instance)(int action, char **last_inst, char **max_inst, void *argv[]), int argc, ...)
{
va_list arg;
char *instance, *last_inst = NULL;;
char *instance, *last_inst = NULL;
int i = 0;
unsigned int action, pos = instance_ranck - 1;
void *argv[argc+1];
@ -620,10 +620,9 @@ char *handle_update_instance(int instance_ranck, struct dmctx *ctx, char **max_i
char *update_instance(char *max_inst, int argc, ...)
{
va_list arg;
char *instance;
char *instance, *last_inst = NULL;
int i = 0;
void *argv[argc+1];
char *last_inst;
va_start(arg, argc);
for (i = 0; i < argc; i++) {

View file

@ -811,7 +811,7 @@ int synchronize_system_folders_with_dmmap_opt(char *sysfsrep, char *dmmap_packag
void get_dmmap_section_of_config_section(char* dmmap_package, char* section_type, char *section_name, struct uci_section **dmmap_section)
{
struct uci_section* s;
struct uci_section *s;
uci_path_foreach_option_eq(bbfdm, dmmap_package, section_type, "section_name", section_name, s) {
*dmmap_section = s;
@ -822,7 +822,7 @@ void get_dmmap_section_of_config_section(char* dmmap_package, char* section_type
void get_dmmap_section_of_config_section_eq(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section)
{
struct uci_section* s;
struct uci_section *s;
uci_path_foreach_option_eq(bbfdm, dmmap_package, section_type, opt, value, s) {
*dmmap_section = s;
@ -833,7 +833,7 @@ void get_dmmap_section_of_config_section_eq(char* dmmap_package, char* section_t
void get_dmmap_section_of_config_section_cont(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section)
{
struct uci_section* s;
struct uci_section *s;
uci_path_foreach_option_cont(bbfdm, dmmap_package, section_type, opt, value, s) {
*dmmap_section = s;
@ -844,7 +844,7 @@ void get_dmmap_section_of_config_section_cont(char* dmmap_package, char* section
void get_config_section_of_dmmap_section(char* package, char* section_type, char *section_name, struct uci_section **config_section)
{
struct uci_section* s;
struct uci_section *s;
uci_foreach_sections(package, section_type, s) {
if (strcmp(section_name(s), section_name) == 0) {
@ -1235,16 +1235,6 @@ int get_shift_time_time(int shift_time, char *local_time, int size)
return 0;
}
int get_shift_time_shift(char *local_time, char *shift)
{
struct tm tm = {0};
strptime(local_time,"%Y-%m-%dT%H:%M:%SZ", &tm);
sprintf(shift, "%u", (unsigned int)(mktime(&tm) - time(NULL)));
return 0;
}
int command_exec_output_to_array(char *cmd, char **output, int *length)
{
FILE *fp;

View file

@ -234,13 +234,6 @@ struct dmmap_sect {
char *instance;
};
struct dm_args
{
struct uci_section *section;
struct uci_section *dmmap_section;
char *name;
};
struct sysfs_dmsection {
struct list_head list;
char *sysfs_folder_path;
@ -306,7 +299,6 @@ struct uci_section *get_dup_section_in_dmmap_opt(char *dmmap_package, char *sect
struct uci_section *get_dup_section_in_dmmap_eq(char *dmmap_package, char* section_type, char*sect_name, char *opt_name, char* opt_value);
bool elt_exists_in_array(char **str_array, char *str, int length);
int get_shift_time_time(int shift_time, char *local_time, int size);
int get_shift_time_shift(char *local_time, char *shift);
int command_exec_output_to_array(char *cmd, char **output, int *length);
int bbf_api_copy_temporary_file_to_original_file(char *f1, char *f2);
struct uci_section *is_dmmap_section_exist(char* package, char* section);