P2P: No duplicate AP-STA-CONNECTED/DISCONNECTED as global event
These events are sent as a special case to both the group interface and "parent interface" (i.e., the interface that was used for managing P2P negotiation). The latter is not really correct event, so get rid of it with the new global control interface design where there is no need to support legacy upper layer implementations. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
7793c959e6
commit
c4bf83a723
4 changed files with 43 additions and 5 deletions
|
@ -883,8 +883,8 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
if (hapd->msg_ctx_parent &&
|
if (hapd->msg_ctx_parent &&
|
||||||
hapd->msg_ctx_parent != hapd->msg_ctx)
|
hapd->msg_ctx_parent != hapd->msg_ctx)
|
||||||
wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
|
wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
|
||||||
AP_STA_CONNECTED "%s", buf);
|
AP_STA_CONNECTED "%s", buf);
|
||||||
|
|
||||||
sta->flags |= WLAN_STA_AUTHORIZED;
|
sta->flags |= WLAN_STA_AUTHORIZED;
|
||||||
} else {
|
} else {
|
||||||
|
@ -892,8 +892,8 @@ void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
|
||||||
|
|
||||||
if (hapd->msg_ctx_parent &&
|
if (hapd->msg_ctx_parent &&
|
||||||
hapd->msg_ctx_parent != hapd->msg_ctx)
|
hapd->msg_ctx_parent != hapd->msg_ctx)
|
||||||
wpa_msg(hapd->msg_ctx_parent, MSG_INFO,
|
wpa_msg_no_global(hapd->msg_ctx_parent, MSG_INFO,
|
||||||
AP_STA_DISCONNECTED "%s", buf);
|
AP_STA_DISCONNECTED "%s", buf);
|
||||||
|
|
||||||
sta->flags &= ~WLAN_STA_AUTHORIZED;
|
sta->flags &= ~WLAN_STA_AUTHORIZED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -671,6 +671,29 @@ void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
|
||||||
os_free(buf);
|
os_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
char *buf;
|
||||||
|
const int buflen = 2048;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
buf = os_malloc(buflen);
|
||||||
|
if (buf == NULL) {
|
||||||
|
wpa_printf(MSG_ERROR, "wpa_msg_no_global: Failed to allocate "
|
||||||
|
"message buffer");
|
||||||
|
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, 2, buf, len);
|
||||||
|
os_free(buf);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NO_WPA_MSG */
|
#endif /* CONFIG_NO_WPA_MSG */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -156,6 +156,7 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf,
|
||||||
#define wpa_msg(args...) do { } while (0)
|
#define wpa_msg(args...) do { } while (0)
|
||||||
#define wpa_msg_ctrl(args...) do { } while (0)
|
#define wpa_msg_ctrl(args...) do { } while (0)
|
||||||
#define wpa_msg_global(args...) do { } while (0)
|
#define wpa_msg_global(args...) do { } while (0)
|
||||||
|
#define wpa_msg_no_global(args...) do { } while (0)
|
||||||
#define wpa_msg_register_cb(f) do { } while (0)
|
#define wpa_msg_register_cb(f) do { } while (0)
|
||||||
#define wpa_msg_register_ifname_cb(f) do { } while (0)
|
#define wpa_msg_register_ifname_cb(f) do { } while (0)
|
||||||
#else /* CONFIG_NO_WPA_MSG */
|
#else /* CONFIG_NO_WPA_MSG */
|
||||||
|
@ -206,6 +207,20 @@ PRINTF_FORMAT(3, 4);
|
||||||
void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
|
void wpa_msg_global(void *ctx, int level, const char *fmt, ...)
|
||||||
PRINTF_FORMAT(3, 4);
|
PRINTF_FORMAT(3, 4);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* wpa_msg_no_global - 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(), but it does not send the output as a global
|
||||||
|
* event.
|
||||||
|
*/
|
||||||
|
void wpa_msg_no_global(void *ctx, int level, const char *fmt, ...)
|
||||||
|
PRINTF_FORMAT(3, 4);
|
||||||
|
|
||||||
typedef void (*wpa_msg_cb_func)(void *ctx, int level, int global,
|
typedef void (*wpa_msg_cb_func)(void *ctx, int level, int global,
|
||||||
const char *txt, size_t len);
|
const char *txt, size_t len);
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ static void wpa_supplicant_ctrl_iface_msg_cb(void *ctx, int level, int global,
|
||||||
if (wpa_s == NULL)
|
if (wpa_s == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (wpa_s->global->ctrl_iface) {
|
if (global != 2 && wpa_s->global->ctrl_iface) {
|
||||||
struct ctrl_iface_global_priv *priv = wpa_s->global->ctrl_iface;
|
struct ctrl_iface_global_priv *priv = wpa_s->global->ctrl_iface;
|
||||||
if (!dl_list_empty(&priv->ctrl_dst)) {
|
if (!dl_list_empty(&priv->ctrl_dst)) {
|
||||||
wpa_supplicant_ctrl_iface_send(global ? NULL :
|
wpa_supplicant_ctrl_iface_send(global ? NULL :
|
||||||
|
|
Loading…
Reference in a new issue