blob: bb2c0b7fa9284714cbcb97191c7802de362cc5a2 [file] [log] [blame]
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07001/*
2 * wpa_supplicant - Event notifications
3 * Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
4 *
Dmitry Shmidtc5ec7f52012-03-06 16:33:24 -08005 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -07007 */
8
9#include "utils/includes.h"
10
11#include "utils/common.h"
12#include "common/wpa_ctrl.h"
13#include "config.h"
14#include "wpa_supplicant_i.h"
15#include "wps_supplicant.h"
16#include "dbus/dbus_common.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070017#include "dbus/dbus_new.h"
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -080018#include "rsn_supp/wpa.h"
Dmitry Shmidtd80a4012015-11-05 16:35:40 -080019#include "fst/fst.h"
Hai Shalom81f62d82019-07-22 12:10:00 -070020#include "crypto/tls.h"
Hai Shalomc1a21442022-02-04 13:43:00 -080021#include "bss.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070022#include "driver_i.h"
23#include "scan.h"
24#include "p2p_supplicant.h"
25#include "sme.h"
26#include "notify.h"
Shivani Baranwalc58b6092022-12-01 11:17:24 +053027#include "aidl/aidl.h"
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070028
29int wpas_notify_supplicant_initialized(struct wpa_global *global)
30{
Hai Shalom021b0b52019-04-10 11:17:58 -070031#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070032 if (global->params.dbus_ctrl_interface) {
33 global->dbus = wpas_dbus_init(global);
34 if (global->dbus == NULL)
35 return -1;
36 }
Hai Shalom021b0b52019-04-10 11:17:58 -070037#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070038
Gabriel Biren57ededa2021-09-03 16:08:50 +000039#ifdef CONFIG_AIDL
40 global->aidl = wpas_aidl_init(global);
41 if (!global->aidl)
Dmitry Shmidte4663042016-04-04 10:07:49 -070042 return -1;
Gabriel Biren57ededa2021-09-03 16:08:50 +000043#endif /* CONFIG_AIDL */
Dmitry Shmidte4663042016-04-04 10:07:49 -070044
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070045 return 0;
46}
47
48
49void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
50{
Hai Shalom021b0b52019-04-10 11:17:58 -070051#ifdef CONFIG_CTRL_IFACE_DBUS_NEW
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070052 if (global->dbus)
53 wpas_dbus_deinit(global->dbus);
Hai Shalom021b0b52019-04-10 11:17:58 -070054#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
Dmitry Shmidte4663042016-04-04 10:07:49 -070055
Gabriel Biren57ededa2021-09-03 16:08:50 +000056#ifdef CONFIG_AIDL
57 if (global->aidl)
58 wpas_aidl_deinit(global->aidl);
59#endif /* CONFIG_AIDL */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070060}
61
62
63int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
64{
Hai Shalomc4809952019-04-30 14:45:55 -070065 if (!wpa_s->p2p_mgmt) {
66 if (wpas_dbus_register_interface(wpa_s))
67 return -1;
68 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070069
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080070 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000071 if (wpas_aidl_register_interface(wpa_s))
Roshan Pius54e763a2016-07-06 15:41:53 -070072 return -1;
73
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070074 return 0;
75}
76
77
78void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
79{
Hai Shalomc4809952019-04-30 14:45:55 -070080 if (!wpa_s->p2p_mgmt) {
81 /* unregister interface in new DBus ctrl iface */
82 wpas_dbus_unregister_interface(wpa_s);
83 }
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070084
Roshan Piusd6d8b8d2016-11-08 14:45:26 -080085 /* HIDL interface wants to keep track of the P2P mgmt iface. */
Gabriel Biren57ededa2021-09-03 16:08:50 +000086 wpas_aidl_unregister_interface(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070087}
88
89
90void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
91 enum wpa_states new_state,
92 enum wpa_states old_state)
93{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -080094 if (wpa_s->p2p_mgmt)
95 return;
96
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -070097 /* notify the new DBus API */
98 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_STATE);
99
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800100#ifdef CONFIG_FST
101 if (wpa_s->fst && !is_zero_ether_addr(wpa_s->bssid)) {
102 if (new_state == WPA_COMPLETED)
103 fst_notify_peer_connected(wpa_s->fst, wpa_s->bssid);
104 else if (old_state >= WPA_ASSOCIATED &&
105 new_state < WPA_ASSOCIATED)
106 fst_notify_peer_disconnected(wpa_s->fst, wpa_s->bssid);
107 }
108#endif /* CONFIG_FST */
109
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700110 if (new_state == WPA_COMPLETED)
111 wpas_p2p_notif_connected(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700112 else if (old_state >= WPA_ASSOCIATED && new_state < WPA_ASSOCIATED)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700113 wpas_p2p_notif_disconnected(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700114
115 sme_state_changed(wpa_s);
116
117#ifdef ANDROID
118 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_STATE_CHANGE
Irfan Sherifff20a4432012-04-16 16:48:34 -0700119 "id=%d state=%d BSSID=" MACSTR " SSID=%s",
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700120 wpa_s->current_ssid ? wpa_s->current_ssid->id : -1,
Irfan Sherifff20a4432012-04-16 16:48:34 -0700121 new_state,
Irfan Sheriffe78e7672012-08-01 11:10:15 -0700122 MAC2STR(wpa_s->bssid),
andy2_kuo5b5fb022012-05-22 11:53:07 -0700123 wpa_s->current_ssid && wpa_s->current_ssid->ssid ?
124 wpa_ssid_txt(wpa_s->current_ssid->ssid,
Dmitry Shmidte0e48dc2013-11-18 12:00:06 -0800125 wpa_s->current_ssid->ssid_len) : "");
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700126#endif /* ANDROID */
Roshan Piuse8d0d162016-08-01 13:09:26 -0700127
Gabriel Biren57ededa2021-09-03 16:08:50 +0000128 wpas_aidl_notify_state_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700129}
130
131
Dmitry Shmidt04949592012-07-19 12:16:46 -0700132void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
133{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800134 if (wpa_s->p2p_mgmt)
135 return;
136
Dmitry Shmidt04949592012-07-19 12:16:46 -0700137 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
Roshan Pius0974e962016-12-12 17:05:51 -0800138
Gabriel Biren57ededa2021-09-03 16:08:50 +0000139 wpas_aidl_notify_disconnect_reason(wpa_s);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700140}
141
142
Hai Shalom74f70d42019-02-11 14:42:39 -0800143void wpas_notify_auth_status_code(struct wpa_supplicant *wpa_s)
144{
145 if (wpa_s->p2p_mgmt)
146 return;
147
148 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AUTH_STATUS_CODE);
149}
150
151
Sunil Ravi972b2042020-08-14 10:50:48 -0700152void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s,
Sunil Ravie06118e2021-01-03 08:39:46 -0800153 const u8 *bssid, u8 timed_out,
154 const u8 *assoc_resp_ie, size_t assoc_resp_ie_len)
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800155{
156 if (wpa_s->p2p_mgmt)
157 return;
158
159 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
Roshan Pius0974e962016-12-12 17:05:51 -0800160
Gabriel Biren57ededa2021-09-03 16:08:50 +0000161 wpas_aidl_notify_assoc_reject(wpa_s, bssid, timed_out, assoc_resp_ie, assoc_resp_ie_len);
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800162}
163
Roshan Pius38e96762017-01-23 14:52:00 -0800164void wpas_notify_auth_timeout(struct wpa_supplicant *wpa_s) {
165 if (wpa_s->p2p_mgmt)
166 return;
167
Gabriel Biren57ededa2021-09-03 16:08:50 +0000168 wpas_aidl_notify_auth_timeout(wpa_s);
Roshan Pius38e96762017-01-23 14:52:00 -0800169}
Dmitry Shmidt31a29cc2016-03-09 15:58:17 -0800170
Hai Shalom74f70d42019-02-11 14:42:39 -0800171void wpas_notify_roam_time(struct wpa_supplicant *wpa_s)
172{
173 if (wpa_s->p2p_mgmt)
174 return;
175
176 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_TIME);
177}
178
179
180void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s)
181{
182 if (wpa_s->p2p_mgmt)
183 return;
184
185 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_ROAM_COMPLETE);
186}
187
188
189void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
190{
191 if (wpa_s->p2p_mgmt)
192 return;
193
194 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SESSION_LENGTH);
195}
196
197
198void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
199{
200 if (wpa_s->p2p_mgmt)
201 return;
202
203 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
Sunil Ravi4018d712019-12-06 18:01:21 -0800204
205#ifdef CONFIG_WNM
Gabriel Biren57ededa2021-09-03 16:08:50 +0000206 wpas_aidl_notify_bss_tm_status(wpa_s);
Sunil Ravi4018d712019-12-06 18:01:21 -0800207#endif
Hai Shalom74f70d42019-02-11 14:42:39 -0800208}
209
210
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700211void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
212{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800213 if (wpa_s->p2p_mgmt)
214 return;
215
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700216 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
217}
218
219
220void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
221{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800222 if (wpa_s->p2p_mgmt)
223 return;
224
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700225 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
226}
227
228
229void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
230{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800231 if (wpa_s->p2p_mgmt)
232 return;
233
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700234 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
Roshan Piuse746d6b2017-03-21 08:53:04 -0700235
Gabriel Biren57ededa2021-09-03 16:08:50 +0000236 wpas_aidl_notify_bssid_changed(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700237}
238
239
240void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
241{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800242 if (wpa_s->p2p_mgmt)
243 return;
244
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700245 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
246}
247
248
249void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
250 struct wpa_ssid *ssid)
251{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800252 if (wpa_s->p2p_mgmt)
253 return;
254
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700255 wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
256}
257
258
259void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
260 struct wpa_ssid *ssid)
261{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800262 if (wpa_s->p2p_mgmt)
263 return;
264
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700265 wpas_dbus_signal_network_selected(wpa_s, ssid->id);
266}
267
268
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800269void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
270 struct wpa_ssid *ssid,
271 enum wpa_ctrl_req_type rtype,
272 const char *default_txt)
273{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800274 if (wpa_s->p2p_mgmt)
275 return;
276
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800277 wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
Roshan Pius65628ce2016-08-17 13:10:23 -0700278
Gabriel Biren57ededa2021-09-03 16:08:50 +0000279 wpas_aidl_notify_network_request(wpa_s, ssid, rtype, default_txt);
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800280}
281
282
Steven Liu850c2e02022-11-28 17:26:39 +0000283void wpas_notify_permanent_id_req_denied(struct wpa_supplicant *wpa_s)
284{
285 wpas_aidl_notify_permanent_id_req_denied(wpa_s);
286}
287
288
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700289void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
290{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800291 if (wpa_s->p2p_mgmt)
292 return;
293
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700294 /* notify the new DBus API */
295 wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_SCANNING);
296}
297
298
299void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
300{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800301 if (wpa_s->p2p_mgmt)
302 return;
303
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700304 wpas_dbus_signal_scan_done(wpa_s, success);
305}
306
307
308void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
309{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800310 if (wpa_s->p2p_mgmt)
311 return;
312
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700313 wpas_wps_notify_scan_results(wpa_s);
314}
315
316
317void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
318 const struct wps_credential *cred)
319{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800320 if (wpa_s->p2p_mgmt)
321 return;
322
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700323#ifdef CONFIG_WPS
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700324 /* notify the new DBus API */
325 wpas_dbus_signal_wps_cred(wpa_s, cred);
326#endif /* CONFIG_WPS */
327}
328
329
330void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
331 struct wps_event_m2d *m2d)
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#ifdef CONFIG_WPS
337 wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
338#endif /* CONFIG_WPS */
339}
340
341
342void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
343 struct wps_event_fail *fail)
344{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800345 if (wpa_s->p2p_mgmt)
346 return;
347
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700348#ifdef CONFIG_WPS
349 wpas_dbus_signal_wps_event_fail(wpa_s, fail);
Roshan Pius14932752017-01-11 09:48:58 -0800350
Gabriel Biren57ededa2021-09-03 16:08:50 +0000351 wpas_aidl_notify_wps_event_fail(wpa_s, fail->peer_macaddr,
Roshan Pius14932752017-01-11 09:48:58 -0800352 fail->config_error,
353 fail->error_indication);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700354#endif /* CONFIG_WPS */
355}
356
357
358void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
359{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800360 if (wpa_s->p2p_mgmt)
361 return;
362
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700363#ifdef CONFIG_WPS
364 wpas_dbus_signal_wps_event_success(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800365
Gabriel Biren57ededa2021-09-03 16:08:50 +0000366 wpas_aidl_notify_wps_event_success(wpa_s);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700367#endif /* CONFIG_WPS */
368}
369
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700370void wpas_notify_wps_event_pbc_overlap(struct wpa_supplicant *wpa_s)
371{
372 if (wpa_s->p2p_mgmt)
373 return;
374
375#ifdef CONFIG_WPS
376 wpas_dbus_signal_wps_event_pbc_overlap(wpa_s);
Roshan Pius14932752017-01-11 09:48:58 -0800377
Gabriel Biren57ededa2021-09-03 16:08:50 +0000378 wpas_aidl_notify_wps_event_pbc_overlap(wpa_s);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700379#endif /* CONFIG_WPS */
380}
381
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700382
383void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
384 struct wpa_ssid *ssid)
385{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800386 if (wpa_s->p2p_mgmt)
387 return;
388
Jouni Malinen75ecf522011-06-27 15:19:46 -0700389 /*
390 * Networks objects created during any P2P activities should not be
391 * exposed out. They might/will confuse certain non-P2P aware
392 * applications since these network objects won't behave like
393 * regular ones.
394 */
Roshan Piusd3854452016-07-07 16:46:41 -0700395 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700396 wpas_dbus_register_network(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000397 wpas_aidl_register_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800398 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_ADDED "%d",
399 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700400 }
Jouni Malinen75ecf522011-06-27 15:19:46 -0700401}
402
403
404void wpas_notify_persistent_group_added(struct wpa_supplicant *wpa_s,
405 struct wpa_ssid *ssid)
406{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700407#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700408 wpas_dbus_register_persistent_group(wpa_s, ssid);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000409 wpas_aidl_register_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700410#endif /* CONFIG_P2P */
Jouni Malinen75ecf522011-06-27 15:19:46 -0700411}
412
413
414void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
415 struct wpa_ssid *ssid)
416{
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700417#ifdef CONFIG_P2P
Jouni Malinen75ecf522011-06-27 15:19:46 -0700418 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000419 wpas_aidl_unregister_network(wpa_s, ssid);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700420#endif /* CONFIG_P2P */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700421}
422
423
424void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
425 struct wpa_ssid *ssid)
426{
Dmitry Shmidtf21452a2014-02-26 10:55:25 -0800427 if (wpa_s->next_ssid == ssid)
428 wpa_s->next_ssid = NULL;
Sunil Ravia04bd252022-05-02 22:54:18 -0700429 if (wpa_s->last_ssid == ssid)
430 wpa_s->last_ssid = NULL;
431 if (wpa_s->current_ssid == ssid)
432 wpa_s->current_ssid = NULL;
Sunil Ravi89eba102022-09-13 21:04:37 -0700433#if defined(CONFIG_SME) && defined(CONFIG_SAE)
434 if (wpa_s->sme.ext_auth_wpa_ssid == ssid)
435 wpa_s->sme.ext_auth_wpa_ssid = NULL;
436#endif /* CONFIG_SME && CONFIG_SAE */
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800437 if (wpa_s->wpa)
438 wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
Dmitry Shmidtcc00d5d2015-05-04 10:34:12 -0700439 if (!ssid->p2p_group && wpa_s->global->p2p_group_formation != wpa_s &&
Roshan Piusd3854452016-07-07 16:46:41 -0700440 !wpa_s->p2p_mgmt) {
Jouni Malinen75ecf522011-06-27 15:19:46 -0700441 wpas_dbus_unregister_network(wpa_s, ssid->id);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000442 wpas_aidl_unregister_network(wpa_s, ssid);
Hai Shalomc1a21442022-02-04 13:43:00 -0800443 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_NETWORK_REMOVED "%d",
444 ssid->id);
Roshan Piusd3854452016-07-07 16:46:41 -0700445 }
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800446 if (network_is_persistent_group(ssid))
447 wpas_notify_persistent_group_removed(wpa_s, ssid);
448
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800449 wpas_p2p_network_removed(wpa_s, ssid);
Hai Shalom60840252021-02-19 19:02:11 -0800450
451#ifdef CONFIG_PASN
452 if (wpa_s->pasn.ssid == ssid)
453 wpa_s->pasn.ssid = NULL;
454#endif /* CONFIG_PASN */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700455}
456
457
458void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
459 u8 bssid[], unsigned int id)
460{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800461 if (wpa_s->p2p_mgmt)
462 return;
463
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700464 wpas_dbus_register_bss(wpa_s, bssid, id);
465 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
466 id, MAC2STR(bssid));
467}
468
469
470void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
471 u8 bssid[], unsigned int id)
472{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800473 if (wpa_s->p2p_mgmt)
474 return;
475
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700476 wpas_dbus_unregister_bss(wpa_s, bssid, id);
477 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
478 id, MAC2STR(bssid));
479}
480
481
482void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
483 unsigned int id)
484{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800485 if (wpa_s->p2p_mgmt)
486 return;
487
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700488 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
489}
490
491
492void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
493 unsigned int id)
494{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800495 if (wpa_s->p2p_mgmt)
496 return;
497
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700498 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
499 id);
500}
501
502
503void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
504 unsigned int id)
505{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800506 if (wpa_s->p2p_mgmt)
507 return;
508
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700509 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
510 id);
511}
512
513
514void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
515 unsigned int id)
516{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800517 if (wpa_s->p2p_mgmt)
518 return;
519
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700520 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
521}
522
523
524void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
525 unsigned int id)
526{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800527 if (wpa_s->p2p_mgmt)
528 return;
529
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700530 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
531}
532
533
534void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
535 unsigned int id)
536{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800537 if (wpa_s->p2p_mgmt)
538 return;
539
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700540 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
541}
542
543
544void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
545 unsigned int id)
546{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800547 if (wpa_s->p2p_mgmt)
548 return;
549
Dmitry Shmidtd5e49232012-12-03 15:08:10 -0800550#ifdef CONFIG_WPS
551 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
552#endif /* CONFIG_WPS */
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700553}
554
555
556void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
557 unsigned int id)
558{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800559 if (wpa_s->p2p_mgmt)
560 return;
561
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700562 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
563}
564
565
566void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
567 unsigned int id)
568{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800569 if (wpa_s->p2p_mgmt)
570 return;
571
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700572 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
573}
574
575
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700576void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
577{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800578 if (wpa_s->p2p_mgmt)
579 return;
580
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700581 wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
582}
583
584
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700585void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
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_signal_blob_added(wpa_s, name);
591}
592
593
594void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
595{
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800596 if (wpa_s->p2p_mgmt)
597 return;
598
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700599 wpas_dbus_signal_blob_removed(wpa_s, name);
600}
601
602
603void wpas_notify_debug_level_changed(struct wpa_global *global)
604{
605 wpas_dbus_signal_debug_level_changed(global);
606}
607
608
609void wpas_notify_debug_timestamp_changed(struct wpa_global *global)
610{
611 wpas_dbus_signal_debug_timestamp_changed(global);
612}
613
614
615void wpas_notify_debug_show_keys_changed(struct wpa_global *global)
616{
617 wpas_dbus_signal_debug_show_keys_changed(global);
618}
619
620
621void wpas_notify_suspend(struct wpa_global *global)
622{
623 struct wpa_supplicant *wpa_s;
624
625 os_get_time(&global->suspend_time);
626 wpa_printf(MSG_DEBUG, "System suspend notification");
627 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next)
628 wpa_drv_suspend(wpa_s);
629}
630
631
632void wpas_notify_resume(struct wpa_global *global)
633{
634 struct os_time now;
635 int slept;
636 struct wpa_supplicant *wpa_s;
637
638 if (global->suspend_time.sec == 0)
639 slept = -1;
640 else {
641 os_get_time(&now);
642 slept = now.sec - global->suspend_time.sec;
643 }
644 wpa_printf(MSG_DEBUG, "System resume notification (slept %d seconds)",
645 slept);
646
647 for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
648 wpa_drv_resume(wpa_s);
649 if (wpa_s->wpa_state == WPA_DISCONNECTED)
650 wpa_supplicant_req_scan(wpa_s, 0, 100000);
651 }
652}
653
654
655#ifdef CONFIG_P2P
656
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700657void wpas_notify_p2p_find_stopped(struct wpa_supplicant *wpa_s)
658{
659 /* Notify P2P find has stopped */
660 wpas_dbus_signal_p2p_find_stopped(wpa_s);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800661
Gabriel Biren57ededa2021-09-03 16:08:50 +0000662 wpas_aidl_notify_p2p_find_stopped(wpa_s);
Dmitry Shmidt8bd70b72015-05-26 16:02:19 -0700663}
664
665
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700666void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800667 const u8 *addr, const struct p2p_peer_info *info,
668 const u8* peer_wfd_device_info, u8 peer_wfd_device_info_len,
Jimmy Chen0133fc12021-03-04 13:56:11 +0800669 const u8* peer_wfd_r2_device_info, u8 peer_wfd_r2_device_info_len,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800670 int new_device)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700671{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700672 if (new_device) {
673 /* Create the new peer object */
Roshan Piusfd2fd662017-01-23 13:41:57 -0800674 wpas_dbus_register_peer(wpa_s, info->p2p_device_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700675 }
676
677 /* Notify a new peer has been detected*/
Roshan Piusfd2fd662017-01-23 13:41:57 -0800678 wpas_dbus_signal_peer_device_found(wpa_s, info->p2p_device_addr);
679
Gabriel Biren57ededa2021-09-03 16:08:50 +0000680 wpas_aidl_notify_p2p_device_found(wpa_s, addr, info,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800681 peer_wfd_device_info,
Jimmy Chen57e19f52021-03-04 14:19:52 +0800682 peer_wfd_device_info_len,
683 peer_wfd_r2_device_info,
684 peer_wfd_r2_device_info_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700685}
686
687
688void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
689 const u8 *dev_addr)
690{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700691 wpas_dbus_unregister_peer(wpa_s, dev_addr);
692
693 /* Create signal on interface object*/
694 wpas_dbus_signal_peer_device_lost(wpa_s, dev_addr);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800695
Gabriel Biren57ededa2021-09-03 16:08:50 +0000696 wpas_aidl_notify_p2p_device_lost(wpa_s, dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700697}
698
699
700void wpas_notify_p2p_group_removed(struct wpa_supplicant *wpa_s,
701 const struct wpa_ssid *ssid,
702 const char *role)
703{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700704 wpas_dbus_signal_p2p_group_removed(wpa_s, role);
Dmitry Shmidt03658832014-08-13 11:03:49 -0700705
706 wpas_dbus_unregister_p2p_group(wpa_s, ssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800707
Gabriel Biren57ededa2021-09-03 16:08:50 +0000708 wpas_aidl_notify_p2p_group_removed(wpa_s, ssid, role);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700709}
710
711
712void wpas_notify_p2p_go_neg_req(struct wpa_supplicant *wpa_s,
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700713 const u8 *src, u16 dev_passwd_id, u8 go_intent)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700714{
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700715 wpas_dbus_signal_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800716
Gabriel Biren57ededa2021-09-03 16:08:50 +0000717 wpas_aidl_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id, go_intent);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700718}
719
720
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800721void wpas_notify_p2p_go_neg_completed(struct wpa_supplicant *wpa_s,
722 struct p2p_go_neg_results *res)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700723{
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800724 wpas_dbus_signal_p2p_go_neg_resp(wpa_s, res);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800725
Gabriel Biren57ededa2021-09-03 16:08:50 +0000726 wpas_aidl_notify_p2p_go_neg_completed(wpa_s, res);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700727}
728
729
730void wpas_notify_p2p_invitation_result(struct wpa_supplicant *wpa_s,
731 int status, const u8 *bssid)
732{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700733 wpas_dbus_signal_p2p_invitation_result(wpa_s, status, bssid);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800734
Gabriel Biren57ededa2021-09-03 16:08:50 +0000735 wpas_aidl_notify_p2p_invitation_result(wpa_s, status, bssid);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700736}
737
738
739void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
740 int freq, const u8 *sa, u8 dialog_token,
741 u16 update_indic, const u8 *tlvs,
742 size_t tlvs_len)
743{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700744 wpas_dbus_signal_p2p_sd_request(wpa_s, freq, sa, dialog_token,
745 update_indic, tlvs, tlvs_len);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700746}
747
748
749void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
750 const u8 *sa, u16 update_indic,
751 const u8 *tlvs, size_t tlvs_len)
752{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700753 wpas_dbus_signal_p2p_sd_response(wpa_s, sa, update_indic,
754 tlvs, tlvs_len);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800755
Gabriel Biren57ededa2021-09-03 16:08:50 +0000756 wpas_aidl_notify_p2p_sd_response(wpa_s, sa, update_indic,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800757 tlvs, tlvs_len);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700758}
759
760
761/**
762 * wpas_notify_p2p_provision_discovery - Notification of provision discovery
763 * @dev_addr: Who sent the request or responded to our request.
764 * @request: Will be 1 if request, 0 for response.
765 * @status: Valid only in case of response (0 in case of success)
766 * @config_methods: WPS config methods
767 * @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
768 *
769 * This can be used to notify:
770 * - Requests or responses
771 * - Various config methods
772 * - Failure condition in case of response
773 */
774void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
775 const u8 *dev_addr, int request,
776 enum p2p_prov_disc_status status,
777 u16 config_methods,
778 unsigned int generated_pin)
779{
780 wpas_dbus_signal_p2p_provision_discovery(wpa_s, dev_addr, request,
781 status, config_methods,
782 generated_pin);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800783
Gabriel Biren57ededa2021-09-03 16:08:50 +0000784 wpas_aidl_notify_p2p_provision_discovery(wpa_s, dev_addr, request,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800785 status, config_methods,
786 generated_pin);
787
Jouni Malinen75ecf522011-06-27 15:19:46 -0700788}
789
790
791void wpas_notify_p2p_group_started(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd5ab1b52016-06-21 12:38:41 -0700792 struct wpa_ssid *ssid, int persistent,
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800793 int client, const u8 *ip)
Jouni Malinen75ecf522011-06-27 15:19:46 -0700794{
795 /* Notify a group has been started */
796 wpas_dbus_register_p2p_group(wpa_s, ssid);
797
Dmitry Shmidtabb90a32016-12-05 15:34:39 -0800798 wpas_dbus_signal_p2p_group_started(wpa_s, client, persistent, ip);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800799
Gabriel Biren57ededa2021-09-03 16:08:50 +0000800 wpas_aidl_notify_p2p_group_started(wpa_s, ssid, persistent, client);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700801}
802
803
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800804void wpas_notify_p2p_group_formation_failure(struct wpa_supplicant *wpa_s,
805 const char *reason)
806{
807 /* Notify a group formation failed */
808 wpas_dbus_signal_p2p_group_formation_failure(wpa_s, reason);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800809
Gabriel Biren57ededa2021-09-03 16:08:50 +0000810 wpas_aidl_notify_p2p_group_formation_failure(wpa_s, reason);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800811}
812
813
Jouni Malinen75ecf522011-06-27 15:19:46 -0700814void wpas_notify_p2p_wps_failed(struct wpa_supplicant *wpa_s,
815 struct wps_event_fail *fail)
816{
817 wpas_dbus_signal_p2p_wps_failed(wpa_s, fail);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700818}
819
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800820
821void wpas_notify_p2p_invitation_received(struct wpa_supplicant *wpa_s,
822 const u8 *sa, const u8 *go_dev_addr,
823 const u8 *bssid, int id, int op_freq)
824{
825 /* Notify a P2P Invitation Request */
826 wpas_dbus_signal_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
827 id, op_freq);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800828
Gabriel Biren57ededa2021-09-03 16:08:50 +0000829 wpas_aidl_notify_p2p_invitation_received(wpa_s, sa, go_dev_addr, bssid,
Roshan Piusfd2fd662017-01-23 13:41:57 -0800830 id, op_freq);
Dmitry Shmidtd80a4012015-11-05 16:35:40 -0800831}
832
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700833#endif /* CONFIG_P2P */
834
835
836static void wpas_notify_ap_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800837 const u8 *sta,
838 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700839{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700840#ifdef CONFIG_P2P
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800841 wpas_p2p_notify_ap_sta_authorized(wpa_s, p2p_dev_addr);
842
Jouni Malinen75ecf522011-06-27 15:19:46 -0700843 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700844 * Create 'peer-joined' signal on group object -- will also
845 * check P2P itself.
846 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800847 if (p2p_dev_addr)
848 wpas_dbus_signal_p2p_peer_joined(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700849#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700850
Hai Shalom74f70d42019-02-11 14:42:39 -0800851 /* Register the station */
852 wpas_dbus_register_sta(wpa_s, sta);
853
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700854 /* Notify listeners a new station has been authorized */
855 wpas_dbus_signal_sta_authorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800856
Gabriel Biren57ededa2021-09-03 16:08:50 +0000857 wpas_aidl_notify_ap_sta_authorized(wpa_s, sta, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700858}
859
860
861static void wpas_notify_ap_sta_deauthorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700862 const u8 *sta,
863 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700864{
Jouni Malinen75ecf522011-06-27 15:19:46 -0700865#ifdef CONFIG_P2P
866 /*
Jouni Malinen75ecf522011-06-27 15:19:46 -0700867 * Create 'peer-disconnected' signal on group object if this
868 * is a P2P group.
869 */
Dmitry Shmidt6c0da2b2015-01-05 13:08:17 -0800870 if (p2p_dev_addr)
871 wpas_dbus_signal_p2p_peer_disconnected(wpa_s, p2p_dev_addr);
Jouni Malinen75ecf522011-06-27 15:19:46 -0700872#endif /* CONFIG_P2P */
Dmitry Shmidt34af3062013-07-11 10:46:32 -0700873
874 /* Notify listeners a station has been deauthorized */
875 wpas_dbus_signal_sta_deauthorized(wpa_s, sta);
Roshan Piusfd2fd662017-01-23 13:41:57 -0800876
Gabriel Biren57ededa2021-09-03 16:08:50 +0000877 wpas_aidl_notify_ap_sta_deauthorized(wpa_s, sta, p2p_dev_addr);
Hai Shalom74f70d42019-02-11 14:42:39 -0800878 /* Unregister the station */
879 wpas_dbus_unregister_sta(wpa_s, sta);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700880}
881
882
883void wpas_notify_sta_authorized(struct wpa_supplicant *wpa_s,
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800884 const u8 *mac_addr, int authorized,
885 const u8 *p2p_dev_addr)
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700886{
887 if (authorized)
Dmitry Shmidt1f69aa52012-01-24 16:10:04 -0800888 wpas_notify_ap_sta_authorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700889 else
Dmitry Shmidtd30ac602014-06-30 09:54:22 -0700890 wpas_notify_ap_sta_deauthorized(wpa_s, mac_addr, p2p_dev_addr);
Dmitry Shmidt8d520ff2011-05-09 14:06:53 -0700891}
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700892
893
Hai Shalom81f62d82019-07-22 12:10:00 -0700894void wpas_notify_certification(struct wpa_supplicant *wpa_s,
895 struct tls_cert_data *cert,
896 const char *cert_hash)
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700897{
Hai Shalom81f62d82019-07-22 12:10:00 -0700898 int i;
Hai Shalom878cf7b2019-07-15 14:55:18 -0700899
Hai Shalom81f62d82019-07-22 12:10:00 -0700900 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_CERT
Hai Shalomc3565922019-10-28 11:58:20 -0700901 "depth=%d subject='%s'%s%s%s%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700902 cert->depth, cert->subject, cert_hash ? " hash=" : "",
903 cert_hash ? cert_hash : "",
Hai Shalomc3565922019-10-28 11:58:20 -0700904 cert->tod == 2 ? " tod=2" : "",
905 cert->tod == 1 ? " tod=1" : "");
Hai Shalom81f62d82019-07-22 12:10:00 -0700906
907 if (cert->cert) {
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700908 char *cert_hex;
Hai Shalom81f62d82019-07-22 12:10:00 -0700909 size_t len = wpabuf_len(cert->cert) * 2 + 1;
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700910 cert_hex = os_malloc(len);
911 if (cert_hex) {
Hai Shalom81f62d82019-07-22 12:10:00 -0700912 wpa_snprintf_hex(cert_hex, len, wpabuf_head(cert->cert),
913 wpabuf_len(cert->cert));
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700914 wpa_msg_ctrl(wpa_s, MSG_INFO,
915 WPA_EVENT_EAP_PEER_CERT
916 "depth=%d subject='%s' cert=%s",
Hai Shalom81f62d82019-07-22 12:10:00 -0700917 cert->depth, cert->subject, cert_hex);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700918 os_free(cert_hex);
919 }
920 }
921
Hai Shalom81f62d82019-07-22 12:10:00 -0700922 for (i = 0; i < cert->num_altsubject; i++)
923 wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_EAP_PEER_ALT
924 "depth=%d %s", cert->depth, cert->altsubject[i]);
Dmitry Shmidt2f74e362015-01-21 13:19:05 -0800925
Jimmy Chen429daf92021-10-20 13:27:23 +0800926 wpas_aidl_notify_ceritification(wpa_s, cert->depth, cert->subject,
927 cert->altsubject, cert->num_altsubject,
928 cert_hash, cert->cert);
929
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700930 /* notify the new DBus API */
Hai Shalom81f62d82019-07-22 12:10:00 -0700931 wpas_dbus_signal_certification(wpa_s, cert->depth, cert->subject,
932 cert->altsubject, cert->num_altsubject,
933 cert_hash, cert->cert);
Dmitry Shmidtc55524a2011-07-07 11:18:38 -0700934}
Dmitry Shmidt04949592012-07-19 12:16:46 -0700935
936
937void wpas_notify_preq(struct wpa_supplicant *wpa_s,
938 const u8 *addr, const u8 *dst, const u8 *bssid,
939 const u8 *ie, size_t ie_len, u32 ssi_signal)
940{
941#ifdef CONFIG_AP
942 wpas_dbus_signal_preq(wpa_s, addr, dst, bssid, ie, ie_len, ssi_signal);
943#endif /* CONFIG_AP */
944}
945
946
947void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
948 const char *parameter)
949{
950 wpas_dbus_signal_eap_status(wpa_s, status, parameter);
Dmitry Shmidt8da800a2013-04-24 12:57:01 -0700951 wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_EAP_STATUS
952 "status='%s' parameter='%s'",
953 status, parameter);
Dmitry Shmidt04949592012-07-19 12:16:46 -0700954}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700955
Roshan Pius3a1667e2018-07-03 15:17:14 -0700956
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700957void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
958{
959 wpa_dbg(wpa_s, MSG_ERROR,
960 "EAP Error code = %d", error_code);
Gabriel Biren57ededa2021-09-03 16:08:50 +0000961 wpas_aidl_notify_eap_error(wpa_s, error_code);
Ahmed ElArabawy9c86a7f2018-03-15 09:00:10 -0700962}
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700963
Roshan Pius3a1667e2018-07-03 15:17:14 -0700964
Dmitry Shmidt661b4f72014-09-29 14:58:27 -0700965void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
966 struct wpa_ssid *ssid)
967{
968 if (wpa_s->current_ssid != ssid)
969 return;
970
971 wpa_dbg(wpa_s, MSG_DEBUG,
972 "Network bssid config changed for the current network - within-ESS roaming %s",
973 ssid->bssid_set ? "disabled" : "enabled");
974
975 wpa_drv_roaming(wpa_s, !ssid->bssid_set,
976 ssid->bssid_set ? ssid->bssid : NULL);
977}
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800978
979
980void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,
981 struct wpa_ssid *ssid)
982{
983#ifdef CONFIG_P2P
984 if (ssid->disabled == 2) {
985 /* Changed from normal network profile to persistent group */
986 ssid->disabled = 0;
987 wpas_dbus_unregister_network(wpa_s, ssid->id);
988 ssid->disabled = 2;
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700989 ssid->p2p_persistent_group = 1;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800990 wpas_dbus_register_persistent_group(wpa_s, ssid);
991 } else {
992 /* Changed from persistent group to normal network profile */
993 wpas_dbus_unregister_persistent_group(wpa_s, ssid->id);
Dmitry Shmidt7a53dbb2015-06-11 13:13:53 -0700994 ssid->p2p_persistent_group = 0;
Dmitry Shmidt7f656022015-02-25 14:36:37 -0800995 wpas_dbus_register_network(wpa_s, ssid);
996 }
997#endif /* CONFIG_P2P */
998}
Roshan Pius04a9d742016-12-12 12:40:46 -0800999
1000void wpas_notify_anqp_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1001 const char *result,
1002 const struct wpa_bss_anqp *anqp)
1003{
1004#ifdef CONFIG_INTERWORKING
1005 if (!wpa_s || !bssid || !anqp)
1006 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001007
Gabriel Biren57ededa2021-09-03 16:08:50 +00001008 wpas_aidl_notify_anqp_query_done(wpa_s, bssid, result, anqp);
Roshan Pius04a9d742016-12-12 12:40:46 -08001009#endif /* CONFIG_INTERWORKING */
1010}
1011
1012void wpas_notify_hs20_icon_query_done(struct wpa_supplicant *wpa_s, const u8* bssid,
1013 const char* file_name, const u8* image,
1014 u32 image_length)
1015{
1016#ifdef CONFIG_HS20
1017 if (!wpa_s || !bssid || !file_name || !image)
1018 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001019
Gabriel Biren57ededa2021-09-03 16:08:50 +00001020 wpas_aidl_notify_hs20_icon_query_done(wpa_s, bssid, file_name, image,
Roshan Pius9322a342016-12-12 14:45:02 -08001021 image_length);
Roshan Pius04a9d742016-12-12 12:40:46 -08001022#endif /* CONFIG_HS20 */
1023}
1024
1025void wpas_notify_hs20_rx_subscription_remediation(struct wpa_supplicant *wpa_s,
1026 const char* url,
1027 u8 osu_method)
1028{
1029#ifdef CONFIG_HS20
1030 if (!wpa_s || !url)
1031 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001032
Gabriel Biren57ededa2021-09-03 16:08:50 +00001033 wpas_aidl_notify_hs20_rx_subscription_remediation(wpa_s, url, osu_method);
Roshan Pius04a9d742016-12-12 12:40:46 -08001034#endif /* CONFIG_HS20 */
1035}
1036
1037void wpas_notify_hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s,
1038 u8 code, u16 reauth_delay,
1039 const char *url)
1040{
1041#ifdef CONFIG_HS20
Hai Shalomb3a7c702020-10-20 12:22:53 -07001042 if (!wpa_s)
Roshan Pius04a9d742016-12-12 12:40:46 -08001043 return;
Roshan Pius9322a342016-12-12 14:45:02 -08001044
Gabriel Biren57ededa2021-09-03 16:08:50 +00001045 wpas_aidl_notify_hs20_rx_deauth_imminent_notice(wpa_s, code, reauth_delay,
Hai Shalom04a4ca62020-10-28 19:04:47 -07001046 url);
Roshan Pius04a9d742016-12-12 12:40:46 -08001047#endif /* CONFIG_HS20 */
1048}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001049
Hai Shalom04a4ca62020-10-28 19:04:47 -07001050void wpas_notify_hs20_rx_terms_and_conditions_acceptance(
1051 struct wpa_supplicant *wpa_s, const char *url) {
1052#ifdef CONFIG_HS20
1053 if (!wpa_s || !url)
1054 return;
1055
Gabriel Biren57ededa2021-09-03 16:08:50 +00001056 wpas_aidl_notify_hs20_rx_terms_and_conditions_acceptance(wpa_s, url);
Hai Shalom04a4ca62020-10-28 19:04:47 -07001057#endif /* CONFIG_HS20 */
1058}
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001059
1060#ifdef CONFIG_MESH
1061
1062void wpas_notify_mesh_group_started(struct wpa_supplicant *wpa_s,
1063 struct wpa_ssid *ssid)
1064{
1065 if (wpa_s->p2p_mgmt)
1066 return;
1067
1068 wpas_dbus_signal_mesh_group_started(wpa_s, ssid);
1069}
1070
1071
1072void wpas_notify_mesh_group_removed(struct wpa_supplicant *wpa_s,
1073 const u8 *meshid, u8 meshid_len,
Hai Shalom81f62d82019-07-22 12:10:00 -07001074 u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001075{
1076 if (wpa_s->p2p_mgmt)
1077 return;
1078
1079 wpas_dbus_signal_mesh_group_removed(wpa_s, meshid, meshid_len,
1080 reason_code);
1081}
1082
1083
1084void wpas_notify_mesh_peer_connected(struct wpa_supplicant *wpa_s,
1085 const u8 *peer_addr)
1086{
1087 if (wpa_s->p2p_mgmt)
1088 return;
1089
1090 wpas_dbus_signal_mesh_peer_connected(wpa_s, peer_addr);
1091}
1092
1093
1094void wpas_notify_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
Hai Shalom81f62d82019-07-22 12:10:00 -07001095 const u8 *peer_addr, u16 reason_code)
Dmitry Shmidtd2986c22017-10-23 14:22:09 -07001096{
1097 if (wpa_s->p2p_mgmt)
1098 return;
1099
1100 wpas_dbus_signal_mesh_peer_disconnected(wpa_s, peer_addr, reason_code);
1101}
1102
1103#endif /* CONFIG_MESH */
Hai Shalom59532852018-12-07 10:32:58 -08001104
1105/*
1106 * DPP Notifications
1107 */
1108
1109/* DPP Success notifications */
1110
Hai Shalom706f99b2019-01-08 16:23:37 -08001111void wpas_notify_dpp_config_received(struct wpa_supplicant *wpa_s,
Sunil Ravi546a7b52022-08-26 22:06:04 +00001112 struct wpa_ssid *ssid, bool conn_status_requested)
Hai Shalom59532852018-12-07 10:32:58 -08001113{
1114#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001115 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001116 return;
1117
Sunil Ravi546a7b52022-08-26 22:06:04 +00001118 wpas_aidl_notify_dpp_config_received(wpa_s, ssid, conn_status_requested);
Hai Shalom59532852018-12-07 10:32:58 -08001119#endif /* CONFIG_DPP */
1120}
1121
Hai Shalom706f99b2019-01-08 16:23:37 -08001122void wpas_notify_dpp_config_sent(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001123{
1124#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001125 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001126 return;
1127
Gabriel Biren57ededa2021-09-03 16:08:50 +00001128 wpas_aidl_notify_dpp_config_sent(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001129#endif /* CONFIG_DPP */
1130}
1131
Sunil Ravi546a7b52022-08-26 22:06:04 +00001132void wpas_notify_dpp_connection_status_sent(struct wpa_supplicant *wpa_s,
1133 enum dpp_status_error result)
1134{
1135#ifdef CONFIG_DPP2
1136 if (!wpa_s)
1137 return;
1138
1139 wpas_aidl_notify_dpp_connection_status_sent(wpa_s, result);
1140#endif /* CONFIG_DPP2 */
1141}
1142
Hai Shalom59532852018-12-07 10:32:58 -08001143/* DPP Progress notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001144void wpas_notify_dpp_auth_success(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001145{
1146#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001147 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001148 return;
1149
Gabriel Biren57ededa2021-09-03 16:08:50 +00001150 wpas_aidl_notify_dpp_auth_success(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001151#endif /* CONFIG_DPP */
1152}
1153
Hai Shalom706f99b2019-01-08 16:23:37 -08001154void wpas_notify_dpp_resp_pending(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001155{
1156#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001157 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001158 return;
1159
Gabriel Biren57ededa2021-09-03 16:08:50 +00001160 wpas_aidl_notify_dpp_resp_pending(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001161#endif /* CONFIG_DPP */
1162}
1163
1164/* DPP Failure notifications */
Hai Shalom706f99b2019-01-08 16:23:37 -08001165void wpas_notify_dpp_not_compatible(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001166{
1167#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001168 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001169 return;
1170
Gabriel Biren57ededa2021-09-03 16:08:50 +00001171 wpas_aidl_notify_dpp_not_compatible(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001172#endif /* CONFIG_DPP */
1173}
1174
Hai Shalom706f99b2019-01-08 16:23:37 -08001175void wpas_notify_dpp_missing_auth(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001176{
1177#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001178 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001179 return;
1180
Gabriel Biren57ededa2021-09-03 16:08:50 +00001181 wpas_aidl_notify_dpp_missing_auth(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001182#endif /* CONFIG_DPP */
1183}
1184
Hai Shalom706f99b2019-01-08 16:23:37 -08001185void wpas_notify_dpp_configuration_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001186{
1187#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001188 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001189 return;
1190
Gabriel Biren57ededa2021-09-03 16:08:50 +00001191 wpas_aidl_notify_dpp_configuration_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001192#endif /* CONFIG_DPP */
1193}
1194
Hai Shalom706f99b2019-01-08 16:23:37 -08001195void wpas_notify_dpp_timeout(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001196{
1197#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001198 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001199 return;
1200
Gabriel Biren57ededa2021-09-03 16:08:50 +00001201 wpas_aidl_notify_dpp_timeout(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001202#endif /* CONFIG_DPP */
1203}
1204
Hai Shalom706f99b2019-01-08 16:23:37 -08001205void wpas_notify_dpp_auth_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001206{
1207#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001208 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001209 return;
1210
Gabriel Biren57ededa2021-09-03 16:08:50 +00001211 wpas_aidl_notify_dpp_auth_failure(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001212#endif /* CONFIG_DPP */
1213}
1214
Hai Shalom706f99b2019-01-08 16:23:37 -08001215void wpas_notify_dpp_failure(struct wpa_supplicant *wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001216{
1217#ifdef CONFIG_DPP
Hai Shalom706f99b2019-01-08 16:23:37 -08001218 if (!wpa_s)
Hai Shalom59532852018-12-07 10:32:58 -08001219 return;
1220
Gabriel Biren57ededa2021-09-03 16:08:50 +00001221 wpas_aidl_notify_dpp_fail(wpa_s);
Hai Shalom59532852018-12-07 10:32:58 -08001222#endif /* CONFIG_DPP */
1223}
Jimmy Chen126b1702019-08-28 17:59:33 +08001224
Hai Shalom06768112019-12-04 15:49:43 -08001225void wpas_notify_dpp_config_sent_wait_response(struct wpa_supplicant *wpa_s)
1226{
1227#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001228 wpas_aidl_notify_dpp_config_sent_wait_response(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001229#endif /* CONFIG_DPP2 */
1230}
1231
1232void wpas_notify_dpp_config_accepted(struct wpa_supplicant *wpa_s)
1233{
1234#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001235 wpas_aidl_notify_dpp_config_accepted(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001236#endif /* CONFIG_DPP2 */
1237}
1238
1239void wpas_notify_dpp_conn_status(struct wpa_supplicant *wpa_s,
1240 enum dpp_status_error status, const char *ssid,
1241 const char *channel_list, unsigned short band_list[], int size)
1242{
1243#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001244 wpas_aidl_notify_dpp_conn_status(wpa_s, status, ssid, channel_list, band_list, size);
Hai Shalom06768112019-12-04 15:49:43 -08001245#endif /* CONFIG_DPP2 */
1246}
1247
1248void wpas_notify_dpp_config_rejected(struct wpa_supplicant *wpa_s)
1249{
1250#ifdef CONFIG_DPP2
Gabriel Biren57ededa2021-09-03 16:08:50 +00001251 wpas_aidl_notify_dpp_config_rejected(wpa_s);
Hai Shalom06768112019-12-04 15:49:43 -08001252#endif /* CONFIG_DPP2 */
1253}
1254
Jimmy Chen126b1702019-08-28 17:59:33 +08001255void wpas_notify_pmk_cache_added(struct wpa_supplicant *wpa_s,
1256 struct rsn_pmksa_cache_entry *entry)
1257{
1258 if (!wpa_s)
1259 return;
1260
Gabriel Biren57ededa2021-09-03 16:08:50 +00001261 wpas_aidl_notify_pmk_cache_added(wpa_s, entry);
Jimmy Chen126b1702019-08-28 17:59:33 +08001262}
Jimmy Chen39deead2020-10-14 23:47:20 +08001263
1264void wpas_notify_transition_disable(struct wpa_supplicant *wpa_s,
1265 struct wpa_ssid *ssid,
1266 u8 bitmap)
1267{
1268 if (!wpa_s)
1269 return;
1270
1271 if (!ssid)
1272 return;
1273
Gabriel Biren57ededa2021-09-03 16:08:50 +00001274 wpas_aidl_notify_transition_disable(wpa_s, ssid, bitmap);
Jimmy Chen39deead2020-10-14 23:47:20 +08001275}
Sunil Ravi07c17622021-01-11 12:00:53 -08001276
1277void wpas_notify_network_not_found(struct wpa_supplicant *wpa_s)
1278{
1279 if (!wpa_s)
1280 return;
1281
Gabriel Biren57ededa2021-09-03 16:08:50 +00001282 wpas_aidl_notify_network_not_found(wpa_s);
Sunil Ravi07c17622021-01-11 12:00:53 -08001283}
Hai Shalomc1a21442022-02-04 13:43:00 -08001284
1285#ifdef CONFIG_INTERWORKING
1286
1287void wpas_notify_interworking_ap_added(struct wpa_supplicant *wpa_s,
1288 struct wpa_bss *bss,
1289 struct wpa_cred *cred, int excluded,
1290 const char *type, int bh, int bss_load,
1291 int conn_capab)
1292{
1293 wpa_msg(wpa_s, MSG_INFO, "%s" MACSTR " type=%s%s%s%s id=%d priority=%d sp_priority=%d",
1294 excluded ? INTERWORKING_EXCLUDED : INTERWORKING_AP,
1295 MAC2STR(bss->bssid), type,
1296 bh ? " below_min_backhaul=1" : "",
1297 bss_load ? " over_max_bss_load=1" : "",
1298 conn_capab ? " conn_capab_missing=1" : "",
1299 cred->id, cred->priority, cred->sp_priority);
1300
1301 wpas_dbus_signal_interworking_ap_added(wpa_s, bss, cred, type, excluded,
1302 bh, bss_load, conn_capab);
1303}
1304
1305
1306void wpas_notify_interworking_select_done(struct wpa_supplicant *wpa_s)
1307{
1308 wpas_dbus_signal_interworking_select_done(wpa_s);
1309}
1310
1311#endif /* CONFIG_INTERWORKING */
1312
Gabriel Biren3a2ec2c2022-03-07 17:59:41 +00001313void wpas_notify_eap_method_selected(struct wpa_supplicant *wpa_s,
1314 const char* reason_string)
1315{
1316 wpas_aidl_notify_eap_method_selected(wpa_s, reason_string);
1317}
1318
1319void wpas_notify_ssid_temp_disabled(struct wpa_supplicant *wpa_s,
1320 const char *reason_string)
1321{
1322 wpas_aidl_notify_ssid_temp_disabled(wpa_s, reason_string);
1323}
1324
1325void wpas_notify_open_ssl_failure(struct wpa_supplicant *wpa_s,
1326 const char *reason_string)
1327{
1328 wpas_aidl_notify_open_ssl_failure(wpa_s, reason_string);
1329}
Shivani Baranwal84940f82022-02-02 10:21:47 +05301330
1331void wpas_notify_qos_policy_reset(struct wpa_supplicant *wpa_s)
1332{
1333 if (!wpa_s)
1334 return;
1335
1336 wpas_aidl_notify_qos_policy_reset(wpa_s);
1337}
1338
1339void wpas_notify_qos_policy_request(struct wpa_supplicant *wpa_s,
1340 struct dscp_policy_data *policies, int num_policies)
1341{
1342 if (!wpa_s || !policies)
1343 return;
1344
1345 wpas_aidl_notify_qos_policy_request(wpa_s, policies, num_policies);
1346}
Sunil Ravi65a724b2022-05-24 11:06:09 -07001347
1348void wpas_notify_frequency_changed(struct wpa_supplicant *wpa_s, int frequency)
1349{
1350 if (!wpa_s)
1351 return;
1352
1353 wpas_aidl_notify_frequency_changed(wpa_s, frequency);
1354}
Gabriel Biren93398232022-12-15 19:18:28 +00001355
1356ssize_t wpas_get_certificate(const char *alias, uint8_t** value)
1357{
1358 return wpas_aidl_get_certificate(alias, value);
1359}