blob: 89a0389ee35985d9da2d08ca146cc2c0a1ebdb1c [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
Hai Shalom74f70d42019-02-11 14:42:39 -0800157void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
158{
159 if (wpa_s->p2p_mgmt)
160 return;
161
162 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
163}
164
165
Sunil Ravi972b2042020-08-14 10:50:48 -0700166void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800167 const u8 *bssid, u8 timed_out,
168 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800169{
170 if (wpa_s->p2p_mgmt)
171 return;
172
173 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800174
Gabriel Biren57ededa2021-09-03 16:08:50 +0000175 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800176}
177
Roshan Pius38e96762017-01-23 14:52:00 -0800178void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
179 if (wpa_s->p2p_mgmt)
180 return;
181
Gabriel Biren57ededa2021-09-03 16:08:50 +0000182 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800183}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800184
Hai Shalom74f70d42019-02-11 14:42:39 -0800185void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
186{
187 if (wpa_s->p2p_mgmt)
188 return;
189
190 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
191}
192
193
194void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
195{
196 if (wpa_s->p2p_mgmt)
197 return;
198
199 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
200}
201
202
203void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
204{
205 if (wpa_s->p2p_mgmt)
206 return;
207
208 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
209}
210
211
212void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
213{
214 if (wpa_s->p2p_mgmt)
215 return;
216
217 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800218
219#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000220 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800221#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800222}
223
224
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700225void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
226{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800227 if (wpa_s->p2p_mgmt)
228 return;
229
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700230 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
231}
232
233
234void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
235{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800236 if (wpa_s->p2p_mgmt)
237 return;
238
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700239 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
240}
241
242
243void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
244{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800245 if (wpa_s->p2p_mgmt)
246 return;
247
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700248 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700249
Gabriel Biren57ededa2021-09-03 16:08:50 +0000250 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700251}
252
253
Sunil Ravi77d572f2023-01-17 23:58:31 +0000254void wpas_notify_mac_address_changed(struct wpa_supplicant *wpa_s)
255{
256 if (wpa_s->p2p_mgmt)
257 return;
258
259 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_MAC_ADDRESS);
260}
261
262
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700263void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
264{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800265 if (wpa_s->p2p_mgmt)
266 return;
267
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700268 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
269}
270
271
272void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
273 struct wpa_ssid *ssid)
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_network_enabled_changed(wpa_s, ssid);
279}
280
281
282void wpas_notify_network_selected(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_selected(wpa_s, ssid->id);
289}
290
291
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800292void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
293 struct wpa_ssid *ssid,
294 enum wpa_ctrl_req_type rtype,
295 const char *default_txt)
296{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800297 if (wpa_s->p2p_mgmt)
298 return;
299
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800300 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700301
Gabriel Biren57ededa2021-09-03 16:08:50 +0000302 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800303}
304
305
Steven Liu850c2e02022-11-28 17:26:39 +0000306void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
307{
308 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
309}
310
311
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700312void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
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 /* notify the new DBus API */
318 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
319}
320
321
322void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
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 wpas_dbus_signal_scan_done(wpa_s, success);
328}
329
330
331void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
332{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800333 if (wpa_s->p2p_mgmt)
334 return;
335
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700336 wpas_wps_notify_scan_results(wpa_s);
337}
338
339
340void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
341 const struct wps_credential *cred)
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#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700347 /* notify the new DBus API */
348 wpas_dbus_signal_wps_cred(wpa_s, cred);
349#endif /* CONFIG_WPS */
350}
351
352
353void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
354 struct wps_event_m2d *m2d)
355{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800356 if (wpa_s->p2p_mgmt)
357 return;
358
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700359#ifdef CONFIG_WPS
360 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
361#endif /* CONFIG_WPS */
362}
363
364
365void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
366 struct wps_event_fail *fail)
367{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800368 if (wpa_s->p2p_mgmt)
369 return;
370
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700371#ifdef CONFIG_WPS
372 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800373
Gabriel Biren57ededa2021-09-03 16:08:50 +0000374 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800375 fail->config_error,
376 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700377#endif /* CONFIG_WPS */
378}
379
380
381void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
382{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800383 if (wpa_s->p2p_mgmt)
384 return;
385
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700386#ifdef CONFIG_WPS
387 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800388
Gabriel Biren57ededa2021-09-03 16:08:50 +0000389 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700390#endif /* CONFIG_WPS */
391}
392
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700393void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
394{
395 if (wpa_s->p2p_mgmt)
396 return;
397
398#ifdef CONFIG_WPS
399 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800400
Gabriel Biren57ededa2021-09-03 16:08:50 +0000401 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700402#endif /* CONFIG_WPS */
403}
404
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700405
406void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
407 struct wpa_ssid *ssid)
408{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800409 if (wpa_s->p2p_mgmt)
410 return;
411
Jouni Malinen75ecf522011-06-27 15:19:46 -0700412 /*
413 * Networks objects created during any P2P activities should not be
414 * exposed out. They might/will confuse certain non-P2P aware
415 * applications since these network objects won't behave like
416 * regular ones.
417 */
Roshan Piusd3854452016-07-07 16:46:41 -0700418 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700419 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000420 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800421 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
422 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700423 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700424}
425
426
427void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
428 struct wpa_ssid *ssid)
429{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700430#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700431 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000432 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700433#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700434}
435
436
437void wpas_notify_persistent_group_removed(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_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000442 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700443#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700444}
445
446
447void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
448 struct wpa_ssid *ssid)
449{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800450 if (wpa_s->next_ssid == ssid)
451 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700452 if (wpa_s->last_ssid == ssid)
453 wpa_s->last_ssid = NULL;
454 if (wpa_s->current_ssid == ssid)
455 wpa_s->current_ssid = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700456#if defined(CONFIG_SME) && defined(CONFIG_SAE)
457 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
458 wpa_s->sme.ext_auth_wpa_ssid = NULL;
459#endif /* CONFIG_SME && CONFIG_SAE */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800460 if (wpa_s->wpa)
461 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700462 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700463 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700464 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000465 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800466 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
467 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700468 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800469 if (network_is_persistent_group(ssid))
470 wpas_notify_persistent_group_removed(wpa_s, ssid);
471
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800472 wpas_p2p_network_removed(wpa_s, ssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700473}
474
475
476void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
477 u8 bssid[], unsigned int id)
478{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800479 if (wpa_s->p2p_mgmt)
480 return;
481
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700482 wpas_dbus_register_bss(wpa_s, bssid, id);
483 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
484 id, MAC2STR(bssid));
485}
486
487
488void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
489 u8 bssid[], unsigned int id)
490{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800491 if (wpa_s->p2p_mgmt)
492 return;
493
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700494 wpas_dbus_unregister_bss(wpa_s, bssid, id);
495 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
496 id, MAC2STR(bssid));
497}
498
499
500void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
501 unsigned int id)
502{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800503 if (wpa_s->p2p_mgmt)
504 return;
505
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700506 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
507}
508
509
510void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
511 unsigned int id)
512{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800513 if (wpa_s->p2p_mgmt)
514 return;
515
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700516 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
517 id);
518}
519
520
521void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
522 unsigned int id)
523{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800524 if (wpa_s->p2p_mgmt)
525 return;
526
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700527 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
528 id);
529}
530
531
532void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
533 unsigned int id)
534{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800535 if (wpa_s->p2p_mgmt)
536 return;
537
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700538 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
539}
540
541
542void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
543 unsigned int id)
544{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800545 if (wpa_s->p2p_mgmt)
546 return;
547
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700548 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
549}
550
551
552void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
553 unsigned int id)
554{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800555 if (wpa_s->p2p_mgmt)
556 return;
557
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700558 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
559}
560
561
562void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
563 unsigned int id)
564{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800565 if (wpa_s->p2p_mgmt)
566 return;
567
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800568#ifdef CONFIG_WPS
569 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
570#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700571}
572
573
574void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
575 unsigned int id)
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_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
581}
582
583
584void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
585 unsigned int id)
586{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800587 if (wpa_s->p2p_mgmt)
588 return;
589
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700590 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
591}
592
593
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700594void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
595{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800596 if (wpa_s->p2p_mgmt)
597 return;
598
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700599 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
600}
601
602
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700603void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
604{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800605 if (wpa_s->p2p_mgmt)
606 return;
607
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700608 wpas_dbus_signal_blob_added(wpa_s, name);
609}
610
611
612void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
613{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800614 if (wpa_s->p2p_mgmt)
615 return;
616
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700617 wpas_dbus_signal_blob_removed(wpa_s, name);
618}
619
620
621void wpas_notify_debug_level_changed(struct wpa_global *global)
622{
623 wpas_dbus_signal_debug_level_changed(global);
624}
625
626
627void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
628{
629 wpas_dbus_signal_debug_timestamp_changed(global);
630}
631
632
633void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
634{
635 wpas_dbus_signal_debug_show_keys_changed(global);
636}
637
638
639void wpas_notify_suspend(struct wpa_global *global)
640{
641 struct wpa_supplicant *wpa_s;
642
643 os_get_time(&global->suspend_time);
644 wpa_printf(MSG_DEBUG, "System suspend notification");
645 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
646 wpa_drv_suspend(wpa_s);
647}
648
649
650void wpas_notify_resume(struct wpa_global *global)
651{
652 struct os_time now;
653 int slept;
654 struct wpa_supplicant *wpa_s;
655
656 if (global->suspend_time.sec == 0)
657 slept = -1;
658 else {
659 os_get_time(&now);
660 slept = now.sec - global->suspend_time.sec;
661 }
662 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
663 slept);
664
665 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
666 wpa_drv_resume(wpa_s);
667 if (wpa_s->wpa_state == WPA_DISCONNECTED)
668 wpa_supplicant_req_scan(wpa_s, 0, 100000);
669 }
670}
671
672
673#ifdef CONFIG_P2P
674
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700675void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
676{
677 /* Notify P2P find has stopped */
678 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800679
Gabriel Biren57ededa2021-09-03 16:08:50 +0000680 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700681}
682
683
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700684void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800685 const u8 *addr, const struct p2p_peer_info *info,
686 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800687 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800688 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700689{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700690 if (new_device) {
691 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800692 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700693 }
694
695 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800696 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
697
Gabriel Biren57ededa2021-09-03 16:08:50 +0000698 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800699 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800700 peer_wfd_device_info_len,
701 peer_wfd_r2_device_info,
702 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700703}
704
705
706void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
707 const u8 *dev_addr)
708{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700709 wpas_dbus_unregister_peer(wpa_s, dev_addr);
710
711 /* Create signal on interface object*/
712 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800713
Gabriel Biren57ededa2021-09-03 16:08:50 +0000714 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700715}
716
717
718void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
719 const struct wpa_ssid *ssid,
720 const char *role)
721{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700722 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700723
724 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800725
Gabriel Biren57ededa2021-09-03 16:08:50 +0000726 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700727}
728
729
730void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700731 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700732{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700733 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800734
Gabriel Biren57ededa2021-09-03 16:08:50 +0000735 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700736}
737
738
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800739void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
740 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700741{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800742 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800743
Gabriel Biren57ededa2021-09-03 16:08:50 +0000744 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700745}
746
747
748void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
749 int status, const u8 *bssid)
750{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700751 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800752
Gabriel Biren57ededa2021-09-03 16:08:50 +0000753 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700754}
755
756
757void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
758 int freq, const u8 *sa, u8 dialog_token,
759 u16 update_indic, const u8 *tlvs,
760 size_t tlvs_len)
761{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700762 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
763 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700764}
765
766
767void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
768 const u8 *sa, u16 update_indic,
769 const u8 *tlvs, size_t tlvs_len)
770{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700771 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
772 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800773
Gabriel Biren57ededa2021-09-03 16:08:50 +0000774 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800775 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700776}
777
778
779/**
780 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
781 * @dev_addr: Who sent the request or responded to our request.
782 * @request: Will be 1 if request, 0 for response.
783 * @status: Valid only in case of response (0 in case of success)
784 * @config_methods: WPS config methods
785 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
786 *
787 * This can be used to notify:
788 * - Requests or responses
789 * - Various config methods
790 * - Failure condition in case of response
791 */
792void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
793 const u8 *dev_addr, int request,
794 enum p2p_prov_disc_status status,
795 u16 config_methods,
796 unsigned int generated_pin)
797{
798 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
799 status, config_methods,
800 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800801
Gabriel Biren57ededa2021-09-03 16:08:50 +0000802 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800803 status, config_methods,
804 generated_pin);
805
Jouni Malinen75ecf522011-06-27 15:19:46 -0700806}
807
808
809void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700810 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800811 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700812{
813 /* Notify a group has been started */
814 wpas_dbus_register_p2p_group(wpa_s, ssid);
815
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800816 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800817
Sunil Ravi68c25c22023-02-04 06:17:03 +0000818 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client, ip);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700819}
820
821
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800822void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
823 const char *reason)
824{
825 /* Notify a group formation failed */
826 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800827
Gabriel Biren57ededa2021-09-03 16:08:50 +0000828 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800829}
830
831
Jouni Malinen75ecf522011-06-27 15:19:46 -0700832void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
833 struct wps_event_fail *fail)
834{
835 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700836}
837
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800838
839void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
840 const u8 *sa, const u8 *go_dev_addr,
841 const u8 *bssid, int id, int op_freq)
842{
843 /* Notify a P2P Invitation Request */
844 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
845 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800846
Gabriel Biren57ededa2021-09-03 16:08:50 +0000847 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800848 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800849}
850
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700851#endif /* CONFIG_P2P */
852
853
854static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800855 const u8 *sta,
856 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700857{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700858#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800859 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
860
Jouni Malinen75ecf522011-06-27 15:19:46 -0700861 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700862 * Create 'peer-joined' signal on group object -- will also
863 * check P2P itself.
864 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800865 if (p2p_dev_addr)
866 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700867#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700868
Hai Shalom74f70d42019-02-11 14:42:39 -0800869 /* Register the station */
870 wpas_dbus_register_sta(wpa_s, sta);
871
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700872 /* Notify listeners a new station has been authorized */
873 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800874
Gabriel Biren57ededa2021-09-03 16:08:50 +0000875 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700876}
877
878
879static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700880 const u8 *sta,
881 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700882{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700883#ifdef CONFIG_P2P
884 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700885 * Create 'peer-disconnected' signal on group object if this
886 * is a P2P group.
887 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800888 if (p2p_dev_addr)
889 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700890#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700891
892 /* Notify listeners a station has been deauthorized */
893 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800894
Gabriel Biren57ededa2021-09-03 16:08:50 +0000895 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800896 /* Unregister the station */
897 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700898}
899
900
901void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800902 const u8 *mac_addr, int authorized,
903 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700904{
905 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800906 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700907 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700908 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700909}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700910
911
Hai Shalom81f62d82019-07-22 12:10:00 -0700912void wpas_notify_certification(struct wpa_supplicant *wpa_s,
913 struct tls_cert_data *cert,
914 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700915{
Hai Shalom81f62d82019-07-22 12:10:00 -0700916 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700917
Hai Shalom81f62d82019-07-22 12:10:00 -0700918 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700919 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700920 cert->depth, cert->subject, cert_hash ? " hash=" : "",
921 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700922 cert->tod == 2 ? " tod=2" : "",
923 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700924
925 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700926 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700927 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700928 cert_hex = os_malloc(len);
929 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700930 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
931 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700932 wpa_msg_ctrl(wpa_s, MSG_INFO,
933 WPA_EVENT_EAP_PEER_CERT
934 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700935 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700936 os_free(cert_hex);
937 }
938 }
939
Hai Shalom81f62d82019-07-22 12:10:00 -0700940 for (i = 0; i < cert->num_altsubject; i++)
941 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
942 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800943
Jimmy Chen429daf92021-10-20 13:27:23 +0800944 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
945 cert->altsubject, cert->num_altsubject,
946 cert_hash, cert->cert);
947
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700948 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700949 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
950 cert->altsubject, cert->num_altsubject,
951 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700952}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700953
954
955void wpas_notify_preq(struct wpa_supplicant *wpa_s,
956 const u8 *addr, const u8 *dst, const u8 *bssid,
957 const u8 *ie, size_t ie_len, u32 ssi_signal)
958{
959#ifdef CONFIG_AP
960 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
961#endif /* CONFIG_AP */
962}
963
964
965void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
966 const char *parameter)
967{
968 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700969 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
970 "status='%s' parameter='%s'",
971 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700972}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700973
Roshan Pius3a1667e2018-07-03 15:17:14 -0700974
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700975void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
976{
977 wpa_dbg(wpa_s, MSG_ERROR,
978 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000979 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700980}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700981
Roshan Pius3a1667e2018-07-03 15:17:14 -0700982
Sunil Ravi036cec52023-03-29 11:35:17 -0700983void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
984{
985 wpas_dbus_signal_psk_mismatch(wpa_s);
986}
987
988
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700989void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
990 struct wpa_ssid *ssid)
991{
992 if (wpa_s->current_ssid != ssid)
993 return;
994
995 wpa_dbg(wpa_s, MSG_DEBUG,
996 "Network bssid config changed for the current network - within-ESS roaming %s",
997 ssid->bssid_set ? "disabled" : "enabled");
998
999 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
1000 ssid->bssid_set ? ssid->bssid : NULL);
1001}
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001002
1003
1004void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
1005 struct wpa_ssid *ssid)
1006{
1007#ifdef CONFIG_P2P
1008 if (ssid->disabled == 2) {
1009 /* Changed from normal network profile to persistent group */
1010 ssid->disabled = 0;
1011 wpas_dbus_unregister_network(wpa_s, ssid->id);
1012 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001013 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001014 wpas_dbus_register_persistent_group(wpa_s, ssid);
1015 } else {
1016 /* Changed from persistent group to normal network profile */
1017 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -07001018 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -08001019 wpas_dbus_register_network(wpa_s, ssid);
1020 }
1021#endif /* CONFIG_P2P */
1022}
Roshan Pius04a9d742016-12-12 12:40:46 -08001023
1024void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1025 const char *result,
1026 const struct wpa_bss_anqp *anqp)
1027{
1028#ifdef CONFIG_INTERWORKING
1029 if (!wpa_s || !bssid || !anqp)
1030 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001031
Gabriel Biren57ededa2021-09-03 16:08:50 +00001032 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001033#endif /* CONFIG_INTERWORKING */
1034}
1035
1036void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1037 const char* file_name, const u8* image,
1038 u32 image_length)
1039{
1040#ifdef CONFIG_HS20
1041 if (!wpa_s || !bssid || !file_name || !image)
1042 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001043
Gabriel Biren57ededa2021-09-03 16:08:50 +00001044 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001045 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001046#endif /* CONFIG_HS20 */
1047}
1048
1049void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1050 const char* url,
1051 u8 osu_method)
1052{
1053#ifdef CONFIG_HS20
1054 if (!wpa_s || !url)
1055 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001056
Gabriel Biren57ededa2021-09-03 16:08:50 +00001057 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001058#endif /* CONFIG_HS20 */
1059}
1060
1061void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1062 u8 code, u16 reauth_delay,
1063 const char *url)
1064{
1065#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001066 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001067 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001068
Gabriel Biren57ededa2021-09-03 16:08:50 +00001069 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001070 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001071#endif /* CONFIG_HS20 */
1072}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001073
Hai Shalom04a4ca62020-10-28 19:04:47 -07001074void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1075 struct wpa_supplicant *wpa_s, const char *url) {
1076#ifdef CONFIG_HS20
1077 if (!wpa_s || !url)
1078 return;
1079
Gabriel Biren57ededa2021-09-03 16:08:50 +00001080 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001081#endif /* CONFIG_HS20 */
1082}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001083
1084#ifdef CONFIG_MESH
1085
1086void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1087 struct wpa_ssid *ssid)
1088{
1089 if (wpa_s->p2p_mgmt)
1090 return;
1091
1092 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1093}
1094
1095
1096void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1097 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001098 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001099{
1100 if (wpa_s->p2p_mgmt)
1101 return;
1102
1103 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1104 reason_code);
1105}
1106
1107
1108void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1109 const u8 *peer_addr)
1110{
1111 if (wpa_s->p2p_mgmt)
1112 return;
1113
1114 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1115}
1116
1117
1118void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001119 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001120{
1121 if (wpa_s->p2p_mgmt)
1122 return;
1123
1124 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1125}
1126
1127#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001128
1129/*
1130 * DPP Notifications
1131 */
1132
1133/* DPP Success notifications */
1134
Hai Shalom706f99b2019-01-08 16:23:37 -08001135void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Sunil Ravi546a7b52022-08-26 22:06:04 +00001136 struct wpa_ssid *ssid, bool conn_status_requested)
Hai Shalom59532852018-12-07 10:32:58 -08001137{
1138#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001139 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001140 return;
1141
Sunil Ravi546a7b52022-08-26 22:06:04 +00001142 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
Hai Shalom59532852018-12-07 10:32:58 -08001143#endif /* CONFIG_DPP */
1144}
1145
Hai Shalom706f99b2019-01-08 16:23:37 -08001146void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001147{
1148#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001149 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001150 return;
1151
Gabriel Biren57ededa2021-09-03 16:08:50 +00001152 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001153#endif /* CONFIG_DPP */
1154}
1155
Sunil Ravi546a7b52022-08-26 22:06:04 +00001156void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1157 enum dpp_status_error result)
1158{
1159#ifdef CONFIG_DPP2
1160 if (!wpa_s)
1161 return;
1162
1163 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1164#endif /* CONFIG_DPP2 */
1165}
1166
Hai Shalom59532852018-12-07 10:32:58 -08001167/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001168void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001169{
1170#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001171 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001172 return;
1173
Gabriel Biren57ededa2021-09-03 16:08:50 +00001174 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001175#endif /* CONFIG_DPP */
1176}
1177
Hai Shalom706f99b2019-01-08 16:23:37 -08001178void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001179{
1180#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001181 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001182 return;
1183
Gabriel Biren57ededa2021-09-03 16:08:50 +00001184 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001185#endif /* CONFIG_DPP */
1186}
1187
1188/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001189void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001190{
1191#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001192 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001193 return;
1194
Gabriel Biren57ededa2021-09-03 16:08:50 +00001195 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001196#endif /* CONFIG_DPP */
1197}
1198
Hai Shalom706f99b2019-01-08 16:23:37 -08001199void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001200{
1201#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001202 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001203 return;
1204
Gabriel Biren57ededa2021-09-03 16:08:50 +00001205 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001206#endif /* CONFIG_DPP */
1207}
1208
Hai Shalom706f99b2019-01-08 16:23:37 -08001209void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001210{
1211#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001212 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001213 return;
1214
Gabriel Biren57ededa2021-09-03 16:08:50 +00001215 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001216#endif /* CONFIG_DPP */
1217}
1218
Hai Shalom706f99b2019-01-08 16:23:37 -08001219void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001220{
1221#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001222 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001223 return;
1224
Gabriel Biren57ededa2021-09-03 16:08:50 +00001225 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001226#endif /* CONFIG_DPP */
1227}
1228
Hai Shalom706f99b2019-01-08 16:23:37 -08001229void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001230{
1231#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001232 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001233 return;
1234
Gabriel Biren57ededa2021-09-03 16:08:50 +00001235 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001236#endif /* CONFIG_DPP */
1237}
1238
Hai Shalom706f99b2019-01-08 16:23:37 -08001239void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001240{
1241#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001242 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001243 return;
1244
Gabriel Biren57ededa2021-09-03 16:08:50 +00001245 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001246#endif /* CONFIG_DPP */
1247}
Jimmy Chen126b1702019-08-28 17:59:33 +08001248
Hai Shalom06768112019-12-04 15:49:43 -08001249void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1250{
1251#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001252 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001253#endif /* CONFIG_DPP2 */
1254}
1255
1256void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1257{
1258#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001259 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001260#endif /* CONFIG_DPP2 */
1261}
1262
1263void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1264 enum dpp_status_error status, const char *ssid,
1265 const char *channel_list, unsigned short band_list[], int size)
1266{
1267#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001268 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001269#endif /* CONFIG_DPP2 */
1270}
1271
1272void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1273{
1274#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001275 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001276#endif /* CONFIG_DPP2 */
1277}
1278
Jimmy Chen126b1702019-08-28 17:59:33 +08001279void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1280 struct rsn_pmksa_cache_entry *entry)
1281{
1282 if (!wpa_s)
1283 return;
1284
Gabriel Biren57ededa2021-09-03 16:08:50 +00001285 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001286}
Jimmy Chen39deead2020-10-14 23:47:20 +08001287
1288void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1289 struct wpa_ssid *ssid,
1290 u8 bitmap)
1291{
1292 if (!wpa_s)
1293 return;
1294
1295 if (!ssid)
1296 return;
1297
Gabriel Biren57ededa2021-09-03 16:08:50 +00001298 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001299}
Sunil Ravi07c17622021-01-11 12:00:53 -08001300
1301void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1302{
1303 if (!wpa_s)
1304 return;
1305
Gabriel Biren57ededa2021-09-03 16:08:50 +00001306 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001307}
Hai Shalomc1a21442022-02-04 13:43:00 -08001308
1309#ifdef CONFIG_INTERWORKING
1310
1311void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1312 struct wpa_bss *bss,
1313 struct wpa_cred *cred, int excluded,
1314 const char *type, int bh, int bss_load,
1315 int conn_capab)
1316{
1317 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1318 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1319 MAC2STR(bss->bssid), type,
1320 bh ? " below_min_backhaul=1" : "",
1321 bss_load ? " over_max_bss_load=1" : "",
1322 conn_capab ? " conn_capab_missing=1" : "",
1323 cred->id, cred->priority, cred->sp_priority);
1324
1325 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1326 bh, bss_load, conn_capab);
1327}
1328
1329
1330void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1331{
1332 wpas_dbus_signal_interworking_select_done(wpa_s);
1333}
1334
1335#endif /* CONFIG_INTERWORKING */
1336
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001337void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1338 const char* reason_string)
1339{
1340 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1341}
1342
1343void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1344 const char *reason_string)
1345{
1346 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1347}
1348
1349void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1350 const char *reason_string)
1351{
1352 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1353}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301354
1355void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1356{
1357 if (!wpa_s)
1358 return;
1359
1360 wpas_aidl_notify_qos_policy_reset(wpa_s);
1361}
1362
1363void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1364 struct dscp_policy_data *policies, int num_policies)
1365{
1366 if (!wpa_s || !policies)
1367 return;
1368
1369 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1370}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001371
1372void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1373{
1374 if (!wpa_s)
1375 return;
1376
1377 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1378}
Gabriel Biren93398232022-12-15 19:18:28 +00001379
1380ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1381{
Gabriel Biren980c48a2023-03-27 21:49:21 +00001382 wpa_printf(MSG_INFO, "wpas_get_certificate");
Gabriel Biren93398232022-12-15 19:18:28 +00001383 return wpas_aidl_get_certificate(alias, value);
1384}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001385
Xinyue Ling1629ad82023-03-24 16:19:51 +08001386ssize_t wpas_list_aliases(const char *prefix, char ***aliases)
1387{
1388 return wpas_aidl_list_aliases(prefix, aliases);
1389}
Sunil Ravi77d572f2023-01-17 23:58:31 +00001390
1391void wpas_notify_signal_change(struct wpa_supplicant *wpa_s)
1392{
1393 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SIGNAL_CHANGE);
1394}
Swarn Singhc450e7b2023-03-28 17:36:22 +05301395
1396void wpas_notify_qos_policy_scs_response(struct wpa_supplicant *wpa_s,
1397 unsigned int num_scs_resp, int **scs_resp)
1398{
1399 if (!wpa_s || !num_scs_resp || !scs_resp)
1400 return;
1401
1402 wpas_aidl_notify_qos_policy_scs_response(wpa_s, num_scs_resp, scs_resp);
1403}