blob: 8e31824f3eefa3e9c74261db8ca0d718843cf757 [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;
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800427 if (wpa_s->wpa)
428 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700429 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700430 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700431 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000432 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800433 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
434 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700435 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800436 if (network_is_persistent_group(ssid))
437 wpas_notify_persistent_group_removed(wpa_s, ssid);
438
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800439 wpas_p2p_network_removed(wpa_s, ssid);
Hai Shalom60840252021-02-19 19:02:11 -0800440
441#ifdef CONFIG_PASN
442 if (wpa_s->pasn.ssid == ssid)
443 wpa_s->pasn.ssid = NULL;
444#endif /* CONFIG_PASN */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700445}
446
447
448void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
449 u8 bssid[], unsigned int id)
450{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800451 if (wpa_s->p2p_mgmt)
452 return;
453
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700454 wpas_dbus_register_bss(wpa_s, bssid, id);
455 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
456 id, MAC2STR(bssid));
457}
458
459
460void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
461 u8 bssid[], unsigned int id)
462{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800463 if (wpa_s->p2p_mgmt)
464 return;
465
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700466 wpas_dbus_unregister_bss(wpa_s, bssid, id);
467 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
468 id, MAC2STR(bssid));
469}
470
471
472void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
473 unsigned int id)
474{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800475 if (wpa_s->p2p_mgmt)
476 return;
477
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700478 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
479}
480
481
482void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
483 unsigned int id)
484{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800485 if (wpa_s->p2p_mgmt)
486 return;
487
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700488 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
489 id);
490}
491
492
493void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
494 unsigned int id)
495{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800496 if (wpa_s->p2p_mgmt)
497 return;
498
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700499 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
500 id);
501}
502
503
504void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
505 unsigned int id)
506{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800507 if (wpa_s->p2p_mgmt)
508 return;
509
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700510 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
511}
512
513
514void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
515 unsigned int id)
516{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800517 if (wpa_s->p2p_mgmt)
518 return;
519
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700520 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
521}
522
523
524void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
525 unsigned int id)
526{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800527 if (wpa_s->p2p_mgmt)
528 return;
529
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700530 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
531}
532
533
534void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
535 unsigned int id)
536{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800537 if (wpa_s->p2p_mgmt)
538 return;
539
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800540#ifdef CONFIG_WPS
541 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
542#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700543}
544
545
546void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
547 unsigned int id)
548{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800549 if (wpa_s->p2p_mgmt)
550 return;
551
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700552 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
553}
554
555
556void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
557 unsigned int id)
558{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800559 if (wpa_s->p2p_mgmt)
560 return;
561
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700562 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
563}
564
565
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700566void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
567{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800568 if (wpa_s->p2p_mgmt)
569 return;
570
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700571 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
572}
573
574
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700575void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
576{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800577 if (wpa_s->p2p_mgmt)
578 return;
579
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700580 wpas_dbus_signal_blob_added(wpa_s, name);
581}
582
583
584void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
585{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800586 if (wpa_s->p2p_mgmt)
587 return;
588
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700589 wpas_dbus_signal_blob_removed(wpa_s, name);
590}
591
592
593void wpas_notify_debug_level_changed(struct wpa_global *global)
594{
595 wpas_dbus_signal_debug_level_changed(global);
596}
597
598
599void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
600{
601 wpas_dbus_signal_debug_timestamp_changed(global);
602}
603
604
605void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
606{
607 wpas_dbus_signal_debug_show_keys_changed(global);
608}
609
610
611void wpas_notify_suspend(struct wpa_global *global)
612{
613 struct wpa_supplicant *wpa_s;
614
615 os_get_time(&global->suspend_time);
616 wpa_printf(MSG_DEBUG, "System suspend notification");
617 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
618 wpa_drv_suspend(wpa_s);
619}
620
621
622void wpas_notify_resume(struct wpa_global *global)
623{
624 struct os_time now;
625 int slept;
626 struct wpa_supplicant *wpa_s;
627
628 if (global->suspend_time.sec == 0)
629 slept = -1;
630 else {
631 os_get_time(&now);
632 slept = now.sec - global->suspend_time.sec;
633 }
634 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
635 slept);
636
637 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
638 wpa_drv_resume(wpa_s);
639 if (wpa_s->wpa_state == WPA_DISCONNECTED)
640 wpa_supplicant_req_scan(wpa_s, 0, 100000);
641 }
642}
643
644
645#ifdef CONFIG_P2P
646
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700647void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
648{
649 /* Notify P2P find has stopped */
650 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800651
Gabriel Biren57ededa2021-09-03 16:08:50 +0000652 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700653}
654
655
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700656void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800657 const u8 *addr, const struct p2p_peer_info *info,
658 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800659 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800660 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700661{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700662 if (new_device) {
663 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800664 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700665 }
666
667 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800668 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
669
Gabriel Biren57ededa2021-09-03 16:08:50 +0000670 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800671 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800672 peer_wfd_device_info_len,
673 peer_wfd_r2_device_info,
674 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700675}
676
677
678void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
679 const u8 *dev_addr)
680{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700681 wpas_dbus_unregister_peer(wpa_s, dev_addr);
682
683 /* Create signal on interface object*/
684 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800685
Gabriel Biren57ededa2021-09-03 16:08:50 +0000686 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700687}
688
689
690void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
691 const struct wpa_ssid *ssid,
692 const char *role)
693{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700694 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700695
696 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800697
Gabriel Biren57ededa2021-09-03 16:08:50 +0000698 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700699}
700
701
702void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700703 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700704{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700705 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800706
Gabriel Biren57ededa2021-09-03 16:08:50 +0000707 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700708}
709
710
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800711void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
712 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700713{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800714 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800715
Gabriel Biren57ededa2021-09-03 16:08:50 +0000716 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700717}
718
719
720void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
721 int status, const u8 *bssid)
722{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700723 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800724
Gabriel Biren57ededa2021-09-03 16:08:50 +0000725 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700726}
727
728
729void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
730 int freq, const u8 *sa, u8 dialog_token,
731 u16 update_indic, const u8 *tlvs,
732 size_t tlvs_len)
733{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700734 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
735 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700736}
737
738
739void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
740 const u8 *sa, u16 update_indic,
741 const u8 *tlvs, size_t tlvs_len)
742{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700743 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
744 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800745
Gabriel Biren57ededa2021-09-03 16:08:50 +0000746 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800747 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700748}
749
750
751/**
752 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
753 * @dev_addr: Who sent the request or responded to our request.
754 * @request: Will be 1 if request, 0 for response.
755 * @status: Valid only in case of response (0 in case of success)
756 * @config_methods: WPS config methods
757 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
758 *
759 * This can be used to notify:
760 * - Requests or responses
761 * - Various config methods
762 * - Failure condition in case of response
763 */
764void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
765 const u8 *dev_addr, int request,
766 enum p2p_prov_disc_status status,
767 u16 config_methods,
768 unsigned int generated_pin)
769{
770 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
771 status, config_methods,
772 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800773
Gabriel Biren57ededa2021-09-03 16:08:50 +0000774 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800775 status, config_methods,
776 generated_pin);
777
Jouni Malinen75ecf522011-06-27 15:19:46 -0700778}
779
780
781void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700782 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800783 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700784{
785 /* Notify a group has been started */
786 wpas_dbus_register_p2p_group(wpa_s, ssid);
787
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800788 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800789
Gabriel Biren57ededa2021-09-03 16:08:50 +0000790 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700791}
792
793
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800794void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
795 const char *reason)
796{
797 /* Notify a group formation failed */
798 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800799
Gabriel Biren57ededa2021-09-03 16:08:50 +0000800 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800801}
802
803
Jouni Malinen75ecf522011-06-27 15:19:46 -0700804void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
805 struct wps_event_fail *fail)
806{
807 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700808}
809
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800810
811void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
812 const u8 *sa, const u8 *go_dev_addr,
813 const u8 *bssid, int id, int op_freq)
814{
815 /* Notify a P2P Invitation Request */
816 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
817 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800818
Gabriel Biren57ededa2021-09-03 16:08:50 +0000819 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800820 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800821}
822
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700823#endif /* CONFIG_P2P */
824
825
826static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800827 const u8 *sta,
828 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700829{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700830#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800831 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
832
Jouni Malinen75ecf522011-06-27 15:19:46 -0700833 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700834 * Create 'peer-joined' signal on group object -- will also
835 * check P2P itself.
836 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800837 if (p2p_dev_addr)
838 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700839#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700840
Hai Shalom74f70d42019-02-11 14:42:39 -0800841 /* Register the station */
842 wpas_dbus_register_sta(wpa_s, sta);
843
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700844 /* Notify listeners a new station has been authorized */
845 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800846
Gabriel Biren57ededa2021-09-03 16:08:50 +0000847 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700848}
849
850
851static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700852 const u8 *sta,
853 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700854{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700855#ifdef CONFIG_P2P
856 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700857 * Create 'peer-disconnected' signal on group object if this
858 * is a P2P group.
859 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800860 if (p2p_dev_addr)
861 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700862#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700863
864 /* Notify listeners a station has been deauthorized */
865 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800866
Gabriel Biren57ededa2021-09-03 16:08:50 +0000867 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800868 /* Unregister the station */
869 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700870}
871
872
873void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800874 const u8 *mac_addr, int authorized,
875 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700876{
877 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800878 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700879 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700880 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700881}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700882
883
Hai Shalom81f62d82019-07-22 12:10:00 -0700884void wpas_notify_certification(struct wpa_supplicant *wpa_s,
885 struct tls_cert_data *cert,
886 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700887{
Hai Shalom81f62d82019-07-22 12:10:00 -0700888 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700889
Hai Shalom81f62d82019-07-22 12:10:00 -0700890 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700891 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700892 cert->depth, cert->subject, cert_hash ? " hash=" : "",
893 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700894 cert->tod == 2 ? " tod=2" : "",
895 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700896
897 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700898 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700899 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700900 cert_hex = os_malloc(len);
901 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700902 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
903 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700904 wpa_msg_ctrl(wpa_s, MSG_INFO,
905 WPA_EVENT_EAP_PEER_CERT
906 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700907 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700908 os_free(cert_hex);
909 }
910 }
911
Hai Shalom81f62d82019-07-22 12:10:00 -0700912 for (i = 0; i < cert->num_altsubject; i++)
913 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
914 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800915
Jimmy Chen429daf92021-10-20 13:27:23 +0800916 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
917 cert->altsubject, cert->num_altsubject,
918 cert_hash, cert->cert);
919
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700920 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700921 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
922 cert->altsubject, cert->num_altsubject,
923 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700924}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700925
926
927void wpas_notify_preq(struct wpa_supplicant *wpa_s,
928 const u8 *addr, const u8 *dst, const u8 *bssid,
929 const u8 *ie, size_t ie_len, u32 ssi_signal)
930{
931#ifdef CONFIG_AP
932 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
933#endif /* CONFIG_AP */
934}
935
936
937void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
938 const char *parameter)
939{
940 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700941 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
942 "status='%s' parameter='%s'",
943 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700944}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700945
Roshan Pius3a1667e2018-07-03 15:17:14 -0700946
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700947void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
948{
949 wpa_dbg(wpa_s, MSG_ERROR,
950 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000951 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700952}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700953
Roshan Pius3a1667e2018-07-03 15:17:14 -0700954
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700955void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
956 struct wpa_ssid *ssid)
957{
958 if (wpa_s->current_ssid != ssid)
959 return;
960
961 wpa_dbg(wpa_s, MSG_DEBUG,
962 "Network bssid config changed for the current network - within-ESS roaming %s",
963 ssid->bssid_set ? "disabled" : "enabled");
964
965 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
966 ssid->bssid_set ? ssid->bssid : NULL);
967}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800968
969
970void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
971 struct wpa_ssid *ssid)
972{
973#ifdef CONFIG_P2P
974 if (ssid->disabled == 2) {
975 /* Changed from normal network profile to persistent group */
976 ssid->disabled = 0;
977 wpas_dbus_unregister_network(wpa_s, ssid->id);
978 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700979 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800980 wpas_dbus_register_persistent_group(wpa_s, ssid);
981 } else {
982 /* Changed from persistent group to normal network profile */
983 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700984 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800985 wpas_dbus_register_network(wpa_s, ssid);
986 }
987#endif /* CONFIG_P2P */
988}
Roshan Pius04a9d742016-12-12 12:40:46 -0800989
990void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
991 const char *result,
992 const struct wpa_bss_anqp *anqp)
993{
994#ifdef CONFIG_INTERWORKING
995 if (!wpa_s || !bssid || !anqp)
996 return;
Roshan Pius9322a342016-12-12 14:45:02 -0800997
Gabriel Biren57ededa2021-09-03 16:08:50 +0000998 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -0800999#endif /* CONFIG_INTERWORKING */
1000}
1001
1002void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1003 const char* file_name, const u8* image,
1004 u32 image_length)
1005{
1006#ifdef CONFIG_HS20
1007 if (!wpa_s || !bssid || !file_name || !image)
1008 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001009
Gabriel Biren57ededa2021-09-03 16:08:50 +00001010 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001011 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001012#endif /* CONFIG_HS20 */
1013}
1014
1015void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1016 const char* url,
1017 u8 osu_method)
1018{
1019#ifdef CONFIG_HS20
1020 if (!wpa_s || !url)
1021 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001022
Gabriel Biren57ededa2021-09-03 16:08:50 +00001023 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001024#endif /* CONFIG_HS20 */
1025}
1026
1027void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1028 u8 code, u16 reauth_delay,
1029 const char *url)
1030{
1031#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001032 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001033 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001034
Gabriel Biren57ededa2021-09-03 16:08:50 +00001035 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001036 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001037#endif /* CONFIG_HS20 */
1038}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001039
Hai Shalom04a4ca62020-10-28 19:04:47 -07001040void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1041 struct wpa_supplicant *wpa_s, const char *url) {
1042#ifdef CONFIG_HS20
1043 if (!wpa_s || !url)
1044 return;
1045
Gabriel Biren57ededa2021-09-03 16:08:50 +00001046 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001047#endif /* CONFIG_HS20 */
1048}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001049
1050#ifdef CONFIG_MESH
1051
1052void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1053 struct wpa_ssid *ssid)
1054{
1055 if (wpa_s->p2p_mgmt)
1056 return;
1057
1058 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1059}
1060
1061
1062void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1063 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001064 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001065{
1066 if (wpa_s->p2p_mgmt)
1067 return;
1068
1069 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1070 reason_code);
1071}
1072
1073
1074void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1075 const u8 *peer_addr)
1076{
1077 if (wpa_s->p2p_mgmt)
1078 return;
1079
1080 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1081}
1082
1083
1084void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001085 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001086{
1087 if (wpa_s->p2p_mgmt)
1088 return;
1089
1090 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1091}
1092
1093#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001094
1095/*
1096 * DPP Notifications
1097 */
1098
1099/* DPP Success notifications */
1100
Hai Shalom706f99b2019-01-08 16:23:37 -08001101void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Hai Shalom59532852018-12-07 10:32:58 -08001102 struct wpa_ssid *ssid)
1103{
1104#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001105 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001106 return;
1107
Gabriel Biren57ededa2021-09-03 16:08:50 +00001108 wpas_aidl_notify_dpp_config_received(wpa_s, ssid);
Hai Shalom59532852018-12-07 10:32:58 -08001109#endif /* CONFIG_DPP */
1110}
1111
Hai Shalom706f99b2019-01-08 16:23:37 -08001112void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001113{
1114#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001115 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001116 return;
1117
Gabriel Biren57ededa2021-09-03 16:08:50 +00001118 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001119#endif /* CONFIG_DPP */
1120}
1121
1122/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001123void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001124{
1125#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001126 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001127 return;
1128
Gabriel Biren57ededa2021-09-03 16:08:50 +00001129 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001130#endif /* CONFIG_DPP */
1131}
1132
Hai Shalom706f99b2019-01-08 16:23:37 -08001133void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001134{
1135#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001136 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001137 return;
1138
Gabriel Biren57ededa2021-09-03 16:08:50 +00001139 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001140#endif /* CONFIG_DPP */
1141}
1142
1143/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001144void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001145{
1146#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001147 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001148 return;
1149
Gabriel Biren57ededa2021-09-03 16:08:50 +00001150 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001151#endif /* CONFIG_DPP */
1152}
1153
Hai Shalom706f99b2019-01-08 16:23:37 -08001154void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001155{
1156#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001157 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001158 return;
1159
Gabriel Biren57ededa2021-09-03 16:08:50 +00001160 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001161#endif /* CONFIG_DPP */
1162}
1163
Hai Shalom706f99b2019-01-08 16:23:37 -08001164void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001165{
1166#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001167 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001168 return;
1169
Gabriel Biren57ededa2021-09-03 16:08:50 +00001170 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001171#endif /* CONFIG_DPP */
1172}
1173
Hai Shalom706f99b2019-01-08 16:23:37 -08001174void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001175{
1176#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001177 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001178 return;
1179
Gabriel Biren57ededa2021-09-03 16:08:50 +00001180 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001181#endif /* CONFIG_DPP */
1182}
1183
Hai Shalom706f99b2019-01-08 16:23:37 -08001184void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001185{
1186#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001187 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001188 return;
1189
Gabriel Biren57ededa2021-09-03 16:08:50 +00001190 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001191#endif /* CONFIG_DPP */
1192}
1193
Hai Shalom706f99b2019-01-08 16:23:37 -08001194void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001195{
1196#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001197 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001198 return;
1199
Gabriel Biren57ededa2021-09-03 16:08:50 +00001200 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001201#endif /* CONFIG_DPP */
1202}
Jimmy Chen126b1702019-08-28 17:59:33 +08001203
Hai Shalom06768112019-12-04 15:49:43 -08001204void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1205{
1206#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001207 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001208#endif /* CONFIG_DPP2 */
1209}
1210
1211void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1212{
1213#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001214 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001215#endif /* CONFIG_DPP2 */
1216}
1217
1218void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1219 enum dpp_status_error status, const char *ssid,
1220 const char *channel_list, unsigned short band_list[], int size)
1221{
1222#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001223 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001224#endif /* CONFIG_DPP2 */
1225}
1226
1227void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1228{
1229#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001230 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001231#endif /* CONFIG_DPP2 */
1232}
1233
Jimmy Chen126b1702019-08-28 17:59:33 +08001234void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1235 struct rsn_pmksa_cache_entry *entry)
1236{
1237 if (!wpa_s)
1238 return;
1239
Gabriel Biren57ededa2021-09-03 16:08:50 +00001240 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001241}
Jimmy Chen39deead2020-10-14 23:47:20 +08001242
1243void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1244 struct wpa_ssid *ssid,
1245 u8 bitmap)
1246{
1247 if (!wpa_s)
1248 return;
1249
1250 if (!ssid)
1251 return;
1252
Gabriel Biren57ededa2021-09-03 16:08:50 +00001253 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001254}
Sunil Ravi07c17622021-01-11 12:00:53 -08001255
1256void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1257{
1258 if (!wpa_s)
1259 return;
1260
Gabriel Biren57ededa2021-09-03 16:08:50 +00001261 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001262}
Hai Shalomc1a21442022-02-04 13:43:00 -08001263
1264#ifdef CONFIG_INTERWORKING
1265
1266void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1267 struct wpa_bss *bss,
1268 struct wpa_cred *cred, int excluded,
1269 const char *type, int bh, int bss_load,
1270 int conn_capab)
1271{
1272 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1273 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1274 MAC2STR(bss->bssid), type,
1275 bh ? " below_min_backhaul=1" : "",
1276 bss_load ? " over_max_bss_load=1" : "",
1277 conn_capab ? " conn_capab_missing=1" : "",
1278 cred->id, cred->priority, cred->sp_priority);
1279
1280 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1281 bh, bss_load, conn_capab);
1282}
1283
1284
1285void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1286{
1287 wpas_dbus_signal_interworking_select_done(wpa_s);
1288}
1289
1290#endif /* CONFIG_INTERWORKING */
1291
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001292void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1293 const char* reason_string)
1294{
1295 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1296}
1297
1298void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1299 const char *reason_string)
1300{
1301 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1302}
1303
1304void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1305 const char *reason_string)
1306{
1307 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1308}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301309
1310void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1311{
1312 if (!wpa_s)
1313 return;
1314
1315 wpas_aidl_notify_qos_policy_reset(wpa_s);
1316}
1317
1318void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1319 struct dscp_policy_data *policies, int num_policies)
1320{
1321 if (!wpa_s || !policies)
1322 return;
1323
1324 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1325}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001326
1327void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1328{
1329 if (!wpa_s)
1330 return;
1331
1332 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1333}