aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/ctrl_iface.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-08-25 17:53:58 (GMT)
committerJouni Malinen <j@w1.fi>2013-08-25 17:53:58 (GMT)
commitae8c27f79d39eb428d7d5e22451042bd109f8dea (patch)
tree42a3fa82a63c51421946fa54bb8de76a6efaf8ae /wpa_supplicant/ctrl_iface.c
parent42868f148663ba4f9b2a3622642b732465e06427 (diff)
downloadhostap-ae8c27f79d39eb428d7d5e22451042bd109f8dea.zip
hostap-ae8c27f79d39eb428d7d5e22451042bd109f8dea.tar.gz
hostap-ae8c27f79d39eb428d7d5e22451042bd109f8dea.tar.bz2
Add STATUS command to global control interface
This provides global status information that is applicable to all interfaces (e.g., P2P state). In addition, ifname/address pairs are listed to get information of all the interfaces that are currently managed through this wpa_supplicant instance. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/ctrl_iface.c')
-rw-r--r--wpa_supplicant/ctrl_iface.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 1a42ae3..1064f1d 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -6036,6 +6036,47 @@ static int wpas_global_ctrl_iface_save_config(struct wpa_global *global)
#endif /* CONFIG_NO_CONFIG_WRITE */
+static int wpas_global_ctrl_iface_status(struct wpa_global *global,
+ char *buf, size_t buflen)
+{
+ char *pos, *end;
+ int ret;
+ struct wpa_supplicant *wpa_s;
+
+ pos = buf;
+ end = buf + buflen;
+
+#ifdef CONFIG_P2P
+ if (global->p2p) {
+ ret = os_snprintf(pos, end - pos, "p2p_device_address=" MACSTR
+ "\n", MAC2STR(global->p2p_dev_addr));
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ }
+#endif /* CONFIG_P2P */
+
+#ifdef CONFIG_WIFI_DISPLAY
+ ret = os_snprintf(pos, end - pos, "wifi_display=%d\n",
+ !!global->wifi_display);
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+#endif /* CONFIG_WIFI_DISPLAY */
+
+ for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+ ret = os_snprintf(pos, end - pos, "ifname=%s\n"
+ "address=" MACSTR "\n",
+ wpa_s->ifname, MAC2STR(wpa_s->own_addr));
+ if (ret < 0 || ret >= end - pos)
+ return pos - buf;
+ pos += ret;
+ }
+
+ return pos - buf;
+}
+
+
char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
char *buf, size_t *resp_len)
{
@@ -6101,6 +6142,9 @@ char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global *global,
if (wpas_global_ctrl_iface_save_config(global))
reply_len = -1;
#endif /* CONFIG_NO_CONFIG_WRITE */
+ } else if (os_strcmp(buf, "STATUS") == 0) {
+ reply_len = wpas_global_ctrl_iface_status(global, reply,
+ reply_size);
} else {
os_memcpy(reply, "UNKNOWN COMMAND\n", 16);
reply_len = 16;