mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2026-02-21 20:02:37 +01:00
Fix VLANTermination LowerLayers
This commit is contained in:
parent
6441cc6001
commit
aacf209044
1 changed files with 15 additions and 19 deletions
|
|
@ -322,7 +322,7 @@ int get_linker_interface(char *refparam, struct dmctx *dmctx, void *data, char *
|
|||
|
||||
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, "mac", linker);
|
||||
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "section_name", linker);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -973,7 +973,7 @@ int get_EthernetLink_LastChange(char *refparam, struct dmctx *ctx, void *data, c
|
|||
int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *s = NULL;
|
||||
char *link_mac, *type, *ifname, *mac, *br_inst, *mg, *wanifname, *wanlinker, linker[64] = "";
|
||||
char *link_mac, *type, *ifname, *mac, *br_inst, *mg, *p, linker[64] = "";
|
||||
struct uci_section *dmmap_section, *port;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "mac", &link_mac);
|
||||
|
|
@ -1005,16 +1005,16 @@ int get_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void *data,
|
|||
}
|
||||
}
|
||||
else {
|
||||
dmuci_get_option_value_string("ports", "WAN", "ifname", &wanifname);
|
||||
/* for upstream interface, set the lowerlayer to wan port of Ethernet.Interface */
|
||||
if(strstr(ifname, wanifname)) {
|
||||
dmasprintf(&wanlinker, "%s.1", wanifname);
|
||||
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), wanlinker, value);
|
||||
dmfree(wanlinker);
|
||||
if (*value == NULL)
|
||||
*value = "";
|
||||
p = strchr(ifname, '.');
|
||||
if (p) {
|
||||
/*linker of wan port of interface is eth0.1*/
|
||||
*(p+1) = '1';
|
||||
*(p+2) = '\0';
|
||||
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cInterface%c", dmroot, dm_delim, dm_delim, dm_delim), ifname, value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1246,21 +1246,17 @@ int get_EthernetVLANTermination_LastChange(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
int get_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
char *pch, *spch, *devifname, *ifname, *mac;
|
||||
char *pch, *spch, *devifname, *ifname, *dupifname;
|
||||
struct uci_section *section;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &devifname);
|
||||
uci_foreach_sections("network", "interface", section) {
|
||||
dmuci_get_value_by_section_string(section, "ifname", &ifname);
|
||||
for (pch = strtok_r(ifname, " ", &spch); pch != NULL; pch = strtok_r(NULL, " ", &spch)) {
|
||||
if(strcmp(pch, devifname) == 0) {
|
||||
mac = get_macaddr(section_name(section));
|
||||
if (mac[0] != '\0') {
|
||||
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), mac, value);
|
||||
if (*value == NULL)
|
||||
*value = "";
|
||||
break;
|
||||
}
|
||||
dupifname = dmstrdup(ifname);
|
||||
for (pch = strtok_r(dupifname, " ", &spch); pch != NULL; pch = strtok_r(NULL, " ", &spch)) {
|
||||
if(strcmp(pch, devifname) == 0){
|
||||
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), section_name(section), value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue