blob: a544c94b11cb4236fec591ef8372cfd7469f8b0c [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#include "utils/includes.h"
10
11#include "utils/common.h"
12#include "common/wpa_ctrl.h"
13#include "config.h"
14#include "wpa_supplicant_i.h"
15#include "wps_supplicant.h"
16#include "dbus/dbus_common.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017#include "dbus/dbus_new.h"
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080018#include "rsn_supp/wpa.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080019#include "fst/fst.h"
Hai Shalom81f62d82019-07-22 12:10:00 -070020#include "crypto/tls.h"
Hai Shalomc1a21442022-02-04 13:43:00 -080021#include "bss.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022#include "driver_i.h"
23#include "scan.h"
24#include "p2p_supplicant.h"
25#include "sme.h"
26#include "notify.h"
Gabriel Biren57ededa2021-09-03 16:08:50 +000027#include "aidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070028
29int wpas_notify_supplicant_initialized(struct wpa_global *global)
30{
Hai Shalom021b0b52019-04-10 11:17:58 -070031#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070032 if (global->params.dbus_ctrl_interface) {
33 global->dbus = wpas_dbus_init(global);
34 if (global->dbus == NULL)
35 return -1;
36 }
Hai Shalom021b0b52019-04-10 11:17:58 -070037#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070038
Gabriel Biren57ededa2021-09-03 16:08:50 +000039#ifdef CONFIG_AIDL
40 global->aidl = wpas_aidl_init(global);
41 if (!global->aidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070042 return -1;
Gabriel Biren57ededa2021-09-03 16:08:50 +000043#endif /* CONFIG_AIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070044
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070045 return 0;
46}
47
48
49void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
50{
Hai Shalom021b0b52019-04-10 11:17:58 -070051#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070052 if (global->dbus)
53 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070054#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070055
Gabriel Biren57ededa2021-09-03 16:08:50 +000056#ifdef CONFIG_AIDL
57 if (global->aidl)
58 wpas_aidl_deinit(global->aidl);
59#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070060}
61
62
63int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
64{
Hai Shalomc4809952019-04-30 14:45:55 -070065 if (!wpa_s->p2p_mgmt) {
66 if (wpas_dbus_register_interface(wpa_s))
67 return -1;
68 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080070 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000071 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070072 return -1;
73
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070074 return 0;
75}
76
77
78void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
79{
Hai Shalomc4809952019-04-30 14:45:55 -070080 if (!wpa_s->p2p_mgmt) {
81 /* unregister interface in new DBus ctrl iface */
82 wpas_dbus_unregister_interface(wpa_s);
83 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070084
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080085 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000086 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070087}
88
89
90void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
91 enum wpa_states new_state,
92 enum wpa_states old_state)
93{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080094 if (wpa_s->p2p_mgmt)
95 return;
96
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070097 /* notify the new DBus API */
98 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
99
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800100#ifdef CONFIG_FST
101 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
102 if (new_state == WPA_COMPLETED)
103 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
104 else if (old_state >= WPA_ASSOCIATED &&
105 new_state < WPA_ASSOCIATED)
106 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
107 }
108#endif /* CONFIG_FST */
109
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700110 if (new_state == WPA_COMPLETED)
111 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700112 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700113 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700114
115 sme_state_changed(wpa_s);
116
117#ifdef ANDROID
118 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700119 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700120 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700121 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700122 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700123 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
124 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800125 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700126#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700127
Gabriel Biren57ededa2021-09-03 16:08:50 +0000128 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129}
130
131
Dmitry Shmidt04949592012-07-19 12:16:46 -0700132void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
133{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800134 if (wpa_s->p2p_mgmt)
135 return;
136
Dmitry Shmidt04949592012-07-19 12:16:46 -0700137 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800138
Gabriel Biren57ededa2021-09-03 16:08:50 +0000139 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700140}
141
142
Hai Shalom74f70d42019-02-11 14:42:39 -0800143void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
144{
145 if (wpa_s->p2p_mgmt)
146 return;
147
148 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
149}
150
151
Sunil Ravi972b2042020-08-14 10:50:48 -0700152void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800153 const u8 *bssid, u8 timed_out,
154 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800155{
156 if (wpa_s->p2p_mgmt)
157 return;
158
159 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800160
Gabriel Biren57ededa2021-09-03 16:08:50 +0000161 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800162}
163
Roshan Pius38e96762017-01-23 14:52:00 -0800164void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
165 if (wpa_s->p2p_mgmt)
166 return;
167
Gabriel Biren57ededa2021-09-03 16:08:50 +0000168 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800169}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800170
Hai Shalom74f70d42019-02-11 14:42:39 -0800171void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
172{
173 if (wpa_s->p2p_mgmt)
174 return;
175
176 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
177}
178
179
180void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
181{
182 if (wpa_s->p2p_mgmt)
183 return;
184
185 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
186}
187
188
189void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
190{
191 if (wpa_s->p2p_mgmt)
192 return;
193
194 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
195}
196
197
198void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
199{
200 if (wpa_s->p2p_mgmt)
201 return;
202
203 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800204
205#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000206 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800207#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800208}
209
210
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700211void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
212{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800213 if (wpa_s->p2p_mgmt)
214 return;
215
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700216 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
217}
218
219
220void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
221{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800222 if (wpa_s->p2p_mgmt)
223 return;
224
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700225 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
226}
227
228
229void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
230{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800231 if (wpa_s->p2p_mgmt)
232 return;
233
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700234 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700235
Gabriel Biren57ededa2021-09-03 16:08:50 +0000236 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237}
238
239
240void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
241{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800242 if (wpa_s->p2p_mgmt)
243 return;
244
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700245 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
246}
247
248
249void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
250 struct wpa_ssid *ssid)
251{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800252 if (wpa_s->p2p_mgmt)
253 return;
254
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700255 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
256}
257
258
259void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
260 struct wpa_ssid *ssid)
261{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800262 if (wpa_s->p2p_mgmt)
263 return;
264
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700265 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
266}
267
268
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800269void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
270 struct wpa_ssid *ssid,
271 enum wpa_ctrl_req_type rtype,
272 const char *default_txt)
273{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800274 if (wpa_s->p2p_mgmt)
275 return;
276
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800277 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700278
Gabriel Biren57ededa2021-09-03 16:08:50 +0000279 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800280}
281
282
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700283void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
284{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800285 if (wpa_s->p2p_mgmt)
286 return;
287
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700288 /* notify the new DBus API */
289 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
290}
291
292
293void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
294{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800295 if (wpa_s->p2p_mgmt)
296 return;
297
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700298 wpas_dbus_signal_scan_done(wpa_s, success);
299}
300
301
302void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
303{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800304 if (wpa_s->p2p_mgmt)
305 return;
306
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700307 wpas_wps_notify_scan_results(wpa_s);
308}
309
310
311void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
312 const struct wps_credential *cred)
313{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800314 if (wpa_s->p2p_mgmt)
315 return;
316
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700317#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700318 /* notify the new DBus API */
319 wpas_dbus_signal_wps_cred(wpa_s, cred);
320#endif /* CONFIG_WPS */
321}
322
323
324void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
325 struct wps_event_m2d *m2d)
326{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800327 if (wpa_s->p2p_mgmt)
328 return;
329
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700330#ifdef CONFIG_WPS
331 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
332#endif /* CONFIG_WPS */
333}
334
335
336void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
337 struct wps_event_fail *fail)
338{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800339 if (wpa_s->p2p_mgmt)
340 return;
341
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700342#ifdef CONFIG_WPS
343 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800344
Gabriel Biren57ededa2021-09-03 16:08:50 +0000345 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800346 fail->config_error,
347 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700348#endif /* CONFIG_WPS */
349}
350
351
352void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
353{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800354 if (wpa_s->p2p_mgmt)
355 return;
356
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700357#ifdef CONFIG_WPS
358 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800359
Gabriel Biren57ededa2021-09-03 16:08:50 +0000360 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700361#endif /* CONFIG_WPS */
362}
363
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700364void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
365{
366 if (wpa_s->p2p_mgmt)
367 return;
368
369#ifdef CONFIG_WPS
370 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800371
Gabriel Biren57ededa2021-09-03 16:08:50 +0000372 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700373#endif /* CONFIG_WPS */
374}
375
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700376
377void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
378 struct wpa_ssid *ssid)
379{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800380 if (wpa_s->p2p_mgmt)
381 return;
382
Jouni Malinen75ecf522011-06-27 15:19:46 -0700383 /*
384 * Networks objects created during any P2P activities should not be
385 * exposed out. They might/will confuse certain non-P2P aware
386 * applications since these network objects won't behave like
387 * regular ones.
388 */
Roshan Piusd3854452016-07-07 16:46:41 -0700389 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700390 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000391 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800392 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
393 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700394 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700395}
396
397
398void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
399 struct wpa_ssid *ssid)
400{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700401#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700402 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000403 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700404#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700405}
406
407
408void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
409 struct wpa_ssid *ssid)
410{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700411#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700412 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000413 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700414#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700415}
416
417
418void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
419 struct wpa_ssid *ssid)
420{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800421 if (wpa_s->next_ssid == ssid)
422 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700423 if (wpa_s->last_ssid == ssid)
424 wpa_s->last_ssid = NULL;
425 if (wpa_s->current_ssid == ssid)
426 wpa_s->current_ssid = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700427#if defined(CONFIG_SME) && defined(CONFIG_SAE)
428 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
429 wpa_s->sme.ext_auth_wpa_ssid = NULL;
430#endif /* CONFIG_SME && CONFIG_SAE */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800431 if (wpa_s->wpa)
432 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700433 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700434 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700435 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000436 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800437 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
438 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700439 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800440 if (network_is_persistent_group(ssid))
441 wpas_notify_persistent_group_removed(wpa_s, ssid);
442
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800443 wpas_p2p_network_removed(wpa_s, ssid);
Hai Shalom60840252021-02-19 19:02:11 -0800444
445#ifdef CONFIG_PASN
446 if (wpa_s->pasn.ssid == ssid)
447 wpa_s->pasn.ssid = NULL;
448#endif /* CONFIG_PASN */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700449}
450
451
452void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
453 u8 bssid[], unsigned int id)
454{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800455 if (wpa_s->p2p_mgmt)
456 return;
457
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700458 wpas_dbus_register_bss(wpa_s, bssid, id);
459 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
460 id, MAC2STR(bssid));
461}
462
463
464void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
465 u8 bssid[], unsigned int id)
466{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800467 if (wpa_s->p2p_mgmt)
468 return;
469
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700470 wpas_dbus_unregister_bss(wpa_s, bssid, id);
471 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
472 id, MAC2STR(bssid));
473}
474
475
476void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
477 unsigned int id)
478{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800479 if (wpa_s->p2p_mgmt)
480 return;
481
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700482 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
483}
484
485
486void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
487 unsigned int id)
488{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800489 if (wpa_s->p2p_mgmt)
490 return;
491
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700492 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
493 id);
494}
495
496
497void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
498 unsigned int id)
499{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800500 if (wpa_s->p2p_mgmt)
501 return;
502
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700503 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
504 id);
505}
506
507
508void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
509 unsigned int id)
510{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800511 if (wpa_s->p2p_mgmt)
512 return;
513
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700514 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
515}
516
517
518void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
519 unsigned int id)
520{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800521 if (wpa_s->p2p_mgmt)
522 return;
523
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700524 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
525}
526
527
528void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
529 unsigned int id)
530{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800531 if (wpa_s->p2p_mgmt)
532 return;
533
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700534 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
535}
536
537
538void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
539 unsigned int id)
540{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800541 if (wpa_s->p2p_mgmt)
542 return;
543
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800544#ifdef CONFIG_WPS
545 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
546#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700547}
548
549
550void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
551 unsigned int id)
552{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800553 if (wpa_s->p2p_mgmt)
554 return;
555
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700556 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
557}
558
559
560void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
561 unsigned int id)
562{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800563 if (wpa_s->p2p_mgmt)
564 return;
565
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700566 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
567}
568
569
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700570void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
571{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800572 if (wpa_s->p2p_mgmt)
573 return;
574
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700575 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
576}
577
578
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700579void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
580{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800581 if (wpa_s->p2p_mgmt)
582 return;
583
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700584 wpas_dbus_signal_blob_added(wpa_s, name);
585}
586
587
588void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
589{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800590 if (wpa_s->p2p_mgmt)
591 return;
592
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700593 wpas_dbus_signal_blob_removed(wpa_s, name);
594}
595
596
597void wpas_notify_debug_level_changed(struct wpa_global *global)
598{
599 wpas_dbus_signal_debug_level_changed(global);
600}
601
602
603void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
604{
605 wpas_dbus_signal_debug_timestamp_changed(global);
606}
607
608
609void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
610{
611 wpas_dbus_signal_debug_show_keys_changed(global);
612}
613
614
615void wpas_notify_suspend(struct wpa_global *global)
616{
617 struct wpa_supplicant *wpa_s;
618
619 os_get_time(&global->suspend_time);
620 wpa_printf(MSG_DEBUG, "System suspend notification");
621 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
622 wpa_drv_suspend(wpa_s);
623}
624
625
626void wpas_notify_resume(struct wpa_global *global)
627{
628 struct os_time now;
629 int slept;
630 struct wpa_supplicant *wpa_s;
631
632 if (global->suspend_time.sec == 0)
633 slept = -1;
634 else {
635 os_get_time(&now);
636 slept = now.sec - global->suspend_time.sec;
637 }
638 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
639 slept);
640
641 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
642 wpa_drv_resume(wpa_s);
643 if (wpa_s->wpa_state == WPA_DISCONNECTED)
644 wpa_supplicant_req_scan(wpa_s, 0, 100000);
645 }
646}
647
648
649#ifdef CONFIG_P2P
650
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700651void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
652{
653 /* Notify P2P find has stopped */
654 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800655
Gabriel Biren57ededa2021-09-03 16:08:50 +0000656 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700657}
658
659
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700660void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800661 const u8 *addr, const struct p2p_peer_info *info,
662 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800663 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800664 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700665{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700666 if (new_device) {
667 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800668 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700669 }
670
671 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800672 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
673
Gabriel Biren57ededa2021-09-03 16:08:50 +0000674 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800675 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800676 peer_wfd_device_info_len,
677 peer_wfd_r2_device_info,
678 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700679}
680
681
682void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
683 const u8 *dev_addr)
684{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700685 wpas_dbus_unregister_peer(wpa_s, dev_addr);
686
687 /* Create signal on interface object*/
688 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800689
Gabriel Biren57ededa2021-09-03 16:08:50 +0000690 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700691}
692
693
694void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
695 const struct wpa_ssid *ssid,
696 const char *role)
697{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700698 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700699
700 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800701
Gabriel Biren57ededa2021-09-03 16:08:50 +0000702 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700703}
704
705
706void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700707 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700708{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700709 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800710
Gabriel Biren57ededa2021-09-03 16:08:50 +0000711 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700712}
713
714
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800715void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
716 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700717{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800718 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800719
Gabriel Biren57ededa2021-09-03 16:08:50 +0000720 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700721}
722
723
724void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
725 int status, const u8 *bssid)
726{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700727 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800728
Gabriel Biren57ededa2021-09-03 16:08:50 +0000729 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700730}
731
732
733void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
734 int freq, const u8 *sa, u8 dialog_token,
735 u16 update_indic, const u8 *tlvs,
736 size_t tlvs_len)
737{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700738 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
739 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700740}
741
742
743void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
744 const u8 *sa, u16 update_indic,
745 const u8 *tlvs, size_t tlvs_len)
746{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700747 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
748 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800749
Gabriel Biren57ededa2021-09-03 16:08:50 +0000750 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800751 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700752}
753
754
755/**
756 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
757 * @dev_addr: Who sent the request or responded to our request.
758 * @request: Will be 1 if request, 0 for response.
759 * @status: Valid only in case of response (0 in case of success)
760 * @config_methods: WPS config methods
761 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
762 *
763 * This can be used to notify:
764 * - Requests or responses
765 * - Various config methods
766 * - Failure condition in case of response
767 */
768void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
769 const u8 *dev_addr, int request,
770 enum p2p_prov_disc_status status,
771 u16 config_methods,
772 unsigned int generated_pin)
773{
774 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
775 status, config_methods,
776 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800777
Gabriel Biren57ededa2021-09-03 16:08:50 +0000778 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800779 status, config_methods,
780 generated_pin);
781
Jouni Malinen75ecf522011-06-27 15:19:46 -0700782}
783
784
785void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700786 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800787 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700788{
789 /* Notify a group has been started */
790 wpas_dbus_register_p2p_group(wpa_s, ssid);
791
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800792 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800793
Gabriel Biren57ededa2021-09-03 16:08:50 +0000794 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700795}
796
797
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800798void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
799 const char *reason)
800{
801 /* Notify a group formation failed */
802 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800803
Gabriel Biren57ededa2021-09-03 16:08:50 +0000804 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800805}
806
807
Jouni Malinen75ecf522011-06-27 15:19:46 -0700808void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
809 struct wps_event_fail *fail)
810{
811 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700812}
813
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800814
815void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
816 const u8 *sa, const u8 *go_dev_addr,
817 const u8 *bssid, int id, int op_freq)
818{
819 /* Notify a P2P Invitation Request */
820 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
821 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800822
Gabriel Biren57ededa2021-09-03 16:08:50 +0000823 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800824 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800825}
826
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700827#endif /* CONFIG_P2P */
828
829
830static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800831 const u8 *sta,
832 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700833{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700834#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800835 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
836
Jouni Malinen75ecf522011-06-27 15:19:46 -0700837 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700838 * Create 'peer-joined' signal on group object -- will also
839 * check P2P itself.
840 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800841 if (p2p_dev_addr)
842 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700843#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700844
Hai Shalom74f70d42019-02-11 14:42:39 -0800845 /* Register the station */
846 wpas_dbus_register_sta(wpa_s, sta);
847
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700848 /* Notify listeners a new station has been authorized */
849 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800850
Gabriel Biren57ededa2021-09-03 16:08:50 +0000851 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700852}
853
854
855static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700856 const u8 *sta,
857 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700858{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700859#ifdef CONFIG_P2P
860 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700861 * Create 'peer-disconnected' signal on group object if this
862 * is a P2P group.
863 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800864 if (p2p_dev_addr)
865 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700866#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700867
868 /* Notify listeners a station has been deauthorized */
869 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800870
Gabriel Biren57ededa2021-09-03 16:08:50 +0000871 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800872 /* Unregister the station */
873 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700874}
875
876
877void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800878 const u8 *mac_addr, int authorized,
879 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700880{
881 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800882 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700883 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700884 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700885}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700886
887
Hai Shalom81f62d82019-07-22 12:10:00 -0700888void wpas_notify_certification(struct wpa_supplicant *wpa_s,
889 struct tls_cert_data *cert,
890 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700891{
Hai Shalom81f62d82019-07-22 12:10:00 -0700892 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700893
Hai Shalom81f62d82019-07-22 12:10:00 -0700894 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700895 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700896 cert->depth, cert->subject, cert_hash ? " hash=" : "",
897 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700898 cert->tod == 2 ? " tod=2" : "",
899 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700900
901 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700902 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700903 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700904 cert_hex = os_malloc(len);
905 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700906 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
907 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700908 wpa_msg_ctrl(wpa_s, MSG_INFO,
909 WPA_EVENT_EAP_PEER_CERT
910 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700911 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700912 os_free(cert_hex);
913 }
914 }
915
Hai Shalom81f62d82019-07-22 12:10:00 -0700916 for (i = 0; i < cert->num_altsubject; i++)
917 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
918 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800919
Jimmy Chen429daf92021-10-20 13:27:23 +0800920 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
921 cert->altsubject, cert->num_altsubject,
922 cert_hash, cert->cert);
923
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700924 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700925 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
926 cert->altsubject, cert->num_altsubject,
927 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700928}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700929
930
931void wpas_notify_preq(struct wpa_supplicant *wpa_s,
932 const u8 *addr, const u8 *dst, const u8 *bssid,
933 const u8 *ie, size_t ie_len, u32 ssi_signal)
934{
935#ifdef CONFIG_AP
936 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
937#endif /* CONFIG_AP */
938}
939
940
941void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
942 const char *parameter)
943{
944 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700945 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
946 "status='%s' parameter='%s'",
947 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700948}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700949
Roshan Pius3a1667e2018-07-03 15:17:14 -0700950
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700951void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
952{
953 wpa_dbg(wpa_s, MSG_ERROR,
954 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000955 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700956}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700957
Roshan Pius3a1667e2018-07-03 15:17:14 -0700958
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700959void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
960 struct wpa_ssid *ssid)
961{
962 if (wpa_s->current_ssid != ssid)
963 return;
964
965 wpa_dbg(wpa_s, MSG_DEBUG,
966 "Network bssid config changed for the current network - within-ESS roaming %s",
967 ssid->bssid_set ? "disabled" : "enabled");
968
969 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
970 ssid->bssid_set ? ssid->bssid : NULL);
971}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800972
973
974void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
975 struct wpa_ssid *ssid)
976{
977#ifdef CONFIG_P2P
978 if (ssid->disabled == 2) {
979 /* Changed from normal network profile to persistent group */
980 ssid->disabled = 0;
981 wpas_dbus_unregister_network(wpa_s, ssid->id);
982 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700983 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800984 wpas_dbus_register_persistent_group(wpa_s, ssid);
985 } else {
986 /* Changed from persistent group to normal network profile */
987 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700988 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800989 wpas_dbus_register_network(wpa_s, ssid);
990 }
991#endif /* CONFIG_P2P */
992}
Roshan Pius04a9d742016-12-12 12:40:46 -0800993
994void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
995 const char *result,
996 const struct wpa_bss_anqp *anqp)
997{
998#ifdef CONFIG_INTERWORKING
999 if (!wpa_s || !bssid || !anqp)
1000 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001001
Gabriel Biren57ededa2021-09-03 16:08:50 +00001002 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001003#endif /* CONFIG_INTERWORKING */
1004}
1005
1006void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1007 const char* file_name, const u8* image,
1008 u32 image_length)
1009{
1010#ifdef CONFIG_HS20
1011 if (!wpa_s || !bssid || !file_name || !image)
1012 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001013
Gabriel Biren57ededa2021-09-03 16:08:50 +00001014 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001015 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001016#endif /* CONFIG_HS20 */
1017}
1018
1019void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1020 const char* url,
1021 u8 osu_method)
1022{
1023#ifdef CONFIG_HS20
1024 if (!wpa_s || !url)
1025 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001026
Gabriel Biren57ededa2021-09-03 16:08:50 +00001027 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001028#endif /* CONFIG_HS20 */
1029}
1030
1031void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1032 u8 code, u16 reauth_delay,
1033 const char *url)
1034{
1035#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001036 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001037 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001038
Gabriel Biren57ededa2021-09-03 16:08:50 +00001039 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001040 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001041#endif /* CONFIG_HS20 */
1042}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001043
Hai Shalom04a4ca62020-10-28 19:04:47 -07001044void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1045 struct wpa_supplicant *wpa_s, const char *url) {
1046#ifdef CONFIG_HS20
1047 if (!wpa_s || !url)
1048 return;
1049
Gabriel Biren57ededa2021-09-03 16:08:50 +00001050 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001051#endif /* CONFIG_HS20 */
1052}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001053
1054#ifdef CONFIG_MESH
1055
1056void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1057 struct wpa_ssid *ssid)
1058{
1059 if (wpa_s->p2p_mgmt)
1060 return;
1061
1062 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1063}
1064
1065
1066void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1067 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001068 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001069{
1070 if (wpa_s->p2p_mgmt)
1071 return;
1072
1073 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1074 reason_code);
1075}
1076
1077
1078void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1079 const u8 *peer_addr)
1080{
1081 if (wpa_s->p2p_mgmt)
1082 return;
1083
1084 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1085}
1086
1087
1088void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001089 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001090{
1091 if (wpa_s->p2p_mgmt)
1092 return;
1093
1094 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1095}
1096
1097#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001098
1099/*
1100 * DPP Notifications
1101 */
1102
1103/* DPP Success notifications */
1104
Hai Shalom706f99b2019-01-08 16:23:37 -08001105void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001106 struct wpa_ssid *ssid)
1107{
1108#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001109 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001110 return;
1111
Gabriel Biren57ededa2021-09-03 16:08:50 +00001112 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001113#endif /* CONFIG_DPP */
1114}
1115
Hai Shalom706f99b2019-01-08 16:23:37 -08001116void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001117{
1118#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001119 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001120 return;
1121
Gabriel Biren57ededa2021-09-03 16:08:50 +00001122 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001123#endif /* CONFIG_DPP */
1124}
1125
1126/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001127void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001128{
1129#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001130 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001131 return;
1132
Gabriel Biren57ededa2021-09-03 16:08:50 +00001133 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001134#endif /* CONFIG_DPP */
1135}
1136
Hai Shalom706f99b2019-01-08 16:23:37 -08001137void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001138{
1139#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001140 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001141 return;
1142
Gabriel Biren57ededa2021-09-03 16:08:50 +00001143 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001144#endif /* CONFIG_DPP */
1145}
1146
1147/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001148void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001149{
1150#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001151 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001152 return;
1153
Gabriel Biren57ededa2021-09-03 16:08:50 +00001154 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001155#endif /* CONFIG_DPP */
1156}
1157
Hai Shalom706f99b2019-01-08 16:23:37 -08001158void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001159{
1160#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001161 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001162 return;
1163
Gabriel Biren57ededa2021-09-03 16:08:50 +00001164 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001165#endif /* CONFIG_DPP */
1166}
1167
Hai Shalom706f99b2019-01-08 16:23:37 -08001168void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001169{
1170#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001171 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001172 return;
1173
Gabriel Biren57ededa2021-09-03 16:08:50 +00001174 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001175#endif /* CONFIG_DPP */
1176}
1177
Hai Shalom706f99b2019-01-08 16:23:37 -08001178void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001179{
1180#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001181 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001182 return;
1183
Gabriel Biren57ededa2021-09-03 16:08:50 +00001184 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001185#endif /* CONFIG_DPP */
1186}
1187
Hai Shalom706f99b2019-01-08 16:23:37 -08001188void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001189{
1190#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001191 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001192 return;
1193
Gabriel Biren57ededa2021-09-03 16:08:50 +00001194 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001195#endif /* CONFIG_DPP */
1196}
1197
Hai Shalom706f99b2019-01-08 16:23:37 -08001198void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001199{
1200#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001201 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001202 return;
1203
Gabriel Biren57ededa2021-09-03 16:08:50 +00001204 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001205#endif /* CONFIG_DPP */
1206}
Jimmy Chen126b1702019-08-28 17:59:33 +08001207
Hai Shalom06768112019-12-04 15:49:43 -08001208void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1209{
1210#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001211 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001212#endif /* CONFIG_DPP2 */
1213}
1214
1215void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1216{
1217#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001218 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001219#endif /* CONFIG_DPP2 */
1220}
1221
1222void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1223 enum dpp_status_error status, const char *ssid,
1224 const char *channel_list, unsigned short band_list[], int size)
1225{
1226#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001227 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001228#endif /* CONFIG_DPP2 */
1229}
1230
1231void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1232{
1233#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001234 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001235#endif /* CONFIG_DPP2 */
1236}
1237
Jimmy Chen126b1702019-08-28 17:59:33 +08001238void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1239 struct rsn_pmksa_cache_entry *entry)
1240{
1241 if (!wpa_s)
1242 return;
1243
Gabriel Biren57ededa2021-09-03 16:08:50 +00001244 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001245}
Jimmy Chen39deead2020-10-14 23:47:20 +08001246
1247void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1248 struct wpa_ssid *ssid,
1249 u8 bitmap)
1250{
1251 if (!wpa_s)
1252 return;
1253
1254 if (!ssid)
1255 return;
1256
Gabriel Biren57ededa2021-09-03 16:08:50 +00001257 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001258}
Sunil Ravi07c17622021-01-11 12:00:53 -08001259
1260void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1261{
1262 if (!wpa_s)
1263 return;
1264
Gabriel Biren57ededa2021-09-03 16:08:50 +00001265 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001266}
Hai Shalomc1a21442022-02-04 13:43:00 -08001267
1268#ifdef CONFIG_INTERWORKING
1269
1270void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1271 struct wpa_bss *bss,
1272 struct wpa_cred *cred, int excluded,
1273 const char *type, int bh, int bss_load,
1274 int conn_capab)
1275{
1276 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1277 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1278 MAC2STR(bss->bssid), type,
1279 bh ? " below_min_backhaul=1" : "",
1280 bss_load ? " over_max_bss_load=1" : "",
1281 conn_capab ? " conn_capab_missing=1" : "",
1282 cred->id, cred->priority, cred->sp_priority);
1283
1284 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1285 bh, bss_load, conn_capab);
1286}
1287
1288
1289void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1290{
1291 wpas_dbus_signal_interworking_select_done(wpa_s);
1292}
1293
1294#endif /* CONFIG_INTERWORKING */
1295
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001296void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1297 const char* reason_string)
1298{
1299 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1300}
1301
1302void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1303 const char *reason_string)
1304{
1305 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1306}
1307
1308void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1309 const char *reason_string)
1310{
1311 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1312}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301313
1314void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1315{
1316 if (!wpa_s)
1317 return;
1318
1319 wpas_aidl_notify_qos_policy_reset(wpa_s);
1320}
1321
1322void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1323 struct dscp_policy_data *policies, int num_policies)
1324{
1325 if (!wpa_s || !policies)
1326 return;
1327
1328 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1329}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001330
1331void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1332{
1333 if (!wpa_s)
1334 return;
1335
1336 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1337}