From 0f9b4a0f1dd20ad2179b1eeeef269294f9d5893f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 8 Jan 2017 12:17:58 +0200 Subject: [PATCH] bgscan: Deliver beacon loss event to bgscan modules This adds a call to the notify_beacon_loss() callback functions when beacon loss is detected. In addition, a new CTRL-EVENT-BEACON-LOSS event is made available through the wpa_supplicant control interface. Signed-off-by: Jouni Malinen --- src/common/wpa_ctrl.h | 2 ++ wpa_supplicant/events.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index ec4e87922..766a3fa1e 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -74,6 +74,8 @@ extern "C" { #define WPA_EVENT_NETWORK_NOT_FOUND "CTRL-EVENT-NETWORK-NOT-FOUND " /** Change in the signal level was reported by the driver */ #define WPA_EVENT_SIGNAL_CHANGE "CTRL-EVENT-SIGNAL-CHANGE " +/** Beacon loss reported by the driver */ +#define WPA_EVENT_BEACON_LOSS "CTRL-EVENT-BEACON-LOSS " /** Regulatory domain channel */ #define WPA_EVENT_REGDOM_CHANGE "CTRL-EVENT-REGDOM-CHANGE " /** Channel switch (followed by freq= and other channel parameters) */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index afdda00bd..c2f8a662d 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1,6 +1,6 @@ /* * WPA Supplicant - Driver event processing - * Copyright (c) 2003-2015, Jouni Malinen + * Copyright (c) 2003-2017, Jouni Malinen * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -4334,6 +4334,12 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, data->p2p_lo_stop.reason_code); #endif /* CONFIG_P2P */ break; + case EVENT_BEACON_LOSS: + if (!wpa_s->current_bss || !wpa_s->current_ssid) + break; + wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_BEACON_LOSS); + bgscan_notify_beacon_loss(wpa_s); + break; default: wpa_msg(wpa_s, MSG_INFO, "Unknown event %d", event); break;