Commit a42fb9ed authored by Anjan Chanda's avatar Anjan Chanda

show backhaul interfaces in wifi status

parent 0d7a6794
......@@ -2416,7 +2416,6 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
void *t, *tt, *ttt, *tttt, *t5;
int i, j;
num_radios = wifimngr_get_wifi_devices(radios);
if (num_radios < 0)
return 0;
......@@ -2425,7 +2424,7 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
if (num_ifs < 0)
return 0;
fprintf(stderr, "radios = %d ifs = %d\n", num_radios, num_ifs);
/* fprintf(stderr, "radios = %d ifs = %d\n", num_radios, num_ifs); */
memset(&bb, 0, sizeof(bb));
blob_buf_init(&bb, 0);
......@@ -2445,7 +2444,7 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
struct wifi_caps radiocaps;
char alpha2[3] = {0};
const char *country;
int nr;
int nr = 0;
int j;
......@@ -2471,6 +2470,8 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
country == NULL ? "" : country,
band == 1 ? 5 : 2, bw_int[bw]);
fprintf(stderr, "Supported Channels: %d\n", nr);
wifi_get_maxrate(radios[i], &rate);
wifi_get_noise(radios[i], &noise);
wifi_get_oper_stds(radios[i], &s);
......@@ -2507,7 +2508,8 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
if (ifs[j].device[0] &&
!strncmp(ifs[j].device, radios[i], 16)) {
!strncmp(ifs[j].device, radios[i], 16) &&
ifs[j].mode == WIFI_AP) {
/* fprintf(stderr, "Matched: rad = %s if = %s\n",
ifs[j].device, ifname); */
//memset(ifs[j].device, 0, 16);
......@@ -2535,6 +2537,31 @@ static int wl_status(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_close_table(&bb, tttt);
}
blobmsg_close_array(&bb, tt);
tt = blobmsg_open_array(&bb, "backhauls");
for (j = 0; j < num_ifs; j++) {
char *ifname = ifs[j].iface;
//enum oper_state opstatus;
if (ifs[j].device[0] &&
!strncmp(ifs[j].device, radios[i], 16) &&
ifs[j].mode == WIFI_STA) {
;
} else {
continue;
}
wifi_get_ifstatus(ifname, &ifstat);
//wifi_get_ifoperstatus(ifname, &opstatus);
tttt = blobmsg_open_table(&bb, "");
blobmsg_add_string(&bb, "ifname", ifname);
blobmsg_add_string(&bb, "status", ifstatus_str(ifstat));
//blobmsg_add_string(&bb, "operstate", operstate_str[opstatus]);
blobmsg_close_table(&bb, tttt);
}
blobmsg_close_array(&bb, tt);
blobmsg_close_table(&bb, ttt);
}
blobmsg_close_array(&bb, t);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment