@@ -270,6 +270,7 @@ extern "C" {
* parameters: map_id=<map_id> freq=<freq>
*/
#define NAN_CHAN_EVACUATION "NAN-CHAN-EVACUATION "
+#define NAN_STOPPED "NAN-STOPPED "
/* MESH events */
#define MESH_GROUP_STARTED "MESH-GROUP-STARTED "
@@ -195,6 +195,7 @@ static void wpas_nan_stop_cb(void *ctx)
wpa_drv_nan_stop(wpa_s);
nan_de_set_cluster_id(wpa_s->nan_de, NULL);
+ wpas_notify_nan_stopped(wpa_s);
}
@@ -1531,6 +1531,13 @@ void wpas_notify_nan_chan_evacuation(struct wpa_supplicant *wpa_s,
map_id, freq);
}
+
+void wpas_notify_nan_stopped(struct wpa_supplicant *wpa_s)
+{
+ wpa_msg_global(wpa_s, MSG_INFO, NAN_STOPPED "ifname=%s",
+ wpa_s->ifname);
+}
+
#endif /* CONFIG_NAN || CONFIG_NAN_USD */
@@ -259,5 +259,6 @@ void wpas_notify_nan_pairing_status(struct wpa_supplicant *wpa_s,
u16 status, const u8 *nd_pmk);
void wpas_notify_nan_chan_evacuation(struct wpa_supplicant *wpa_s,
u8 map_id, int freq);
+void wpas_notify_nan_stopped(struct wpa_supplicant *wpa_s);
#endif /* NOTIFY_H */
@@ -1167,6 +1167,15 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s,
if (state == WPA_INTERFACE_DISABLED) {
/* Assure normal scan when interface is restored */
wpa_s->normal_scans = 0;
+
+ /*
+ * A NAN management interface is not expected to be disabled. If
+ * it disabled, it means that NAN functionality is no longer
+ * possible so deinit (which would also stop any ongoing NAN
+ * operations)
+ */
+ if (wpa_s->nan_mgmt)
+ wpas_nan_deinit(wpa_s);
}
if (state == WPA_COMPLETED) {