blob: d53ae5634f35611873d8e3e1a8ea250f84a4d1cd [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"
Sunil Ravi77d572f2023-01-17 23:58:31 +000019#include "rsn_supp/pmksa_cache.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080020#include "fst/fst.h"
Hai Shalom81f62d82019-07-22 12:10:00 -070021#include "crypto/tls.h"
Hai Shalomc1a21442022-02-04 13:43:00 -080022#include "bss.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070023#include "driver_i.h"
24#include "scan.h"
25#include "p2p_supplicant.h"
26#include "sme.h"
27#include "notify.h"
Shivani Baranwalc58b6092022-12-01 11:17:24 +053028#include "aidl/aidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070029
30int wpas_notify_supplicant_initialized(struct wpa_global *global)
31{
Hai Shalom021b0b52019-04-10 11:17:58 -070032#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070033 if (global->params.dbus_ctrl_interface) {
34 global->dbus = wpas_dbus_init(global);
35 if (global->dbus == NULL)
36 return -1;
37 }
Hai Shalom021b0b52019-04-10 11:17:58 -070038#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070039
Gabriel Biren7a30e7f2023-06-02 20:11:28 +000040#ifdef CONFIG_AIDL
41 // Initialize AIDL here if daemonize is disabled.
42 // Otherwise initialize it later.
43 if (!global->params.daemonize) {
44 global->aidl = wpas_aidl_init(global);
45 if (!global->aidl)
46 return -1;
47 }
48#endif /* CONFIG_AIDL */
49
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070050 return 0;
51}
52
53
54void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
55{
Hai Shalom021b0b52019-04-10 11:17:58 -070056#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070057 if (global->dbus)
58 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070059#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070060
Gabriel Biren57ededa2021-09-03 16:08:50 +000061#ifdef CONFIG_AIDL
62 if (global->aidl)
63 wpas_aidl_deinit(global->aidl);
64#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070065}
66
67
68int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
69{
Hai Shalomc4809952019-04-30 14:45:55 -070070 if (!wpa_s->p2p_mgmt) {
71 if (wpas_dbus_register_interface(wpa_s))
72 return -1;
73 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070074
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070075#ifdef CONFIG_AIDL
Gabriel Biren7a30e7f2023-06-02 20:11:28 +000076 /*
77 * AIDL initialization may not be complete here if daemonize is enabled.
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070078 * Initialization is done after daemonizing in order to avoid
79 * issues with the file descriptor.
80 */
Gabriel Biren7a30e7f2023-06-02 20:11:28 +000081 if (!wpa_s->global->aidl)
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070082 return 0;
Gabriel Biren7a30e7f2023-06-02 20:11:28 +000083 /* AIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000084 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070085 return -1;
Kiran Kumar Lokerea9f98eb2023-03-17 13:01:12 -070086#endif
Roshan Pius54e763a2016-07-06 15:41:53 -070087
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070088 return 0;
89}
90
91
92void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
93{
Hai Shalomc4809952019-04-30 14:45:55 -070094 if (!wpa_s->p2p_mgmt) {
95 /* unregister interface in new DBus ctrl iface */
96 wpas_dbus_unregister_interface(wpa_s);
97 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070098
Gabriel Biren7a30e7f2023-06-02 20:11:28 +000099 /* AIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +0000100 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700101}
102
103
104void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
105 enum wpa_states new_state,
106 enum wpa_states old_state)
107{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800108 if (wpa_s->p2p_mgmt)
109 return;
110
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700111 /* notify the new DBus API */
112 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
113
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800114#ifdef CONFIG_FST
115 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
116 if (new_state == WPA_COMPLETED)
117 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
118 else if (old_state >= WPA_ASSOCIATED &&
119 new_state < WPA_ASSOCIATED)
120 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
121 }
122#endif /* CONFIG_FST */
123
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700124 if (new_state == WPA_COMPLETED)
125 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700126 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700127 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700128
129 sme_state_changed(wpa_s);
130
131#ifdef ANDROID
132 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700133 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700134 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700135 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700136 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700137 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
138 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800139 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700140#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700141
Gabriel Biren57ededa2021-09-03 16:08:50 +0000142 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700143}
144
145
Dmitry Shmidt04949592012-07-19 12:16:46 -0700146void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
147{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800148 if (wpa_s->p2p_mgmt)
149 return;
150
Dmitry Shmidt04949592012-07-19 12:16:46 -0700151 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800152
Gabriel Biren57ededa2021-09-03 16:08:50 +0000153 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700154}
155
156
Veerendranath Jakkambc2fa492023-05-25 01:26:50 +0530157void wpas_notify_mlo_info_change_reason(struct wpa_supplicant *wpa_s,
158 enum mlo_info_change_reason reason)
159{
160 if (wpa_s->p2p_mgmt)
161 return;
162
163 wpas_aidl_notify_mlo_info_change_reason(wpa_s, reason);
164}
165
166
Hai Shalom74f70d42019-02-11 14:42:39 -0800167void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
168{
169 if (wpa_s->p2p_mgmt)
170 return;
171
172 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
173}
174
175
Sunil Ravi972b2042020-08-14 10:50:48 -0700176void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800177 const u8 *bssid, u8 timed_out,
178 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800179{
180 if (wpa_s->p2p_mgmt)
181 return;
182
183 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800184
Gabriel Biren57ededa2021-09-03 16:08:50 +0000185 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800186}
187
Roshan Pius38e96762017-01-23 14:52:00 -0800188void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
189 if (wpa_s->p2p_mgmt)
190 return;
191
Gabriel Biren57ededa2021-09-03 16:08:50 +0000192 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800193}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800194
Hai Shalom74f70d42019-02-11 14:42:39 -0800195void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
196{
197 if (wpa_s->p2p_mgmt)
198 return;
199
200 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
201}
202
203
204void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
205{
206 if (wpa_s->p2p_mgmt)
207 return;
208
209 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
210}
211
212
213void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
214{
215 if (wpa_s->p2p_mgmt)
216 return;
217
218 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
219}
220
221
222void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
223{
224 if (wpa_s->p2p_mgmt)
225 return;
226
227 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800228
229#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000230 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800231#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800232}
233
234
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700235void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
236{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800237 if (wpa_s->p2p_mgmt)
238 return;
239
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700240 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
241}
242
243
244void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
245{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800246 if (wpa_s->p2p_mgmt)
247 return;
248
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700249 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
250}
251
252
253void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
254{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800255 if (wpa_s->p2p_mgmt)
256 return;
257
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700258 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700259
Gabriel Biren57ededa2021-09-03 16:08:50 +0000260 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700261}
262
263
Sunil Ravi77d572f2023-01-17 23:58:31 +0000264void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s)
265{
266 if (wpa_s->p2p_mgmt)
267 return;
268
269 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS);
270}
271
272
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700273void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
274{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800275 if (wpa_s->p2p_mgmt)
276 return;
277
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700278 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
279}
280
281
282void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
283 struct wpa_ssid *ssid)
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 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
289}
290
291
292void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
293 struct wpa_ssid *ssid)
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_network_selected(wpa_s, ssid->id);
299}
300
301
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800302void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
303 struct wpa_ssid *ssid,
304 enum wpa_ctrl_req_type rtype,
305 const char *default_txt)
306{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800307 if (wpa_s->p2p_mgmt)
308 return;
309
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800310 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700311
Gabriel Biren57ededa2021-09-03 16:08:50 +0000312 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800313}
314
315
Steven Liu850c2e02022-11-28 17:26:39 +0000316void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
317{
318 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
319}
320
321
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700322void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
323{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800324 if (wpa_s->p2p_mgmt)
325 return;
326
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700327 /* notify the new DBus API */
328 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
329}
330
331
332void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
333{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800334 if (wpa_s->p2p_mgmt)
335 return;
336
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700337 wpas_dbus_signal_scan_done(wpa_s, success);
338}
339
340
341void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
342{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800343 if (wpa_s->p2p_mgmt)
344 return;
345
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700346 wpas_wps_notify_scan_results(wpa_s);
347}
348
349
350void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
351 const struct wps_credential *cred)
352{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800353 if (wpa_s->p2p_mgmt)
354 return;
355
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700356#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700357 /* notify the new DBus API */
358 wpas_dbus_signal_wps_cred(wpa_s, cred);
359#endif /* CONFIG_WPS */
360}
361
362
363void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
364 struct wps_event_m2d *m2d)
365{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800366 if (wpa_s->p2p_mgmt)
367 return;
368
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700369#ifdef CONFIG_WPS
370 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
371#endif /* CONFIG_WPS */
372}
373
374
375void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
376 struct wps_event_fail *fail)
377{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800378 if (wpa_s->p2p_mgmt)
379 return;
380
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700381#ifdef CONFIG_WPS
382 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800383
Gabriel Biren57ededa2021-09-03 16:08:50 +0000384 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800385 fail->config_error,
386 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700387#endif /* CONFIG_WPS */
388}
389
390
391void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
392{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800393 if (wpa_s->p2p_mgmt)
394 return;
395
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700396#ifdef CONFIG_WPS
397 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800398
Gabriel Biren57ededa2021-09-03 16:08:50 +0000399 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700400#endif /* CONFIG_WPS */
401}
402
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700403void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
404{
405 if (wpa_s->p2p_mgmt)
406 return;
407
408#ifdef CONFIG_WPS
409 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800410
Gabriel Biren57ededa2021-09-03 16:08:50 +0000411 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700412#endif /* CONFIG_WPS */
413}
414
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700415
416void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
417 struct wpa_ssid *ssid)
418{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800419 if (wpa_s->p2p_mgmt)
420 return;
421
Jouni Malinen75ecf522011-06-27 15:19:46 -0700422 /*
423 * Networks objects created during any P2P activities should not be
424 * exposed out. They might/will confuse certain non-P2P aware
425 * applications since these network objects won't behave like
426 * regular ones.
427 */
Roshan Piusd3854452016-07-07 16:46:41 -0700428 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700429 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000430 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800431 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
432 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700433 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700434}
435
436
437void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
438 struct wpa_ssid *ssid)
439{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700440#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700441 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000442 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700443#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700444}
445
446
447void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
448 struct wpa_ssid *ssid)
449{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700450#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700451 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000452 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700453#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700454}
455
456
457void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
458 struct wpa_ssid *ssid)
459{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800460 if (wpa_s->next_ssid == ssid)
461 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700462 if (wpa_s->last_ssid == ssid)
463 wpa_s->last_ssid = NULL;
464 if (wpa_s->current_ssid == ssid)
465 wpa_s->current_ssid = NULL;
Sunil Ravi2a14cf12023-11-21 00:54:38 +0000466 if (wpa_s->ml_connect_probe_ssid == ssid) {
467 wpa_s->ml_connect_probe_ssid = NULL;
468 wpa_s->ml_connect_probe_bss = NULL;
469 }
Sunil Ravi7f769292024-07-23 22:21:32 +0000470 if (wpa_s->connect_without_scan == ssid)
471 wpa_s->connect_without_scan = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700472#if defined(CONFIG_SME) && defined(CONFIG_SAE)
473 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
474 wpa_s->sme.ext_auth_wpa_ssid = NULL;
475#endif /* CONFIG_SME && CONFIG_SAE */
Vinayak Yadawad4222acc2023-12-15 17:39:27 +0530476 if (wpa_s->wpa) {
477 if ((wpa_key_mgmt_sae(ssid->key_mgmt) &&
478 (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_SAE_OFFLOAD_STA)) ||
479 ((ssid->key_mgmt & WPA_KEY_MGMT_OWE) &&
480 (wpa_s->drv_flags2 & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA))) {
481 /* For cases when PMK is generated at the driver */
482 struct wpa_pmkid_params params;
483
484 os_memset(&params, 0, sizeof(params));
485 params.ssid = ssid->ssid;
486 params.ssid_len = ssid->ssid_len;
487 wpa_drv_remove_pmkid(wpa_s, &params);
488 }
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800489 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Vinayak Yadawad4222acc2023-12-15 17:39:27 +0530490 }
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700491 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700492 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700493 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000494 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800495 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
496 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700497 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800498 if (network_is_persistent_group(ssid))
499 wpas_notify_persistent_group_removed(wpa_s, ssid);
500
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800501 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700502}
503
504
505void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
506 u8 bssid[], unsigned int id)
507{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800508 if (wpa_s->p2p_mgmt)
509 return;
510
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700511 wpas_dbus_register_bss(wpa_s, bssid, id);
512 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
513 id, MAC2STR(bssid));
514}
515
516
517void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
518 u8 bssid[], unsigned int id)
519{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800520 if (wpa_s->p2p_mgmt)
521 return;
522
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700523 wpas_dbus_unregister_bss(wpa_s, bssid, id);
524 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
525 id, MAC2STR(bssid));
526}
527
528
529void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
530 unsigned int id)
531{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800532 if (wpa_s->p2p_mgmt)
533 return;
534
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700535 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
536}
537
538
539void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
540 unsigned int id)
541{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800542 if (wpa_s->p2p_mgmt)
543 return;
544
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700545 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
546 id);
547}
548
549
550void wpas_notify_bss_privacy_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_PRIVACY,
557 id);
558}
559
560
561void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
562 unsigned int id)
563{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800564 if (wpa_s->p2p_mgmt)
565 return;
566
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700567 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
568}
569
570
571void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
572 unsigned int id)
573{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800574 if (wpa_s->p2p_mgmt)
575 return;
576
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700577 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
578}
579
580
581void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
582 unsigned int id)
583{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800584 if (wpa_s->p2p_mgmt)
585 return;
586
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700587 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
588}
589
590
591void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
592 unsigned int id)
593{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800594 if (wpa_s->p2p_mgmt)
595 return;
596
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800597#ifdef CONFIG_WPS
598 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
599#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700600}
601
602
603void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
604 unsigned int id)
605{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800606 if (wpa_s->p2p_mgmt)
607 return;
608
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700609 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
610}
611
612
613void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
614 unsigned int id)
615{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800616 if (wpa_s->p2p_mgmt)
617 return;
618
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700619 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
620}
621
622
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700623void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
624{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800625 if (wpa_s->p2p_mgmt)
626 return;
627
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700628 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
629}
630
631
Sunil Ravi99c035e2024-07-12 01:42:03 +0000632void wpas_notify_bss_anqp_changed(struct wpa_supplicant *wpa_s, unsigned int id)
633{
634 if (wpa_s->p2p_mgmt)
635 return;
636
637 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_ANQP, id);
638}
639
640
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700641void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
642{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800643 if (wpa_s->p2p_mgmt)
644 return;
645
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700646 wpas_dbus_signal_blob_added(wpa_s, name);
647}
648
649
650void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
651{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800652 if (wpa_s->p2p_mgmt)
653 return;
654
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700655 wpas_dbus_signal_blob_removed(wpa_s, name);
656}
657
658
659void wpas_notify_debug_level_changed(struct wpa_global *global)
660{
661 wpas_dbus_signal_debug_level_changed(global);
662}
663
664
665void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
666{
667 wpas_dbus_signal_debug_timestamp_changed(global);
668}
669
670
671void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
672{
673 wpas_dbus_signal_debug_show_keys_changed(global);
674}
675
676
677void wpas_notify_suspend(struct wpa_global *global)
678{
679 struct wpa_supplicant *wpa_s;
680
681 os_get_time(&global->suspend_time);
682 wpa_printf(MSG_DEBUG, "System suspend notification");
683 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
684 wpa_drv_suspend(wpa_s);
685}
686
687
688void wpas_notify_resume(struct wpa_global *global)
689{
690 struct os_time now;
691 int slept;
692 struct wpa_supplicant *wpa_s;
693
694 if (global->suspend_time.sec == 0)
695 slept = -1;
696 else {
697 os_get_time(&now);
698 slept = now.sec - global->suspend_time.sec;
699 }
700 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
701 slept);
702
703 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
704 wpa_drv_resume(wpa_s);
705 if (wpa_s->wpa_state == WPA_DISCONNECTED)
706 wpa_supplicant_req_scan(wpa_s, 0, 100000);
707 }
708}
709
710
711#ifdef CONFIG_P2P
712
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700713void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
714{
715 /* Notify P2P find has stopped */
716 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800717
Gabriel Biren57ededa2021-09-03 16:08:50 +0000718 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700719}
720
721
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700722void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800723 const u8 *addr, const struct p2p_peer_info *info,
724 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800725 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800726 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700727{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700728 if (new_device) {
729 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800730 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700731 }
732
733 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800734 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
735
Gabriel Biren57ededa2021-09-03 16:08:50 +0000736 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800737 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800738 peer_wfd_device_info_len,
739 peer_wfd_r2_device_info,
740 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700741}
742
743
744void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
745 const u8 *dev_addr)
746{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700747 wpas_dbus_unregister_peer(wpa_s, dev_addr);
748
749 /* Create signal on interface object*/
750 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800751
Gabriel Biren57ededa2021-09-03 16:08:50 +0000752 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700753}
754
755
756void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
757 const struct wpa_ssid *ssid,
758 const char *role)
759{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700760 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700761
762 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800763
Gabriel Biren57ededa2021-09-03 16:08:50 +0000764 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700765}
766
767
768void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700769 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700770{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700771 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800772
Gabriel Biren57ededa2021-09-03 16:08:50 +0000773 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700774}
775
776
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800777void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
778 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700779{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800780 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800781
Gabriel Biren57ededa2021-09-03 16:08:50 +0000782 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700783}
784
785
786void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
787 int status, const u8 *bssid)
788{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700789 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800790
Gabriel Biren57ededa2021-09-03 16:08:50 +0000791 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700792}
793
794
795void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
796 int freq, const u8 *sa, u8 dialog_token,
797 u16 update_indic, const u8 *tlvs,
798 size_t tlvs_len)
799{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700800 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
801 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700802}
803
804
805void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
806 const u8 *sa, u16 update_indic,
807 const u8 *tlvs, size_t tlvs_len)
808{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700809 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
810 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800811
Gabriel Biren57ededa2021-09-03 16:08:50 +0000812 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800813 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700814}
815
816
817/**
818 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
819 * @dev_addr: Who sent the request or responded to our request.
820 * @request: Will be 1 if request, 0 for response.
821 * @status: Valid only in case of response (0 in case of success)
822 * @config_methods: WPS config methods
823 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
Sunil Ravi8bae4252023-11-16 03:05:19 +0000824 * @group_ifname: Group interface name of the group owner in case the provision
825 * discovery request is received with P2P Group ID attribute.
826 * i.e., valid only when the peer device is joining an
827 * operating P2P group.
Jouni Malinen75ecf522011-06-27 15:19:46 -0700828 *
829 * This can be used to notify:
830 * - Requests or responses
831 * - Various config methods
832 * - Failure condition in case of response
833 */
834void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
835 const u8 *dev_addr, int request,
836 enum p2p_prov_disc_status status,
837 u16 config_methods,
Sunil Ravi8bae4252023-11-16 03:05:19 +0000838 unsigned int generated_pin,
839 const char *group_ifname)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700840{
841 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
842 status, config_methods,
843 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800844
Gabriel Biren57ededa2021-09-03 16:08:50 +0000845 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800846 status, config_methods,
Sunil Ravi8bae4252023-11-16 03:05:19 +0000847 generated_pin, group_ifname);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800848
Jouni Malinen75ecf522011-06-27 15:19:46 -0700849}
850
851
852void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700853 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800854 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700855{
856 /* Notify a group has been started */
857 wpas_dbus_register_p2p_group(wpa_s, ssid);
858
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800859 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800860
Sunil Ravi68c25c22023-02-04 06:17:03 +0000861 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700862}
863
864
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800865void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
866 const char *reason)
867{
868 /* Notify a group formation failed */
869 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800870
Gabriel Biren57ededa2021-09-03 16:08:50 +0000871 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800872}
873
874
Jouni Malinen75ecf522011-06-27 15:19:46 -0700875void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
876 struct wps_event_fail *fail)
877{
878 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700879}
880
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800881
882void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
883 const u8 *sa, const u8 *go_dev_addr,
884 const u8 *bssid, int id, int op_freq)
885{
886 /* Notify a P2P Invitation Request */
887 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
888 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800889
Gabriel Biren57ededa2021-09-03 16:08:50 +0000890 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800891 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800892}
893
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700894#endif /* CONFIG_P2P */
895
896
897static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800898 const u8 *sta,
Sunil Ravid8128a22023-11-06 23:53:58 +0000899 const u8 *p2p_dev_addr, const u8 *ip)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700900{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700901#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800902 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
903
Jouni Malinen75ecf522011-06-27 15:19:46 -0700904 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700905 * Create 'peer-joined' signal on group object -- will also
906 * check P2P itself.
907 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800908 if (p2p_dev_addr)
909 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700910#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700911
Hai Shalom74f70d42019-02-11 14:42:39 -0800912 /* Register the station */
913 wpas_dbus_register_sta(wpa_s, sta);
914
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700915 /* Notify listeners a new station has been authorized */
916 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800917
Sunil Ravid8128a22023-11-06 23:53:58 +0000918 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr, ip);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700919}
920
921
922static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700923 const u8 *sta,
924 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700925{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700926#ifdef CONFIG_P2P
927 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700928 * Create 'peer-disconnected' signal on group object if this
929 * is a P2P group.
930 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800931 if (p2p_dev_addr)
932 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700933#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700934
935 /* Notify listeners a station has been deauthorized */
936 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800937
Sunil Ravid8128a22023-11-06 23:53:58 +0000938 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800939 /* Unregister the station */
940 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700941}
942
943
944void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800945 const u8 *mac_addr, int authorized,
Sunil Ravid8128a22023-11-06 23:53:58 +0000946 const u8 *p2p_dev_addr, const u8 *ip)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700947{
948 if (authorized)
Sunil Ravi99c035e2024-07-12 01:42:03 +0000949 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr,
950 ip);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700951 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700952 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700953}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700954
955
Hai Shalom81f62d82019-07-22 12:10:00 -0700956void wpas_notify_certification(struct wpa_supplicant *wpa_s,
957 struct tls_cert_data *cert,
958 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700959{
Hai Shalom81f62d82019-07-22 12:10:00 -0700960 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700961
Hai Shalom81f62d82019-07-22 12:10:00 -0700962 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700963 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700964 cert->depth, cert->subject, cert_hash ? " hash=" : "",
965 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700966 cert->tod == 2 ? " tod=2" : "",
967 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700968
969 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700970 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700971 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700972 cert_hex = os_malloc(len);
973 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700974 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
975 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700976 wpa_msg_ctrl(wpa_s, MSG_INFO,
977 WPA_EVENT_EAP_PEER_CERT
978 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700979 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700980 os_free(cert_hex);
981 }
982 }
983
Hai Shalom81f62d82019-07-22 12:10:00 -0700984 for (i = 0; i < cert->num_altsubject; i++)
985 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
986 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800987
Jimmy Chen429daf92021-10-20 13:27:23 +0800988 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
989 cert->altsubject, cert->num_altsubject,
990 cert_hash, cert->cert);
991
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700992 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700993 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
994 cert->altsubject, cert->num_altsubject,
995 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700996}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700997
998
999void wpas_notify_preq(struct wpa_supplicant *wpa_s,
1000 const u8 *addr, const u8 *dst, const u8 *bssid,
1001 const u8 *ie, size_t ie_len, u32 ssi_signal)
1002{
1003#ifdef CONFIG_AP
1004 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
1005#endif /* CONFIG_AP */
1006}
1007
1008
1009void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
1010 const char *parameter)
1011{
1012 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -07001013 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
1014 "status='%s' parameter='%s'",
1015 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -07001016}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07001017
Roshan Pius3a1667e2018-07-03 15:17:14 -07001018
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -07001019void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
1020{
1021 wpa_dbg(wpa_s, MSG_ERROR,
1022 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +00001023 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -07001024}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07001025
Roshan Pius3a1667e2018-07-03 15:17:14 -07001026
Sunil Ravi036cec52023-03-29 11:35:17 -07001027void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
1028{
1029 wpas_dbus_signal_psk_mismatch(wpa_s);
1030}
1031
1032
Dmitry Shmidt661b4f72014-09-29 14:58:27 -07001033void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
1034 struct wpa_ssid *ssid)
1035{
1036 if (wpa_s->current_ssid != ssid)
1037 return;
1038
1039 wpa_dbg(wpa_s, MSG_DEBUG,
1040 "Network bssid config changed for the current network - within-ESS roaming %s",
1041 ssid->bssid_set ? "disabled" : "enabled");
1042
1043 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
1044 ssid->bssid_set ? ssid->bssid : NULL);
1045}
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001046
1047
1048void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
1049 struct wpa_ssid *ssid)
1050{
1051#ifdef CONFIG_P2P
1052 if (ssid->disabled == 2) {
1053 /* Changed from normal network profile to persistent group */
1054 ssid->disabled = 0;
1055 wpas_dbus_unregister_network(wpa_s, ssid->id);
1056 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001057 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001058 wpas_dbus_register_persistent_group(wpa_s, ssid);
1059 } else {
1060 /* Changed from persistent group to normal network profile */
1061 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001062 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001063 wpas_dbus_register_network(wpa_s, ssid);
1064 }
1065#endif /* CONFIG_P2P */
1066}
Roshan Pius04a9d742016-12-12 12:40:46 -08001067
1068void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1069 const char *result,
1070 const struct wpa_bss_anqp *anqp)
1071{
Sunil Ravi99c035e2024-07-12 01:42:03 +00001072 wpa_msg(wpa_s, MSG_INFO, ANQP_QUERY_DONE "addr=" MACSTR " result=%s",
1073 MAC2STR(bssid), result);
Roshan Pius04a9d742016-12-12 12:40:46 -08001074#ifdef CONFIG_INTERWORKING
1075 if (!wpa_s || !bssid || !anqp)
1076 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001077
Gabriel Biren57ededa2021-09-03 16:08:50 +00001078 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Sunil Ravi99c035e2024-07-12 01:42:03 +00001079 wpas_dbus_signal_anqp_query_done(wpa_s, bssid, result);
Roshan Pius04a9d742016-12-12 12:40:46 -08001080#endif /* CONFIG_INTERWORKING */
1081}
1082
1083void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1084 const char* file_name, const u8* image,
1085 u32 image_length)
1086{
1087#ifdef CONFIG_HS20
1088 if (!wpa_s || !bssid || !file_name || !image)
1089 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001090
Gabriel Biren57ededa2021-09-03 16:08:50 +00001091 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001092 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001093#endif /* CONFIG_HS20 */
1094}
1095
1096void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1097 const char* url,
1098 u8 osu_method)
1099{
1100#ifdef CONFIG_HS20
1101 if (!wpa_s || !url)
1102 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001103
Gabriel Biren57ededa2021-09-03 16:08:50 +00001104 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001105#endif /* CONFIG_HS20 */
1106}
1107
1108void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1109 u8 code, u16 reauth_delay,
1110 const char *url)
1111{
1112#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001113 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001114 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001115
Gabriel Biren57ededa2021-09-03 16:08:50 +00001116 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001117 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001118#endif /* CONFIG_HS20 */
1119}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001120
1121
1122#ifdef CONFIG_MESH
1123
1124void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1125 struct wpa_ssid *ssid)
1126{
1127 if (wpa_s->p2p_mgmt)
1128 return;
1129
1130 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1131}
1132
1133
1134void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1135 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001136 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001137{
1138 if (wpa_s->p2p_mgmt)
1139 return;
1140
1141 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1142 reason_code);
1143}
1144
1145
1146void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1147 const u8 *peer_addr)
1148{
1149 if (wpa_s->p2p_mgmt)
1150 return;
1151
Sunil Ravi2a14cf12023-11-21 00:54:38 +00001152 wpa_msg(wpa_s, MSG_INFO, MESH_PEER_CONNECTED MACSTR,
1153 MAC2STR(peer_addr));
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001154 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1155}
1156
1157
1158void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001159 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001160{
1161 if (wpa_s->p2p_mgmt)
1162 return;
1163
Sunil Ravi2a14cf12023-11-21 00:54:38 +00001164 wpa_msg(wpa_s, MSG_INFO, MESH_PEER_DISCONNECTED MACSTR,
1165 MAC2STR(peer_addr));
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001166 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1167}
1168
1169#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001170
1171/*
1172 * DPP Notifications
1173 */
1174
1175/* DPP Success notifications */
1176
Hai Shalom706f99b2019-01-08 16:23:37 -08001177void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Sunil Ravi546a7b52022-08-26 22:06:04 +00001178 struct wpa_ssid *ssid, bool conn_status_requested)
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
Sunil Ravi546a7b52022-08-26 22:06:04 +00001184 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
Hai Shalom59532852018-12-07 10:32:58 -08001185#endif /* CONFIG_DPP */
1186}
1187
Hai Shalom706f99b2019-01-08 16:23:37 -08001188void wpas_notify_dpp_config_sent(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_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001195#endif /* CONFIG_DPP */
1196}
1197
Sunil Ravi546a7b52022-08-26 22:06:04 +00001198void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1199 enum dpp_status_error result)
1200{
1201#ifdef CONFIG_DPP2
1202 if (!wpa_s)
1203 return;
1204
1205 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1206#endif /* CONFIG_DPP2 */
1207}
1208
Hai Shalom59532852018-12-07 10:32:58 -08001209/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001210void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001211{
1212#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001213 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001214 return;
1215
Gabriel Biren57ededa2021-09-03 16:08:50 +00001216 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001217#endif /* CONFIG_DPP */
1218}
1219
Hai Shalom706f99b2019-01-08 16:23:37 -08001220void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001221{
1222#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001223 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001224 return;
1225
Gabriel Biren57ededa2021-09-03 16:08:50 +00001226 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001227#endif /* CONFIG_DPP */
1228}
1229
1230/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001231void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001232{
1233#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001234 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001235 return;
1236
Gabriel Biren57ededa2021-09-03 16:08:50 +00001237 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001238#endif /* CONFIG_DPP */
1239}
1240
Hai Shalom706f99b2019-01-08 16:23:37 -08001241void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001242{
1243#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001244 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001245 return;
1246
Gabriel Biren57ededa2021-09-03 16:08:50 +00001247 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001248#endif /* CONFIG_DPP */
1249}
1250
Hai Shalom706f99b2019-01-08 16:23:37 -08001251void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001252{
1253#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001254 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001255 return;
1256
Gabriel Biren57ededa2021-09-03 16:08:50 +00001257 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001258#endif /* CONFIG_DPP */
1259}
1260
Hai Shalom706f99b2019-01-08 16:23:37 -08001261void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001262{
1263#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001264 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001265 return;
1266
Gabriel Biren57ededa2021-09-03 16:08:50 +00001267 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001268#endif /* CONFIG_DPP */
1269}
1270
Hai Shalom706f99b2019-01-08 16:23:37 -08001271void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001272{
1273#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001274 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001275 return;
1276
Gabriel Biren57ededa2021-09-03 16:08:50 +00001277 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001278#endif /* CONFIG_DPP */
1279}
1280
Hai Shalom706f99b2019-01-08 16:23:37 -08001281void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001282{
1283#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001284 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001285 return;
1286
Gabriel Biren57ededa2021-09-03 16:08:50 +00001287 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001288#endif /* CONFIG_DPP */
1289}
Jimmy Chen126b1702019-08-28 17:59:33 +08001290
Hai Shalom06768112019-12-04 15:49:43 -08001291void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1292{
1293#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001294 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001295#endif /* CONFIG_DPP2 */
1296}
1297
1298void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1299{
1300#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001301 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001302#endif /* CONFIG_DPP2 */
1303}
1304
1305void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1306 enum dpp_status_error status, const char *ssid,
1307 const char *channel_list, unsigned short band_list[], int size)
1308{
1309#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001310 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001311#endif /* CONFIG_DPP2 */
1312}
1313
1314void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1315{
1316#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001317 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001318#endif /* CONFIG_DPP2 */
1319}
1320
Jimmy Chen126b1702019-08-28 17:59:33 +08001321void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1322 struct rsn_pmksa_cache_entry *entry)
1323{
1324 if (!wpa_s)
1325 return;
1326
Gabriel Biren57ededa2021-09-03 16:08:50 +00001327 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001328}
Jimmy Chen39deead2020-10-14 23:47:20 +08001329
1330void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1331 struct wpa_ssid *ssid,
1332 u8 bitmap)
1333{
1334 if (!wpa_s)
1335 return;
1336
1337 if (!ssid)
1338 return;
1339
Gabriel Biren57ededa2021-09-03 16:08:50 +00001340 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001341}
Sunil Ravi07c17622021-01-11 12:00:53 -08001342
1343void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1344{
1345 if (!wpa_s)
1346 return;
1347
Gabriel Biren57ededa2021-09-03 16:08:50 +00001348 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001349}
Hai Shalomc1a21442022-02-04 13:43:00 -08001350
1351#ifdef CONFIG_INTERWORKING
1352
1353void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1354 struct wpa_bss *bss,
1355 struct wpa_cred *cred, int excluded,
1356 const char *type, int bh, int bss_load,
1357 int conn_capab)
1358{
1359 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1360 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1361 MAC2STR(bss->bssid), type,
1362 bh ? " below_min_backhaul=1" : "",
1363 bss_load ? " over_max_bss_load=1" : "",
1364 conn_capab ? " conn_capab_missing=1" : "",
1365 cred->id, cred->priority, cred->sp_priority);
1366
1367 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1368 bh, bss_load, conn_capab);
1369}
1370
1371
1372void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1373{
1374 wpas_dbus_signal_interworking_select_done(wpa_s);
1375}
1376
Sunil Ravi99c035e2024-07-12 01:42:03 +00001377
Hai Shalomc1a21442022-02-04 13:43:00 -08001378#endif /* CONFIG_INTERWORKING */
1379
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001380void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1381 const char* reason_string)
1382{
1383 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1384}
1385
1386void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1387 const char *reason_string)
1388{
1389 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1390}
1391
1392void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1393 const char *reason_string)
1394{
1395 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1396}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301397
1398void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1399{
1400 if (!wpa_s)
1401 return;
1402
1403 wpas_aidl_notify_qos_policy_reset(wpa_s);
1404}
1405
1406void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1407 struct dscp_policy_data *policies, int num_policies)
1408{
1409 if (!wpa_s || !policies)
1410 return;
1411
1412 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1413}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001414
1415void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1416{
1417 if (!wpa_s)
1418 return;
1419
1420 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1421}
Gabriel Biren93398232022-12-15 19:18:28 +00001422
1423ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1424{
Gabriel Biren980c48a2023-03-27 21:49:21 +00001425 wpa_printf(MSG_INFO, "wpas_get_certificate");
Gabriel Biren93398232022-12-15 19:18:28 +00001426 return wpas_aidl_get_certificate(alias, value);
1427}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001428
Xinyue Ling1629ad82023-03-24 16:19:51 +08001429ssize_t wpas_list_aliases(const char *prefix, char ***aliases)
1430{
1431 return wpas_aidl_list_aliases(prefix, aliases);
1432}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001433
1434void wpas_notify_signal_change(struct wpa_supplicant *wpa_s)
1435{
1436 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE);
1437}
Swarn Singhc450e7b2023-03-28 17:36:22 +05301438
1439void wpas_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s,
1440 unsigned int num_scs_resp, int **scs_resp)
1441{
1442 if (!wpa_s || !num_scs_resp || !scs_resp)
1443 return;
1444
1445 wpas_aidl_notify_qos_policy_scs_response(wpa_s, num_scs_resp, scs_resp);
1446}
Sunil Ravib0ac25f2024-07-12 01:42:03 +00001447
1448void wpas_notify_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s,
1449 const char *url)
1450{
1451#ifdef CONFIG_HS20
1452 if (!wpa_s || !url)
1453 return;
1454
1455 wpa_msg(wpa_s, MSG_INFO, HS20_T_C_ACCEPTANCE "%s", url);
1456 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
1457 wpas_dbus_signal_hs20_t_c_acceptance(wpa_s, url);
1458#endif /* CONFIG_HS20 */
1459}