Update LowerLayers of Ethernet.Link, InterfaceStack after changing the development of Bridge.Port object

This commit is contained in:
Amin Ben Ramdhane 2020-05-03 14:11:41 +01:00
parent bda75a662c
commit 814baeebea
4 changed files with 25 additions and 14 deletions

View file

@ -841,8 +841,7 @@ 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)
{
struct uci_section *s = NULL;
char *link_mac, *proto, *type, *ifname, *mac, *br_inst, *mg, linker[64] = "";
struct uci_section *dmmap_section, *port;
char *link_mac, *proto, *type, *ifname, *mac;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "mac", &link_mac);
uci_foreach_sections("network", "interface", s) {
@ -860,16 +859,22 @@ static int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
dmuci_get_value_by_section_string(s, "type", &type);
if (strcmp(type, "bridge") == 0) {
struct uci_section *dmmap_section, *port;
get_dmmap_section_of_config_section("dmmap_network", "interface", section_name(s), &dmmap_section);
if (dmmap_section != NULL) {
char *br_inst, *mg;
dmuci_get_value_by_section_string(dmmap_section, "bridge_instance", &br_inst);
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, port) {
dmuci_get_value_by_section_string(port, "management", &mg);
if (strcmp(mg, "1") == 0)
snprintf(linker, sizeof(linker), "br_%s:%s+", br_inst, section_name(port));
adm_entry_get_linker_param(ctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
if (*value == NULL)
*value = "";
if (strcmp(mg, "1") == 0) {
char *device, linker[512] = "";
dmuci_get_value_by_section_string(port, "device", &device);
snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(port), device);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, value);
if (*value == NULL)
*value = "";
break;
}
}
}
} else {

View file

@ -73,7 +73,7 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
char buf_higheralias[64] = {0};
char buf_loweralias[64] = {0};
char buf_instance[32] = {0};
char linker[64] = {0};
char linker[512] = {0};
char buf_tmp[64] = {0};
int instance = 0, found = 0;
@ -257,7 +257,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, port) {
dmuci_get_value_by_section_string(port, "management", &mg);
if (strcmp(mg, "1") == 0) {
snprintf(linker, sizeof(linker), "br_%s:%s+", br_inst, section_name(port));
dmuci_get_value_by_section_string(port, "device", &device);
snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(port), device);
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &v);
dmuci_get_value_by_section_string(port, "bridge_port_alias", &loweralias);
dmuci_get_value_by_section_string(port, "bridge_port_instance", &layer_inst);
@ -303,7 +304,8 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, port) {
dmuci_get_value_by_section_string(port, "management", &mg);
if (strcmp(mg, "1") == 0) {
snprintf(linker, sizeof(linker), "br_%s:%s+", br_inst, section_name(port));
dmuci_get_value_by_section_string(port, "device", &device);
snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(port), device);
adm_entry_get_linker_param(dmctx, dm_print_path("%s%cBridging%cBridge%c", dmroot, dm_delim, dm_delim, dm_delim), linker, &pch);
dmuci_get_value_by_section_string(port, "bridge_port_alias", &higheralias);
dmuci_get_value_by_section_string(port, "bridge_port_instance", &bridge_port_inst);

View file

@ -582,15 +582,17 @@ static int get_igmp_snooping_interface(char *refparam, struct dmctx *ctx, void *
// In the dmmap_network file, the details related to the instance id etc. associated with this bridge
// is stored, we now switch our focus to it to extract the necessary information.
struct uci_section *dmmap_section, *port;
char *br_inst, *mg, linker[64] = "";
get_dmmap_section_of_config_section("dmmap_network", "interface", sec_name, &dmmap_section);
if (dmmap_section != NULL) {
char *br_inst, *mg;
dmuci_get_value_by_section_string(dmmap_section, "bridge_instance", &br_inst);
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, port) {
dmuci_get_value_by_section_string(port, "management", &mg);
if (strcmp(mg, "1") == 0) {
snprintf(linker, sizeof(linker), "br_%s:%s+", br_inst, section_name(port));
char *device, linker[512] = "";
dmuci_get_value_by_section_string(port, "device", &device);
snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(port), device);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cBridging%cBridge%c", dmroot,
dm_delim, dm_delim, dm_delim), linker, value);
break;

View file

@ -582,15 +582,17 @@ static int get_mld_snooping_interface(char *refparam, struct dmctx *ctx, void *d
// In the dmmap_network file, the details related to the instance id etc. associated with this bridge
// is stored, we now switch our focus to it to extract the necessary information.
struct uci_section *dmmap_section, *port;
char *br_inst, *mg, linker[64] = "";
get_dmmap_section_of_config_section("dmmap_network", "interface", sec_name, &dmmap_section);
if (dmmap_section != NULL) {
char *br_inst, *mg;
dmuci_get_value_by_section_string(dmmap_section, "bridge_instance", &br_inst);
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge_port", "bridge_port", "br_inst", br_inst, port) {
dmuci_get_value_by_section_string(port, "management", &mg);
if (strcmp(mg, "1") == 0) {
snprintf(linker, sizeof(linker), "br_%s:%s+", br_inst, section_name(port));
char *device, linker[512] = "";
dmuci_get_value_by_section_string(port, "device", &device);
snprintf(linker, sizeof(linker), "br_%s:%s+%s", br_inst, section_name(port), device);
adm_entry_get_linker_param(ctx, dm_print_path("%s%cBridging%cBridge%c", dmroot,
dm_delim, dm_delim, dm_delim), linker, value);
break;