From e6cbe75a9a7cb424ca256c2769f3c7bb59332813 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sat, 30 Nov 2013 16:49:04 +0100 Subject: [PATCH] wireless: show the virtual interface section name in wireless status Signed-off-by: Felix Fietkau --- config.c | 2 +- wireless.c | 6 +++++- wireless.h | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.c b/config.c index bb0cd05..6784dda 100644 --- a/config.c +++ b/config.c @@ -304,7 +304,7 @@ config_parse_wireless_interface(struct wireless_device *wdev, struct uci_section { blob_buf_init(&b, 0); uci_to_blob(&b, s, wdev->drv->interface.config); - wireless_interface_create(wdev, b.head); + wireless_interface_create(wdev, b.head, s->e.name); } static void diff --git a/wireless.c b/wireless.c index 4819f92..23bedcc 100644 --- a/wireless.c +++ b/wireless.c @@ -505,6 +505,7 @@ vif_update(struct vlist_tree *tree, struct vlist_node *node_new, vif_old->config = blob_memdup(vif_new->config); wireless_interface_init_config(vif_old); free(vif_new); + vif_old->section = vif_new->section; } else if (vif_new) { D(WIRELESS, "Create new wireless interface %s on device %s\n", vif_new->name, wdev->name); vif_new->config = blob_memdup(vif_new->config); @@ -604,7 +605,7 @@ wireless_device_create(struct wireless_driver *drv, const char *name, struct blo wdev->script_check.cb = wireless_device_check_script_tasks; } -void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data) +void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section) { struct wireless_interface *vif; struct blob_attr *tb[__VIF_ATTR_MAX]; @@ -624,6 +625,7 @@ void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *d vif->name = strcpy(name_buf, name); vif->wdev = wdev; vif->config = data; + vif->section = section; vlist_add(&wdev->interfaces, &vif->node, vif->name); } @@ -633,6 +635,8 @@ wireless_interface_status(struct wireless_interface *iface, struct blob_buf *b) void *i; i = blobmsg_open_table(b, iface->name); + if (iface->section) + blobmsg_add_string(b, "section", iface->section); if (iface->ifname) blobmsg_add_string(b, "ifname", iface->ifname); if (iface->data) diff --git a/wireless.h b/wireless.h index c6609e7..4a98c77 100644 --- a/wireless.h +++ b/wireless.h @@ -65,6 +65,7 @@ struct wireless_device { struct wireless_interface { struct vlist_node node; + const char *section; char *name; struct wireless_device *wdev; @@ -89,7 +90,7 @@ void wireless_device_create(struct wireless_driver *drv, const char *name, struc void wireless_device_set_up(struct wireless_device *wdev); void wireless_device_set_down(struct wireless_device *wdev); void wireless_device_status(struct wireless_device *wdev, struct blob_buf *b); -void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data); +void wireless_interface_create(struct wireless_device *wdev, struct blob_attr *data, const char *section); int wireless_device_notify(struct wireless_device *wdev, struct blob_attr *data, struct ubus_request_data *req); -- 2.30.2