mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Fixed Wrong InterfaceStack for QinQ VLAN (double vlan) interface
This commit is contained in:
parent
2ccba8af73
commit
ab7b12d96e
1 changed files with 33 additions and 10 deletions
|
|
@ -287,18 +287,41 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
|
||||||
higheralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
|
higheralias = get_alias_by_section("dmmap_network", "device", s, "vlan_term_alias");
|
||||||
snprintf(buf_higheralias, sizeof(buf_higheralias), "%s%s", *higheralias ? higheralias : *layer_inst ? "cpe-" : "", (*higheralias == '\0' && *layer_inst) ? layer_inst : "");
|
snprintf(buf_higheralias, sizeof(buf_higheralias), "%s%s", *higheralias ? higheralias : *layer_inst ? "cpe-" : "", (*higheralias == '\0' && *layer_inst) ? layer_inst : "");
|
||||||
|
|
||||||
// The lower layer is Device.Ethernet.Link.{i}.
|
// The lower layer is Device.Ethernet.VLANTermination.{i}
|
||||||
char *vid = strchr(name, '.');
|
char *ifname, *inner_vid, *dev_name;
|
||||||
if (vid) *vid = '\0';
|
int found = 0;
|
||||||
adm_entry_get_linker_param(dmctx, "Device.Ethernet.Link.", name, &value);
|
|
||||||
if (value == NULL)
|
dmuci_get_value_by_section_string(s, "ifname", &ifname);
|
||||||
|
dmuci_get_value_by_section_string(s, "inner_vid", &inner_vid);
|
||||||
|
|
||||||
|
if (strncmp(type, "8021ad", 6) == 0) {
|
||||||
|
// 8021ad device, will have a vlan termination object as its lowerlayer
|
||||||
|
|
||||||
|
struct uci_section *vlan_sect = NULL;
|
||||||
|
dmasprintf(&dev_name, "%s.%s", ifname, inner_vid);
|
||||||
|
adm_entry_get_linker_param(dmctx, "Device.Ethernet.VLANTermination.", dev_name, &value);
|
||||||
|
uci_foreach_option_eq("network", "device", "name", dev_name, vlan_sect) {
|
||||||
|
loweralias = get_alias_by_section("dmmap_network", "device", vlan_sect, "vlan_term_alias");
|
||||||
|
layer_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "device", "section_name", section_name(vlan_sect), "vlan_term_instance", "vlan_term_alias");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (value != NULL)
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found == 0) {
|
||||||
|
// The lower layer is Device.Ethernet.Link.{i}.
|
||||||
|
char *vid = strchr(name, '.');
|
||||||
|
if (vid) *vid = '\0';
|
||||||
|
adm_entry_get_linker_param(dmctx, "Device.Ethernet.Link.", name, &value);
|
||||||
|
if (value == NULL)
|
||||||
value = "";
|
value = "";
|
||||||
|
|
||||||
struct uci_section *link_s = NULL;
|
struct uci_section *link_s = NULL;
|
||||||
get_dmmap_section_of_config_section_eq("dmmap", "link", "device", name, &link_s);
|
get_dmmap_section_of_config_section_eq("dmmap", "link", "device", name, &link_s);
|
||||||
dmuci_get_value_by_section_string(link_s, "link_instance", &layer_inst);
|
dmuci_get_value_by_section_string(link_s, "link_instance", &layer_inst);
|
||||||
dmuci_get_value_by_section_string(link_s, "link_alias", &loweralias);
|
dmuci_get_value_by_section_string(link_s, "link_alias", &loweralias);
|
||||||
|
}
|
||||||
snprintf(buf_lowerlayer, sizeof(buf_lowerlayer), "%s", value);
|
snprintf(buf_lowerlayer, sizeof(buf_lowerlayer), "%s", value);
|
||||||
snprintf(buf_loweralias, sizeof(buf_loweralias), "%s%s", *loweralias ? loweralias : *layer_inst ? "cpe-" : "", (*loweralias == '\0' && *layer_inst) ? layer_inst : "");
|
snprintf(buf_loweralias, sizeof(buf_loweralias), "%s%s", *loweralias ? loweralias : *layer_inst ? "cpe-" : "", (*loweralias == '\0' && *layer_inst) ? layer_inst : "");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue