Device.Ethernet.VLANTermination.x.LowerLayers Get

This commit is contained in:
Omar Kallel 2019-02-18 08:56:54 +01:00
parent 361141da56
commit 62dff00421
3 changed files with 16 additions and 9 deletions

View file

@ -1429,6 +1429,7 @@ char **strsplit(const char* str, const char* delim, size_t* numtokens) {
free(s);
return tokens;
}
char *get_macaddr(char *interface_name)
{
json_object *res;

View file

@ -586,17 +586,24 @@ int get_vlan_term_name(char *refparam, struct dmctx *ctx, void *data, char *inst
***************************************************************************/
int get_vlan_term_lowerlayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *ifname;
char *macaddr;
char *devifname, *ifname, *dupifname;
char *macaddr, *pch, *spch;
struct uci_section *section;
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &ifname);
dmuci_get_value_by_section_string(((struct dm_args *)data)->section, "name", &devifname);
uci_foreach_option_eq("network", "interface", "ifname", ifname, section) {
macaddr = get_macaddr(section_name(section));
if (macaddr != NULL && *macaddr != '\0')
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), macaddr, value);
break;
uci_foreach_sections("network", "interface", section) {
dmuci_get_value_by_section_string(section, "ifname", &ifname);
dupifname = dmstrdup(ifname);
for (pch = strtok_r(dupifname, " ", &spch); pch != NULL; pch = strtok_r(NULL, " ", &spch)) {
if(strcmp(pch, devifname) == 0){
macaddr = get_macaddr(section_name(section));
if (macaddr != NULL && *macaddr != '\0'){
adm_entry_get_linker_param(ctx, dm_print_path("%s%cEthernet%cLink%c", dmroot, dm_delim, dm_delim, dm_delim), macaddr, value);
}
break;
}
}
}
return 0;

View file

@ -10,7 +10,6 @@
#include <stdlib.h>
#include <string.h>
int upnp_get_NetworkInterfaceNumberOfEntries(){
int n = 0;
struct uci_section *s = NULL;