PPP.Interface.: fix get value of stats parameters

This commit is contained in:
Amin Ben Ramdhane 2020-07-07 19:39:08 +01:00
parent cfb5016c90
commit f3c9ed9efd
3 changed files with 12 additions and 4 deletions

View file

@ -207,9 +207,8 @@ static int ppp_read_sysfs(struct uci_section *sect, const char *name, char **val
dmuci_get_value_by_section_string(sect, "proto", &proto);
if (!strcmp(proto, "pppoe")) {
char *ifname;
dmuci_get_value_by_section_string(sect, "ifname", &ifname);
rc = get_net_device_sysfs(ifname, name, value);
char *l3_device = get_l3_device(section_name(sect));
rc = get_net_device_sysfs(l3_device, name, value);
}
return rc;
}

View file

@ -1296,6 +1296,14 @@ char *get_device(char *interface_name)
return dmjson_get_value(res, 1, "device");
}
char *get_l3_device(char *interface_name)
{
json_object *res;
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", interface_name, String}}, 1, &res);
return dmjson_get_value(res, 1, "l3_device");
}
char *get_device_from_wifi_iface(const char *wifi_iface, const char *wifi_section)
{
json_object *jobj;

View file

@ -289,7 +289,8 @@ char **strsplit(const char* str, const char* delim, size_t* numtokens);
char **strsplit_by_str(const char str[], char *delim);
char *get_macaddr_from_device(char *device_name);
char *get_macaddr(char *ifname);
char *get_device(char *ifname);
char *get_device(char *interface_name);
char *get_l3_device(char *interface_name);
int is_elt_exit_in_str_list(char *str_list, char *elt);
void add_elt_to_str_list(char **str_list, char *elt);
void remove_elt_from_str_list(char **iface_list, char *ifname);