Skip to content
Snippets Groups Projects
Commit ea33faff authored by Anjan Chanda's avatar Anjan Chanda
Browse files

show base interface for WiFi 4addr interfaces

parent e0502f1e
No related tags found
No related merge requests found
Pipeline #123305 passed
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <easy/easy.h> #include <easy/easy.h>
#include "wifi_api.h"
#include "util.h" #include "util.h"
#include "debug.h" #include "debug.h"
#include "timer.h" #include "timer.h"
...@@ -736,6 +737,14 @@ int hostmngr_ubus_show_hosts(struct ubus_context *ctx, struct ubus_object *obj, ...@@ -736,6 +737,14 @@ int hostmngr_ubus_show_hosts(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_string(&bb, "device", e->ifname); blobmsg_add_string(&bb, "device", e->ifname);
ifname = e->ifname; ifname = e->ifname;
} }
if (is_wifi_interface(ifname) == 1) {
char pifname[16] = {0};
interface_get_4addr_parent(ifname, pifname);
blobmsg_add_string(&bb, "parent_device", pifname);
}
net = hostmngr_ifname_to_network(p, ifname); net = hostmngr_ifname_to_network(p, ifname);
blobmsg_add_string(&bb, "network", net ? net : ""); blobmsg_add_string(&bb, "network", net ? net : "");
......
...@@ -65,6 +65,9 @@ int is_wifi_interface(const char *ifname) ...@@ -65,6 +65,9 @@ int is_wifi_interface(const char *ifname)
char rpath[PATH_MAX] = {0}; char rpath[PATH_MAX] = {0};
struct stat s; struct stat s;
if (!ifname)
return 0;
memset(&s, 0, sizeof(struct stat)); memset(&s, 0, sizeof(struct stat));
snprintf(path, 512, "/sys/class/net/%s/phy80211", ifname); snprintf(path, 512, "/sys/class/net/%s/phy80211", ifname);
if (!realpath(path, rpath)) if (!realpath(path, rpath))
...@@ -90,6 +93,9 @@ int is_ap_interface(const char *ifname) ...@@ -90,6 +93,9 @@ int is_ap_interface(const char *ifname)
enum wifi_mode mode; enum wifi_mode mode;
int ret; int ret;
if (!ifname)
return 0;
ret = wifi_get_mode(ifname, &mode); ret = wifi_get_mode(ifname, &mode);
if (!ret) { if (!ret) {
if (mode == WIFI_MODE_AP || mode == WIFI_MODE_AP_VLAN) if (mode == WIFI_MODE_AP || mode == WIFI_MODE_AP_VLAN)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment