aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnton Nayshtut <qca_antonn@qca.qualcomm.com>2014-11-16 16:52:49 +0200
committerDmitry Shmidt <dimitrysh@google.com>2015-10-06 17:22:25 -0700
commitf715e8dfa2b9e3dc96419e976117a9f9b3d9991b (patch)
tree8536a152b58b152e83c75392021108f25323e7f2 /src
parent26c152a38111774bf296e664ce3b0369dc0c54e9 (diff)
downloadandroid_external_wpa_supplicant_8-f715e8dfa2b9e3dc96419e976117a9f9b3d9991b.tar.gz
android_external_wpa_supplicant_8-f715e8dfa2b9e3dc96419e976117a9f9b3d9991b.tar.bz2
android_external_wpa_supplicant_8-f715e8dfa2b9e3dc96419e976117a9f9b3d9991b.zip
hostapd: Global control interface notifications
This commit implements hostapd global control interface notifications infrastructure. hostapd global control interface clients issue ATTACH/DETACH commands to register and deregister with hostapd correspondingly - the same way as for any other hostapd/wpa_supplicant control interface. Bug: 24270573 Change-Id: I46da39e8262a446e7779a1adfbcb08b5bfa382d7 Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com> Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/ap/hostapd.h1
-rw-r--r--src/utils/wpa_debug.c27
-rw-r--r--src/utils/wpa_debug.h16
3 files changed, 44 insertions, 0 deletions
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index be5c7a89..dc71694b 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -41,6 +41,7 @@ struct hapd_interfaces {
size_t count;
int global_ctrl_sock;
+ struct wpa_ctrl_dst *global_ctrl_dst;
char *global_iface_path;
char *global_iface_name;
#ifndef CONFIG_NATIVE_WINDOWS
diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c
index b7a6dbae..3c263016 100644
--- a/src/utils/wpa_debug.c
+++ b/src/utils/wpa_debug.c
@@ -749,6 +749,33 @@ void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
bin_clear_free(buf, buflen);
}
+
+void wpa_msg_global_only(void *ctx, int level, const char *fmt, ...)
+{
+ va_list ap;
+ char *buf;
+ int buflen;
+ int len;
+
+ va_start(ap, fmt);
+ buflen = vsnprintf(NULL, 0, fmt, ap) + 1;
+ va_end(ap);
+
+ buf = os_malloc(buflen);
+ if (buf == NULL) {
+ wpa_printf(MSG_ERROR, "%s: Failed to allocate message buffer",
+ __func__);
+ return;
+ }
+ va_start(ap, fmt);
+ len = vsnprintf(buf, buflen, fmt, ap);
+ va_end(ap);
+ wpa_printf(level, "%s", buf);
+ if (wpa_msg_cb)
+ wpa_msg_cb(ctx, level, WPA_MSG_ONLY_GLOBAL, buf, len);
+ os_free(buf);
+}
+
#endif /* CONFIG_NO_WPA_MSG */
diff --git a/src/utils/wpa_debug.h b/src/utils/wpa_debug.h
index 5fdc50ef..87bd7fad 100644
--- a/src/utils/wpa_debug.h
+++ b/src/utils/wpa_debug.h
@@ -164,6 +164,7 @@ void wpa_hexdump_ascii_key(int level, const char *title, const void *buf,
#define wpa_msg_global(args...) do { } while (0)
#define wpa_msg_global_ctrl(args...) do { } while (0)
#define wpa_msg_no_global(args...) do { } while (0)
+#define wpa_msg_global_only(args...) do { } while (0)
#define wpa_msg_register_cb(f) do { } while (0)
#define wpa_msg_register_ifname_cb(f) do { } while (0)
#else /* CONFIG_NO_WPA_MSG */
@@ -243,10 +244,25 @@ PRINTF_FORMAT(3, 4);
void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
PRINTF_FORMAT(3, 4);
+/**
+ * wpa_msg_global_only - Conditional printf for ctrl_iface monitors
+ * @ctx: Pointer to context data; this is the ctx variable registered
+ * with struct wpa_driver_ops::init()
+ * @level: priority level (MSG_*) of the message
+ * @fmt: printf format string, followed by optional arguments
+ *
+ * This function is used to print conditional debugging and error messages.
+ * This function is like wpa_msg_global(), but it sends the output only as a
+ * global event.
+ */
+void wpa_msg_global_only(void *ctx, int level, const char *fmt, ...)
+PRINTF_FORMAT(3, 4);
+
enum wpa_msg_type {
WPA_MSG_PER_INTERFACE,
WPA_MSG_GLOBAL,
WPA_MSG_NO_GLOBAL,
+ WPA_MSG_ONLY_GLOBAL,
};
typedef void (*wpa_msg_cb_func)(void *ctx, int level, enum wpa_msg_type type,